diff --git a/AdditionalPlotView.cpp b/AdditionalPlotView.cpp index 876c94d..86db5c8 100644 --- a/AdditionalPlotView.cpp +++ b/AdditionalPlotView.cpp @@ -155,7 +155,7 @@ void AdditionalPlotView::SetAll(std::vector &Setups) for(int Row = 0; Row < Count; ++Row) Plots[Row].Plot.PlotSetup = Setups[Row]; EditNumRows.SetData(Count); - NumRowsChanged(true); + NumRowsChanged(true); } void SerializePlotSetup(Json &SetupJson, plot_setup &Setup, MobiView *ParentWindow) diff --git a/MCMC.cpp b/MCMC.cpp index 6eb110b..d4bcb00 100644 --- a/MCMC.cpp +++ b/MCMC.cpp @@ -83,7 +83,7 @@ bool AffineStretchMove(double *SamplerParams, double *Scale, int Step, int Walke bool AffineWalkMove(double *SamplerParams, double *Scale, int Step, int Walker, int FirstEnsembleWalker, int EnsembleStep, size_t NEnsemble, mcmc_data *Data, double (*LogLikelyhood)(void *, int, int), void *LLFunState) -{ +{ int S0 = (int)SamplerParams[0]; bool Accepted = true; @@ -163,7 +163,7 @@ bool DifferentialEvolutionMove(double *SamplerParams, double *Scale, int Step, i int EnsW1 = (int)Random(NEnsemble) + FirstEnsembleWalker; int EnsW2; - do + do EnsW2 = (int)Random(NEnsemble) + FirstEnsembleWalker; while(EnsW2 == EnsW1); diff --git a/MCMCResultWindow.cpp b/MCMCResultWindow.cpp index f5694f7..62fbf96 100644 --- a/MCMCResultWindow.cpp +++ b/MCMCResultWindow.cpp @@ -937,10 +937,8 @@ void MCMCResultWindow::GenerateProjectionsPushed() ParentWindow->ModelDll.GetResultSeries(DataSets[Worker], Target.ResultName.data(), (char**)ResultIndexes.data(), ResultIndexes.size(), ResultYValues); - if(!ParametricOnly) { - std::vector ErrParam(Target.ErrParNum.size()); for(int Idx = 0; Idx < ErrParam.size(); ++Idx) ErrParam[Idx] = Pars[Target.ErrParNum[Idx]]; AddRandomError(ResultYValues, ResultTimesteps, ErrParam, Target.ErrStruct, Generators[Worker]); @@ -1133,7 +1131,7 @@ void MCMCResultWindow::GenerateProjectionsPushed() ResidualYValues.reserve(ResultTimesteps); ComputeStandardizedResiduals(InputYValues, YValuesOfMedian, ResultTimesteps, ErrPar, Target.ErrStruct, ResidualYValues); - assert(YValuesStored.size() == ResidualYValues.size()); + //assert(YValuesStored.size() == ResidualYValues.size()); GraphColor = ResidPlot.PlotColors.Next(); ResidPlot.SetSequentialXAll(false); diff --git a/OptimizationWindow.cpp b/OptimizationWindow.cpp index 66ff94c..c0db693 100644 --- a/OptimizationWindow.cpp +++ b/OptimizationWindow.cpp @@ -126,6 +126,8 @@ OptimizationWindow::OptimizationWindow() RunSetup.EditEpsilon.Min(0.0); RunSetup.EditEpsilon.SetData(0.0); + RunSetup.OptionShowProgress.SetData(true); + MCMCSetup.PushRun.WhenPush = [&](){ RunClicked(1); }; MCMCSetup.PushRun.SetImage(IconImg4::Run()); @@ -1723,13 +1725,13 @@ void OptimizationWindow::RunClicked(int RunType) auto BeginTime = std::chrono::high_resolution_clock::now(); std::vector Dummy; - dlib::function_evaluation Result - = dlib::find_max_global(OptimizationModel, - MinBound, + dlib::function_evaluation Result + = dlib::find_max_global(OptimizationModel, + MinBound, MaxBound, - dlib::max_function_calls(MaxFunctionCalls), - dlib::FOREVER, - Epsilon, + dlib::max_function_calls(MaxFunctionCalls), + dlib::FOREVER, + Epsilon, InitialEvals ); @@ -2148,6 +2150,8 @@ void OptimizationWindow::LoadFromJson() return; } + //PromptOK("Bing!"); + String JsonData = LoadFile(Filename); LoadFromJsonString(JsonData); diff --git a/ParameterView.cpp b/ParameterView.cpp index 2246c37..257b9de 100644 --- a/ParameterView.cpp +++ b/ParameterView.cpp @@ -77,7 +77,7 @@ MobiView::GetSelectedParameterGroupIndexSets(std::vector &IndexSetsOut, indexed_parameter MobiView::GetParameterAtRow(int Row) -{ +{ indexed_parameter Result = {}; Result.Valid = false; @@ -101,26 +101,26 @@ MobiView::GetParameterAtRow(int Row) for(char * IndexSetName : IndexSetNames) { int IdxSetId = IndexSetNameToId[IndexSetName]; - - parameter_index Idx = {}; - String IndexName; - if(SecondExpandedSetLocal == IdxIdx) - { - //NOTE: This is a "little" hacky... - for(int Col = 0; Col < Params.ParameterView.GetColumnCount(); ++Col) - { - LineEdit *Control = (LineEdit *)Params.ParameterView.GetCtrl(Row, Col); - if(Control->HasFocus()) - { - IndexName = Params.ParameterView.GetId(Col); - break; - } - } - } - else if(ExpandedSetLocal == IdxIdx) - IndexName = Params.ParameterView.Get(Row, Id("__index")); - else - IndexName = IndexList[IdxSetId]->Get(); + + parameter_index Idx = {}; + String IndexName; + if(SecondExpandedSetLocal == IdxIdx) + { + //NOTE: This is a "little" hacky... + for(int Col = 0; Col < Params.ParameterView.GetColumnCount(); ++Col) + { + LineEdit *Control = (LineEdit *)Params.ParameterView.GetCtrl(Row, Col); + if(Control->HasFocus()) + { + IndexName = Params.ParameterView.GetId(Col); + break; + } + } + } + else if(ExpandedSetLocal == IdxIdx) + IndexName = Params.ParameterView.Get(Row, Id("__index")); + else + IndexName = IndexList[IdxSetId]->Get(); Idx.IndexSetName = std::string(IndexSetName); Idx.Name = IndexName.ToStd(); @@ -271,7 +271,7 @@ void MobiView::RefreshParameterView(bool RefreshValuesOnly) Params.ParameterView.AddColumn(Id("__value"), "Value"); } else - { + { for(char *IndexName : SecondExpandedIndexSet) Params.ParameterView.AddColumn(Id(IndexName), IndexName); } @@ -313,7 +313,7 @@ void MobiView::RefreshParameterView(bool RefreshValuesOnly) //NOTE: We don't store info about it being locked here, since that has to be //overridden later anyway (the lock status can have changed since the table was //constructed. - Parameter.Indexes[Idx].Locked = false; + Parameter.Indexes[Idx].Locked = false; } } @@ -448,7 +448,7 @@ void MobiView::RefreshParameterView(bool RefreshValuesOnly) StrToTime(D, TimeVal); //Error handling? But should not be necessary. RowData.Set(ValueColumn, D); - if(!RefreshValuesOnly) + if(!RefreshValuesOnly) { ParameterControls.Create(); diff --git a/Plotting.cpp b/Plotting.cpp index c0e94c1..73f4fae 100644 --- a/Plotting.cpp +++ b/Plotting.cpp @@ -90,7 +90,7 @@ MyPlot::MyPlot() { //this->SetFastViewX(true); Can't be used with scatter plot data since it combines points. - this->SetSequentialXAll(true); + //this->SetSequentialXAll(true); // And this crops lines that go outside the boundary. Size PlotReticleSize = GetTextSize("00000000", this->GetReticleFont()); Size PlotUnitSize = GetTextSize("[dummy]", this->GetLabelsFont()); @@ -1379,7 +1379,7 @@ void MyPlot::StackedPlotFixup(plot_major_mode MajorMode) //NOTE we have to do backwards iteration so that the ones that were added first are the //ones on top. Otherwise the ones in front will be higher and over-paint them. - for(int Idx = this->CachedStackY.size()-1; Idx >= 0; --Idx) + for(int Idx = this->CachedStackY.size()-1; Idx >= 0; --Idx) { double *Ys = this->CachedStackY[Idx]; for(size_t Ts = 0; Ts < Len; ++Ts) @@ -1391,7 +1391,7 @@ void MyPlot::StackedPlotFixup(plot_major_mode MajorMode) } if(MajorMode == MajorMode_StackedShare) { - for(int Idx = this->CachedStackY.size()-1; Idx >= 0; --Idx) + for(int Idx = this->CachedStackY.size()-1; Idx >= 0; --Idx) { double *Ys = this->CachedStackY[Idx]; for(size_t Ts = 0; Ts < Len; ++Ts) @@ -2085,7 +2085,7 @@ void MobiView::GetGofOffsets(const Time &ReferenceTime, uint64 ReferenceTimestep Time AttemptBegin = CalibrationIntervalStart.GetData(); Time AttemptEnd = CalibrationIntervalEnd.GetData(); - GetGofOffsetsBase(AttemptBegin, AttemptEnd, ReferenceTime, ReferenceTimesteps, BeginOut, EndOut, GofOffsetOut, GofTimestepsOut); + GetGofOffsetsBase(AttemptBegin, AttemptEnd, ReferenceTime, ReferenceTimesteps, BeginOut, EndOut, GofOffsetOut, GofTimestepsOut); } diff --git a/main.cpp b/main.cpp index 9c9fd90..9055513 100644 --- a/main.cpp +++ b/main.cpp @@ -945,15 +945,11 @@ void MobiView::Load() String InputExt = GetFileExt(InputFile.data()); - //if(InputExt == ".xls" || InputExt == ".xlsx") - //{ - // Success = LoadFromExcel(this, ParameterFile.data(), InputFile.data()); - //} - //else - //{ + + //PromptOK("Bing!"); + DataSet = ModelDll.SetupModel(ParameterFile.data(), InputFile.data()); Success = !CheckDllUserError(); - //} if(!Success) {