Skip to content

Commit

Permalink
Mods for v1.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rklasky committed Sep 5, 2022
1 parent d80b163 commit d84a5f6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions MSSPM_GuiEstimation/nmfEstimationTab07.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1151,10 +1151,10 @@ nmfEstimation_Tab7::okAdditionalAlgorithmParameters()
double initialPopulationSize;
std::string msg;

// 1. Check that Initial Population Size > NUmber of Parameters+2
// 1. Check that Initial Population Size > Number of Parameters+2 but 0 is allowed for the value
if ((getMinimizerAlgorithm() == "GN_CRS2_LM") && Estimation_Tab7_NL_InitialPopulationSizeCB->isChecked()) {
initialPopulationSize = Estimation_Tab7_NL_InitialPopulationSizeLE->text().toDouble();
if (initialPopulationSize < (NumParameters+2)) {
if ((initialPopulationSize < (NumParameters+2)) && (initialPopulationSize != 0)) {
msg = "nmfEstimation_Tab7::okAdditionalAlgorithmParameters: InitialParameterSize (" +
std::to_string((int)initialPopulationSize) +
") is less than NumParameters+2 (" +
Expand Down
2 changes: 1 addition & 1 deletion MSSPM_Main/nmfMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@ void
nmfMainWindow::menu_about()
{
QString name = "Multi-Species Surplus Production Model";
QString version = "MSSPM v1.2.7 ";
QString version = "MSSPM v1.2.8 ";
QString specialAcknowledgement = "";
QString cppVersion = "C++??";
QString mysqlVersion = "?";
Expand Down
3 changes: 2 additions & 1 deletion MSSPM_ParameterEstimationBeesAlgorithm/Bees_Estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ std::cout << "Bees: num est parameters: " << EstParameters.size() << std::endl;
beesAlg->extractExponentParameters(EstParameters,startPos,m_EstExponent);
beesAlg->extractSurveyQParameters(EstParameters,startPos,
m_EstSurveyQ,m_EstSurveyQCovariateCoeffs);
numEstParameters = beesAlg->calculateActualNumEstParameters();
// numEstParameters = beesAlg->calculateActualNumEstParameters();
numTotalParameters = EstParameters.size();
numEstParameters = numTotalParameters; // All parameters are estimated
createOutputStr(numEstParameters,numTotalParameters,NumRepetitions,
bestFitness,fitnessStdDev,beeStruct,bestFitnessStr);

Expand Down
17 changes: 17 additions & 0 deletions MSSPM_ParameterEstimationNLoptAlgorithm/NLopt_Estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ NLopt_Estimator::NLopt_Estimator()
m_Seed = 0;
m_MinimizerToEnum.clear();
m_MohnsRhoOffset = 0;
m_MaxFitness = 999999999;

// Load Minimizer Name Map with global algorithms
m_MinimizerToEnum["GN_ORIG_DIRECT_L"] = nlopt::GN_ORIG_DIRECT_L;
Expand Down Expand Up @@ -400,6 +401,7 @@ NLopt_Estimator::objectiveFunction(unsigned nUnused,
competitionBetaGuilds,competitionBetaGuildsGuilds,
predationRho,predationHandling,predationExponent,
surveyQ,surveyQCovariateCoeffs);
//std::cout << "extracting cov: " << growthRateCovariateCoeffs[0] << std::endl;

// Since we may be estimating SurveyQ, need to divide the Observed Biomass by the SurveyQ
double surveyQTerm;
Expand Down Expand Up @@ -598,6 +600,20 @@ NLopt_Estimator::objectiveFunction(unsigned nUnused,
//if (nUnused == 0) {
//std::cout << "objcri: " << fitness << std::endl;
//}

// Debug code to print out the CarryingCapacity covariates
//if (fitness < m_MaxFitness) {
// for (int i=0; i<70; ++i) {
// if (i == 0) {std::cout << std::endl;}
// if ((i>=40) and (i<= 49)) {
// std::cout << "parameter: " << EstParameters[i] <<
// ", fitness: " << fitness << std::endl;
// }
// }
// m_MaxFitness = fitness;
//}


incrementObjectiveFunctionCounter(MSSPMName,fitness,NLoptDataStruct);

return fitness;
Expand Down Expand Up @@ -956,6 +972,7 @@ std::cout << "*** NumEstParam: " << NumEstParameters << std::endl;
m_EstHandling,
m_EstExponent,
m_EstSurveyQ, m_EstSurveyQCovariateCoeffs);
//for (int j=0;j<(int)m_Parameters.size();++j) {std::cout << j << ": est param: " << m_Parameters[j] << std::endl;}

createOutputStr(m_Parameters.size(),
NLoptStruct.TotalNumberParameters,
Expand Down
1 change: 1 addition & 0 deletions MSSPM_ParameterEstimationNLoptAlgorithm/NLopt_Estimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <random>

static int m_MohnsRhoOffset = 0;
static double m_MaxFitness;

/**
* @brief This class acts as an interface class to the NLopt library.
Expand Down

0 comments on commit d84a5f6

Please sign in to comment.