├── .cirrus.yml ├── .github └── workflows │ ├── ci.yml │ └── pypi.yml ├── .gitignore ├── .readthedocs.yaml ├── CMakeLists.txt ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── LICENSE ├── README.txt ├── ROADMAP.md ├── bin ├── NOT_FOR_WINDOWS └── nomad ├── doc ├── doxygen │ ├── .gitignore │ ├── Doxyfile │ ├── NOMAD_background.jpg │ ├── nomad.jpg │ └── src └── user_guide │ ├── .gitignore │ ├── Makefile │ ├── _logo │ └── nomad_logo.jpg │ ├── bin │ ├── extractParamInfo.sh │ └── getAllParametersInfo.sh │ ├── figs │ ├── blackbox.png │ ├── example1.png │ ├── livre_DFO_AuHa2017.png │ ├── mads-algo.png │ ├── mexbuild1.png │ ├── mexbuild2.png │ ├── mexbuild3.png │ ├── mexrun1.png │ ├── mexrun2.png │ ├── mexsetup.png │ └── surrogate.png │ ├── make.bat │ ├── requirements.txt │ └── source │ ├── AdvancedFunctionalities.rst │ ├── Appendix.rst │ ├── GettingStarted.rst │ ├── HowToUseNomad.rst │ ├── Installation.rst │ ├── Introduction.rst │ ├── LibraryMode.rst │ ├── ListOfParameters.rst │ ├── ReleaseNotes.rst │ ├── SgteLib.rst │ ├── TricksOfTheTrade.rst │ ├── allParameters.csv │ ├── allParameters.csv.old │ ├── conf.py │ └── index.rst ├── examples ├── CMakeLists.txt ├── advanced │ ├── batch │ │ ├── BBOutputRedirection │ │ │ ├── CMakeLists.txt │ │ │ ├── bb_redirect.cpp │ │ │ └── param.txt │ │ ├── CountEval │ │ │ ├── CMakeLists.txt │ │ │ ├── bb_cnt_eval.cpp │ │ │ └── param.txt │ │ ├── DiscoMads │ │ │ ├── CMakeLists.txt │ │ │ ├── bb_disco.cpp │ │ │ ├── paramEscapeDiscont.txt │ │ │ └── paramEscapeHiddenConstraints.txt │ │ ├── FixedVariable │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── param.txt │ │ │ ├── param1.txt │ │ │ ├── param10.txt │ │ │ ├── param2.txt │ │ │ ├── param3.txt │ │ │ ├── runFixed.sh │ │ │ ├── runFixedWin.sh │ │ │ └── uu.cpp │ │ ├── IBEX │ │ │ ├── README.txt │ │ │ ├── bb.cpp │ │ │ ├── create_set.cpp │ │ │ ├── create_set_with_volume.cpp │ │ │ ├── how_to_use_create_set.txt │ │ │ ├── makefile │ │ │ ├── param.txt │ │ │ └── system_anneau.txt │ │ ├── LHonly │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── param.txt │ │ │ └── u.cpp │ │ ├── PSDMadsWithPythonBB │ │ │ ├── X0.txt │ │ │ ├── bb.py │ │ │ └── param.txt │ │ ├── SuggestAndObserve │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── README.txt │ │ │ ├── bb.cpp │ │ │ ├── bbr.cpp │ │ │ ├── loopSuggestAndObserve.sh │ │ │ ├── observe.cpp │ │ │ ├── param0.txt │ │ │ ├── suggest.cpp │ │ │ ├── utils.cpp │ │ │ └── utils.hpp │ │ └── UseCacheFileForRerun │ │ │ ├── CMakeLists.txt │ │ │ ├── README.txt │ │ │ ├── bb.cpp │ │ │ ├── param_firstRun.txt │ │ │ └── param_secondRun.txt │ └── library │ │ ├── COOPMads │ │ ├── CMakeLists.txt │ │ └── rosenbrockCoop.cpp │ │ ├── CustomCompForOrdering │ │ ├── CMakeLists.txt │ │ └── customCompForOrdering.cpp │ │ ├── CustomOpportunistic │ │ ├── CMakeLists.txt │ │ └── customOpport.cpp │ │ ├── CustomPollMethod │ │ ├── CMakeLists.txt │ │ └── customPollMethod.cpp │ │ ├── CustomSearchMethod │ │ ├── CMakeLists.txt │ │ └── customSearchMethod.cpp │ │ ├── CustomStatSum │ │ ├── CMakeLists.txt │ │ └── customStatSum.cpp │ │ ├── DiscoMads │ │ ├── EscapeDiscontinuities │ │ │ ├── CMakeLists.txt │ │ │ └── DiscoMadsEscapeDiscont.cpp │ │ └── EscapeHiddenConstraints │ │ │ ├── CMakeLists.txt │ │ │ └── DiscoMadsEscapeHiddenConstraints.cpp │ │ ├── FixedVariable │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── fixedVariable.cpp │ │ └── u.cpp │ │ ├── HandlingHiddenConstraints │ │ ├── CMakeLists.txt │ │ └── handlingHiddenCons.cpp │ │ ├── NMonly │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ └── NMOpt.cpp │ │ ├── NestedOptim │ │ ├── CMakeLists.txt │ │ └── nestedOptim.cpp │ │ ├── PSDMads │ │ ├── CMakeLists.txt │ │ └── rosenbrock.cpp │ │ ├── PyNomad │ │ ├── SingleSuggestAndObserve │ │ │ ├── .gitignore │ │ │ ├── cache0.txt │ │ │ └── runTestSingleSuggestAndObserve.py │ │ ├── readme.txt │ │ ├── simpleExample_BlockEval.py │ │ ├── simpleExample_BlockEvalParallel.py │ │ ├── simpleExample_NMOptimization.py │ │ ├── simpleExample_PbMultiObj.py │ │ ├── simpleExample_PbWithConst.py │ │ ├── simpleExample_WithSurrogate.py │ │ ├── simpleExample_WithSurrogateAndVNS.py │ │ ├── simpleExample_basic.py │ │ └── simpleExample_basic_parallelEval.py │ │ ├── Restart │ │ ├── CMakeLists.txt │ │ └── restart.cpp │ │ ├── StopIfBBFails │ │ ├── CMakeLists.txt │ │ └── stopIfBBFails.cpp │ │ ├── StopOnConsecutiveFails │ │ ├── CMakeLists.txt │ │ └── stopOnConsecutiveFails.cpp │ │ ├── c_api │ │ ├── example1 │ │ │ ├── CMakeLists.txt │ │ │ └── example1_c_api.c │ │ ├── example2 │ │ │ ├── CMakeLists.txt │ │ │ └── example2_c_api.c │ │ └── example3 │ │ │ ├── CMakeLists.txt │ │ │ └── example3_c_api.c │ │ └── exampleSuggestAndObserve │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── cache0.txt │ │ ├── loopSuggestAndObserve.cpp │ │ └── suggestAndObserve.cpp └── basic │ ├── batch │ ├── MatlabBB │ │ ├── README.txt │ │ ├── X0.txt │ │ ├── bb.bat │ │ ├── bb.sh │ │ ├── fun.m │ │ ├── inputMatlab.txt │ │ └── paramNomad.txt │ ├── PythonBB │ │ ├── bb.py │ │ └── param.txt │ ├── example1 │ │ ├── CMakeLists.txt │ │ ├── bb.cpp │ │ ├── param.txt │ │ ├── param_LH.txt │ │ ├── param_LH_ONLY.txt │ │ ├── param_NM.txt │ │ ├── param_parallelEval.txt │ │ └── x0.txt │ ├── example2 │ │ ├── CMakeLists.txt │ │ ├── bb.cpp │ │ ├── param.txt │ │ └── x0.txt │ ├── multi_obj │ │ ├── CMakeLists.txt │ │ ├── bb.cpp │ │ ├── param.txt │ │ └── x.txt │ ├── multi_obj2 │ │ ├── CMakeLists.txt │ │ ├── bb.cpp │ │ ├── param.txt │ │ ├── param_testQMS.txt │ │ └── x.txt │ ├── single_obj_MPIparallel │ │ ├── CMakeLists.txt │ │ ├── bb.cpp │ │ ├── param.txt │ │ ├── x.txt │ │ └── xsingle.txt │ ├── single_obj_parallel │ │ ├── CMakeLists.txt │ │ ├── bb.cpp │ │ ├── param.txt │ │ └── x.txt │ └── surrogate_sort │ │ ├── CMakeLists.txt │ │ ├── bb.cpp │ │ ├── param.txt │ │ ├── param_VNSMadsSurrogateSearch.txt │ │ ├── param_surrogateOptim.txt │ │ └── sgte.cpp │ └── library │ ├── CustomSurrogateOrdering │ ├── CMakeLists.txt │ └── customSurrogateOrdering.cpp │ ├── StopOnFTarget │ ├── CMakeLists.txt │ └── stopOnFTarget.cpp │ ├── example1 │ ├── CMakeLists.txt │ └── example1_lib.cpp │ ├── example2 │ ├── CMakeLists.txt │ └── example2_lib.cpp │ ├── multi_obj │ ├── CMakeLists.txt │ └── multi_obj_lib.cpp │ └── single_obj_parallel │ ├── CMakeLists.txt │ └── basic_lib.cpp ├── ext ├── CMakeLists.txt └── sgtelib │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakeListsLibs.txt │ ├── CMakeListsLibsStatic.txt │ ├── src │ ├── Defines.hpp │ ├── Exception.hpp │ ├── Kernel.cpp │ ├── Kernel.hpp │ ├── Matrix.cpp │ ├── Matrix.hpp │ ├── Metrics.cpp │ ├── Metrics.hpp │ ├── Surrogate.cpp │ ├── Surrogate.hpp │ ├── Surrogate_CN.cpp │ ├── Surrogate_CN.hpp │ ├── Surrogate_Ensemble.cpp │ ├── Surrogate_Ensemble.hpp │ ├── Surrogate_Ensemble_Stat.cpp │ ├── Surrogate_Ensemble_Stat.hpp │ ├── Surrogate_Factory.cpp │ ├── Surrogate_Factory.hpp │ ├── Surrogate_KS.cpp │ ├── Surrogate_KS.hpp │ ├── Surrogate_Kriging.cpp │ ├── Surrogate_Kriging.hpp │ ├── Surrogate_LOWESS.cpp │ ├── Surrogate_LOWESS.hpp │ ├── Surrogate_PRS.cpp │ ├── Surrogate_PRS.hpp │ ├── Surrogate_PRS_CAT.cpp │ ├── Surrogate_PRS_CAT.hpp │ ├── Surrogate_PRS_EDGE.cpp │ ├── Surrogate_PRS_EDGE.hpp │ ├── Surrogate_Parameters.cpp │ ├── Surrogate_Parameters.hpp │ ├── Surrogate_RBF.cpp │ ├── Surrogate_RBF.hpp │ ├── Surrogate_Utils.cpp │ ├── Surrogate_Utils.hpp │ ├── Tests.cpp │ ├── Tests.hpp │ ├── TrainingSet.cpp │ ├── TrainingSet.hpp │ ├── header.txt │ ├── sgtelib.cpp │ ├── sgtelib.hpp │ ├── sgtelib_help.cpp │ ├── sgtelib_help.hpp │ └── sgtelib_predict.cpp │ └── user_guide │ └── sgtelib_user_guide.pdf ├── interfaces ├── CInterface │ ├── CMakeLists.txt │ ├── NomadStdCInterface.cpp │ └── NomadStdCInterface.h ├── Matlab_MEX │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Examples │ │ ├── example_block_eval │ │ │ ├── cbFun.m │ │ │ ├── fun.m │ │ │ └── run_nomad.m │ │ ├── example_count_eval │ │ │ ├── bb.m │ │ │ └── run_nomad.m │ │ ├── example_int_variables │ │ │ └── run.m │ │ ├── example_multiobj │ │ │ ├── bb.m │ │ │ ├── run.m │ │ │ └── sol.txt │ │ ├── example_plot │ │ │ ├── fun.m │ │ │ └── run_nomad.m │ │ ├── example_sgtelib │ │ │ ├── bb.m │ │ │ ├── param.txt │ │ │ └── run.m │ │ ├── example_static_surrogate │ │ │ ├── bbsur.m │ │ │ └── run_nomad.m │ │ └── example_user_callback │ │ │ ├── cbFun.m │ │ │ └── run.m │ ├── Functions │ │ └── nomadOpt.m │ ├── GERAD_NOMAD_build.m │ ├── Source │ │ └── nomadmex.cpp │ ├── readme.txt │ └── test_nomad_gerad.m ├── PyNomad │ ├── .gitignore │ ├── CMakeLists.txt │ ├── LICENSE │ ├── MANIFEST.in │ ├── PyNomad.pyx │ ├── long_description.md │ ├── nomadCySimpleInterface.cpp │ ├── pyproject.toml │ ├── readme.txt │ ├── setup.py │ └── tests │ │ ├── .gitignore │ │ ├── test_block.py │ │ ├── test_single.py │ │ └── test_single_constraint.py └── jNomad │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Examples │ └── Rosenbrock.java │ ├── Readme │ └── jNomad.i └── src ├── Algos ├── AlgoStopReasons.cpp ├── AlgoStopReasons.hpp ├── Algorithm.cpp ├── Algorithm.hpp ├── COOPMads │ ├── COOPMads.cpp │ ├── COOPMads.hpp │ ├── CacheSearchMethod.cpp │ └── CacheSearchMethod.hpp ├── CacheInterface.cpp ├── CacheInterface.hpp ├── CoordinateSearch │ ├── CS.cpp │ ├── CS.hpp │ ├── CSInitialization.cpp │ ├── CSInitialization.hpp │ ├── CSIteration.cpp │ ├── CSIteration.hpp │ ├── CSMegaIteration.cpp │ ├── CSMegaIteration.hpp │ ├── CSMesh.cpp │ ├── CSMesh.hpp │ ├── CSPoll.cpp │ ├── CSPoll.hpp │ ├── CSPollMethod.cpp │ ├── CSPollMethod.hpp │ ├── CSUpdate.cpp │ └── CSUpdate.hpp ├── DMultiMads │ ├── DMultiMads.cpp │ ├── DMultiMads.hpp │ ├── DMultiMadsBarrier.cpp │ ├── DMultiMadsBarrier.hpp │ ├── DMultiMadsExpansionIntLineSearchMethod.cpp │ ├── DMultiMadsExpansionIntLineSearchMethod.hpp │ ├── DMultiMadsIteration.cpp │ ├── DMultiMadsIteration.hpp │ ├── DMultiMadsMegaIteration.cpp │ ├── DMultiMadsMegaIteration.hpp │ ├── DMultiMadsMiddlePointSearchMethod.cpp │ ├── DMultiMadsMiddlePointSearchMethod.hpp │ ├── DMultiMadsNMSearchMethod.cpp │ ├── DMultiMadsNMSearchMethod.hpp │ ├── DMultiMadsQuadDMSSearchMethod.cpp │ ├── DMultiMadsQuadDMSSearchMethod.hpp │ ├── DMultiMadsQuadModSearchMethod.cpp │ ├── DMultiMadsQuadModSearchMethod.hpp │ ├── DMultiMadsUpdate.cpp │ └── DMultiMadsUpdate.hpp ├── DiscoMads │ ├── DiscoMads.cpp │ ├── DiscoMads.hpp │ ├── DiscoMadsBarrier.cpp │ ├── DiscoMadsBarrier.hpp │ ├── DiscoMadsIteration.cpp │ ├── DiscoMadsIteration.hpp │ ├── DiscoMadsMegaIteration.cpp │ ├── DiscoMadsMegaIteration.hpp │ ├── DiscoMadsUpdate.cpp │ ├── DiscoMadsUpdate.hpp │ ├── RevealingPoll.cpp │ └── RevealingPoll.hpp ├── EvcInterface.cpp ├── EvcInterface.hpp ├── Initialization.cpp ├── Initialization.hpp ├── Iteration.cpp ├── Iteration.hpp ├── IterationUtils.cpp ├── IterationUtils.hpp ├── LatinHypercubeSampling │ ├── LH.cpp │ └── LH.hpp ├── Mads │ ├── DoublePollMethod.cpp │ ├── DoublePollMethod.hpp │ ├── GMesh.cpp │ ├── GMesh.hpp │ ├── LHSearchMethod.cpp │ ├── LHSearchMethod.hpp │ ├── Mads.cpp │ ├── Mads.hpp │ ├── MadsInitialization.cpp │ ├── MadsInitialization.hpp │ ├── MadsIteration.cpp │ ├── MadsIteration.hpp │ ├── MadsMegaIteration.cpp │ ├── MadsMegaIteration.hpp │ ├── MadsUpdate.cpp │ ├── MadsUpdate.hpp │ ├── MegaSearchPoll.cpp │ ├── MegaSearchPoll.hpp │ ├── NMSearchMethod.cpp │ ├── NMSearchMethod.hpp │ ├── NP1UniPollMethod.cpp │ ├── NP1UniPollMethod.hpp │ ├── Ortho2NPollMethod.cpp │ ├── Ortho2NPollMethod.hpp │ ├── OrthoNPlus1PollMethod.cpp │ ├── OrthoNPlus1PollMethod.hpp │ ├── Poll.cpp │ ├── Poll.hpp │ ├── PollMethodBase.cpp │ ├── PollMethodBase.hpp │ ├── QPSolverAlgoSearchMethod.cpp │ ├── QPSolverAlgoSearchMethod.hpp │ ├── QR2NPollMethod.cpp │ ├── QR2NPollMethod.hpp │ ├── QuadSearchMethod.cpp │ ├── QuadSearchMethod.hpp │ ├── Search.cpp │ ├── Search.hpp │ ├── SearchMethodAlgo.cpp │ ├── SearchMethodAlgo.hpp │ ├── SearchMethodBase.cpp │ ├── SearchMethodBase.hpp │ ├── SearchMethodSimple.cpp │ ├── SearchMethodSimple.hpp │ ├── SgtelibSearchMethod.cpp │ ├── SgtelibSearchMethod.hpp │ ├── SimpleLineSearchMethod.cpp │ ├── SimpleLineSearchMethod.hpp │ ├── SinglePollMethod.cpp │ ├── SinglePollMethod.hpp │ ├── SpeculativeSearchMethod.cpp │ ├── SpeculativeSearchMethod.hpp │ ├── TemplateAlgoSearchMethod.cpp │ ├── TemplateAlgoSearchMethod.hpp │ ├── UserPollMethod.cpp │ ├── UserPollMethod.hpp │ ├── UserSearchMethod.cpp │ ├── UserSearchMethod.hpp │ ├── VNSSearchMethod.cpp │ ├── VNSSearchMethod.hpp │ ├── VNSmartSearchMethod.cpp │ └── VNSmartSearchMethod.hpp ├── MainStep.cpp ├── MainStep.hpp ├── MegaIteration.cpp ├── MegaIteration.hpp ├── NelderMead │ ├── NM.cpp │ ├── NM.hpp │ ├── NMAllReflective.cpp │ ├── NMAllReflective.hpp │ ├── NMInitialization.cpp │ ├── NMInitialization.hpp │ ├── NMInitializeSimplex.cpp │ ├── NMInitializeSimplex.hpp │ ├── NMIteration.cpp │ ├── NMIteration.hpp │ ├── NMIterationUtils.cpp │ ├── NMIterationUtils.hpp │ ├── NMMegaIteration.cpp │ ├── NMMegaIteration.hpp │ ├── NMReflective.cpp │ ├── NMReflective.hpp │ ├── NMShrink.cpp │ ├── NMShrink.hpp │ ├── NMSimplexEvalPoint.cpp │ ├── NMSimplexEvalPoint.hpp │ ├── NMUpdate.cpp │ └── NMUpdate.hpp ├── PSDMads │ ├── PSDMads.cpp │ ├── PSDMads.hpp │ ├── PSDMadsMegaIteration.cpp │ ├── PSDMadsMegaIteration.hpp │ ├── PSDMadsMegaIteration_prev.cpp │ └── PSDMadsMegaIteration_prev.hpp ├── PhaseOne │ ├── PhaseOne.cpp │ └── PhaseOne.hpp ├── Projection.cpp ├── Projection.hpp ├── QPSolverAlgo │ ├── DoglegTRSolver.cpp │ ├── DoglegTRSolver.hpp │ ├── L1AugLagSolver.cpp │ ├── L1AugLagSolver.hpp │ ├── LevenbergMarquardtSolver.cpp │ ├── LevenbergMarquardtSolver.hpp │ ├── ProjectedConjugateGradientSolver.cpp │ ├── ProjectedConjugateGradientSolver.hpp │ ├── QPModelUtils.cpp │ ├── QPModelUtils.hpp │ ├── QPSolverAlgo.cpp │ ├── QPSolverAlgo.hpp │ ├── QPSolverAlgoIteration.cpp │ ├── QPSolverAlgoIteration.hpp │ ├── QPSolverAlgoMegaIteration.cpp │ ├── QPSolverAlgoMegaIteration.hpp │ ├── QPSolverAlgoSinglePass.cpp │ ├── QPSolverAlgoSinglePass.hpp │ ├── QPSolverOptimize.cpp │ ├── QPSolverOptimize.hpp │ ├── TRIPMSolver.cpp │ └── TRIPMSolver.hpp ├── QuadModel │ ├── QuadModelAlgo.cpp │ ├── QuadModelAlgo.hpp │ ├── QuadModelEvaluator.cpp │ ├── QuadModelEvaluator.hpp │ ├── QuadModelInitialization.cpp │ ├── QuadModelInitialization.hpp │ ├── QuadModelIteration.cpp │ ├── QuadModelIteration.hpp │ ├── QuadModelIterationUtils.cpp │ ├── QuadModelIterationUtils.hpp │ ├── QuadModelMegaIteration.cpp │ ├── QuadModelMegaIteration.hpp │ ├── QuadModelOptimize.cpp │ ├── QuadModelOptimize.hpp │ ├── QuadModelSinglePass.cpp │ ├── QuadModelSinglePass.hpp │ ├── QuadModelUpdate.cpp │ └── QuadModelUpdate.hpp ├── SgtelibModel │ ├── SgtelibModel.cpp │ ├── SgtelibModel.hpp │ ├── SgtelibModelEvaluator.cpp │ ├── SgtelibModelEvaluator.hpp │ ├── SgtelibModelFilterCache.cpp │ ├── SgtelibModelFilterCache.hpp │ ├── SgtelibModelInitialization.cpp │ ├── SgtelibModelInitialization.hpp │ ├── SgtelibModelIteration.cpp │ ├── SgtelibModelIteration.hpp │ ├── SgtelibModelMegaIteration.cpp │ ├── SgtelibModelMegaIteration.hpp │ ├── SgtelibModelOptimize.cpp │ ├── SgtelibModelOptimize.hpp │ ├── SgtelibModelUpdate.cpp │ └── SgtelibModelUpdate.hpp ├── SimpleLineSearch │ ├── SimpleLineSearch.cpp │ ├── SimpleLineSearch.hpp │ ├── SimpleLineSearchMegaIteration.cpp │ └── SimpleLineSearchMegaIteration.hpp ├── SimpleMads │ ├── SimpleEvalPoint.cpp │ ├── SimpleEvalPoint.hpp │ ├── SimpleMads.cpp │ ├── SimpleMads.hpp │ ├── SimplePoll.cpp │ ├── SimplePoll.hpp │ ├── SimpleProgressiveBarrier.cpp │ └── SimpleProgressiveBarrier.hpp ├── Step.cpp ├── Step.hpp ├── Subproblem.cpp ├── Subproblem.hpp ├── SubproblemManager.cpp ├── SubproblemManager.hpp ├── SurrogateEvaluation.cpp ├── SurrogateEvaluation.hpp ├── SurrogateEvaluator.hpp ├── TemplateAlgo │ ├── TemplateAlgo.cpp │ ├── TemplateAlgo.hpp │ ├── TemplateAlgoInitialization.cpp │ ├── TemplateAlgoInitialization.hpp │ ├── TemplateAlgoIteration.cpp │ ├── TemplateAlgoIteration.hpp │ ├── TemplateAlgoMegaIteration.cpp │ ├── TemplateAlgoMegaIteration.hpp │ ├── TemplateAlgoRandom.cpp │ ├── TemplateAlgoRandom.hpp │ ├── TemplateAlgoSinglePass.cpp │ ├── TemplateAlgoSinglePass.hpp │ ├── TemplateAlgoUpdate.cpp │ └── TemplateAlgoUpdate.hpp ├── Termination.cpp ├── Termination.hpp ├── TrialPointStats.cpp ├── TrialPointStats.hpp └── VNSMads │ ├── VNS.cpp │ └── VNS.hpp ├── Attribute ├── WriteAttributeDefinitionFile.cpp ├── cacheAttributesDefinition.hpp ├── cacheAttributesDefinition.txt ├── deprecatedAttributesDefinition.hpp ├── deprecatedAttributesDefinition.txt ├── displayAttributesDefinition.hpp ├── displayAttributesDefinition.txt ├── evalAttributesDefinition.hpp ├── evalAttributesDefinition.txt ├── evaluatorControlAttributesDefinition.hpp ├── evaluatorControlAttributesDefinition.txt ├── evaluatorControlGlobalAttributesDefinition.hpp ├── evaluatorControlGlobalAttributesDefinition.txt ├── pbAttributesDefinition.hpp ├── pbAttributesDefinition.txt ├── runAttributesDefinition.hpp ├── runAttributesDefinition.txt ├── runAttributesDefinitionCOOP.hpp ├── runAttributesDefinitionCOOP.txt ├── runAttributesDefinitionCS.hpp ├── runAttributesDefinitionCS.txt ├── runAttributesDefinitionDMulti.hpp ├── runAttributesDefinitionDMulti.txt ├── runAttributesDefinitionDisco.hpp ├── runAttributesDefinitionDisco.txt ├── runAttributesDefinitionIBEX.hpp ├── runAttributesDefinitionIBEX.txt ├── runAttributesDefinitionLH.hpp ├── runAttributesDefinitionLH.txt ├── runAttributesDefinitionNM.hpp ├── runAttributesDefinitionNM.txt ├── runAttributesDefinitionPSDSSD.hpp ├── runAttributesDefinitionPSDSSD.txt ├── runAttributesDefinitionQPSolver.hpp ├── runAttributesDefinitionQPSolver.txt ├── runAttributesDefinitionQuadModel.hpp ├── runAttributesDefinitionQuadModel.txt ├── runAttributesDefinitionSgtelibModel.hpp ├── runAttributesDefinitionSgtelibModel.txt ├── runAttributesDefinitionVNS.hpp └── runAttributesDefinitionVNS.txt ├── CMakeLists.txt ├── CMakeListsExes.txt ├── CMakeListsExesStatic.txt ├── CMakeListsLibs.txt ├── CMakeListsLibsStatic.txt ├── Cache ├── CacheBase.cpp ├── CacheBase.hpp ├── CacheSet.cpp └── CacheSet.hpp ├── Eval ├── BBInput.cpp ├── BBInput.hpp ├── BBOutput.cpp ├── BBOutput.hpp ├── BarrierBase.cpp ├── BarrierBase.hpp ├── ComparePriority.cpp ├── ComparePriority.hpp ├── ComputeSuccessType.cpp ├── ComputeSuccessType.hpp ├── Eval.cpp ├── Eval.hpp ├── EvalPoint.cpp ├── EvalPoint.hpp ├── EvalQueuePoint.cpp ├── EvalQueuePoint.hpp ├── Evaluator.cpp ├── Evaluator.hpp ├── EvaluatorControl.cpp ├── EvaluatorControl.hpp ├── EvcMainThreadInfo.cpp ├── EvcMainThreadInfo.hpp ├── MeshBase.cpp ├── MeshBase.hpp ├── ProgressiveBarrier.cpp ├── ProgressiveBarrier.hpp ├── SuccessStats.cpp └── SuccessStats.hpp ├── Math ├── ArrayOfDouble.cpp ├── ArrayOfDouble.hpp ├── ArrayOfPoint.cpp ├── ArrayOfPoint.hpp ├── Direction.cpp ├── Direction.hpp ├── Double.cpp ├── Double.hpp ├── LHS.cpp ├── LHS.hpp ├── MathUtils.cpp ├── MathUtils.hpp ├── MatrixUtils.cpp ├── MatrixUtils.hpp ├── Point.cpp ├── Point.hpp ├── RNG.cpp ├── RNG.hpp ├── RandomPickup.cpp └── RandomPickup.hpp ├── Nomad ├── nomad.cpp └── nomad.hpp ├── Output ├── OutputDirectToFile.cpp ├── OutputDirectToFile.hpp ├── OutputInfo.cpp ├── OutputInfo.hpp ├── OutputQueue.cpp ├── OutputQueue.hpp ├── StatsInfo.cpp └── StatsInfo.hpp ├── Param ├── AllParameters.cpp ├── AllParameters.hpp ├── Attribute.cpp ├── Attribute.hpp ├── AttributeFactory.cpp ├── AttributeFactory.hpp ├── CacheParameters.cpp ├── CacheParameters.hpp ├── DeprecatedParameters.cpp ├── DeprecatedParameters.hpp ├── DisplayParameters.cpp ├── DisplayParameters.hpp ├── EvalParameters.cpp ├── EvalParameters.hpp ├── EvaluatorControlGlobalParameters.cpp ├── EvaluatorControlGlobalParameters.hpp ├── EvaluatorControlParameters.cpp ├── EvaluatorControlParameters.hpp ├── ParameterEntries.cpp ├── ParameterEntries.hpp ├── ParameterEntry.cpp ├── ParameterEntry.hpp ├── Parameters.cpp ├── Parameters.hpp ├── ParametersNomad3.cpp ├── ParametersNomad3.hpp ├── PbParameters.cpp ├── PbParameters.hpp ├── RunParameters.cpp ├── RunParameters.hpp ├── TypeAttribute.cpp └── TypeAttribute.hpp ├── Type ├── BBInputType.cpp ├── BBInputType.hpp ├── BBOutputType.cpp ├── BBOutputType.hpp ├── CallbackType.cpp ├── CallbackType.hpp ├── CompareType.cpp ├── CompareType.hpp ├── ComputeType.cpp ├── ComputeType.hpp ├── DMultiMadsSearchStrategyType.cpp ├── DMultiMadsSearchStrategyType.hpp ├── DirectionType.cpp ├── DirectionType.hpp ├── EvalSortType.cpp ├── EvalSortType.hpp ├── EvalType.cpp ├── EvalType.hpp ├── LHSearchType.cpp ├── LHSearchType.hpp ├── ListOfVariableGroup.cpp ├── ListOfVariableGroup.hpp ├── SgtelibModelFeasibilityType.cpp ├── SgtelibModelFeasibilityType.hpp ├── SgtelibModelFormulationType.cpp ├── SgtelibModelFormulationType.hpp ├── StepType.cpp └── StepType.hpp ├── Util ├── AllStopReasons.cpp ├── AllStopReasons.hpp ├── ArrayOfString.cpp ├── ArrayOfString.hpp ├── Clock.cpp ├── Clock.hpp ├── Exception.cpp ├── Exception.hpp ├── MicroSleep.hpp ├── StopReason.cpp ├── StopReason.hpp ├── Uncopyable.cpp ├── Uncopyable.hpp ├── defines.cpp ├── defines.hpp ├── fileutils.cpp ├── fileutils.hpp ├── utils.cpp └── utils.hpp ├── nomad_nsbegin.hpp ├── nomad_nsend.hpp ├── nomad_platform.hpp └── nomad_version.hpp /.cirrus.yml: -------------------------------------------------------------------------------- 1 | task: 2 | matrix: 3 | - name: FreeBSD -- gcc | g++ 4 | freebsd_instance: 5 | image: freebsd-14-0-release-amd64-ufs 6 | env: 7 | cc: gcc13 8 | cxx: g++13 9 | - name: FreeBSD -- clang | clang++ 10 | freebsd_instance: 11 | image: freebsd-14-0-release-amd64-ufs 12 | env: 13 | cc: clang 14 | cxx: clang++ 15 | - name: MacOS M1 -- gcc | g++ 16 | macos_instance: 17 | image: ghcr.io/cirruslabs/macos-runner:sonoma 18 | env: 19 | cc: gcc-14 20 | cxx: g++-14 21 | - name: MacOS M1 -- clang | clang++ 22 | macos_instance: 23 | image: ghcr.io/cirruslabs/macos-runner:sonoma 24 | env: 25 | cc: clang 26 | cxx: clang++ 27 | dependencies_script: | 28 | echo $(uname) 29 | if [ "$(uname)" = "FreeBSD" ]; then 30 | pkg install -y cmake bash gcc13 31 | else 32 | brew install cmake gcc@12 33 | fi 34 | configure_script: | 35 | mkdir instdir 36 | mkdir build 37 | cd build 38 | cmake \ 39 | -DCMAKE_C_COMPILER=$cc \ 40 | -DCMAKE_CXX_COMPILER=$cxx \ 41 | -DTEST_OPENMP=OFF \ 42 | -DBUILD_INTERFACE_C=ON \ 43 | -DCMAKE_INSTALL_PREFIX=../instdir \ 44 | .. 45 | build_script: | 46 | cmake --build build --parallel 8 --config Release 47 | install_script: | 48 | cmake --install build --config Release 49 | test_script: | 50 | export PATH=`pwd`/build/bin:$PATH 51 | echo $PATH 52 | if [ "$(uname)" = "FreeBSD" ]; then 53 | ln -s /usr/local/bin/bash /bin/bash 54 | fi 55 | cd build 56 | ctest -C Release --parallel 8 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | XCode/ 2 | *.vscode 3 | *.vs 4 | .DS_Store 5 | */**/.DS_Store 6 | VisualStudio/** 7 | build/ 8 | build/release/** 9 | builds/ 10 | dev_tests/*.txt 11 | Testing/ 12 | examples/**/*.exe 13 | examples/**/cache.txt 14 | src/nbproject/ 15 | *.swp 16 | examples/**/history* 17 | examples/**/sol* 18 | examples/**/stats* 19 | examples/**/runTestLog* 20 | internal/integration_tests/**/*.exe 21 | internal/integration_tests/**/stats* 22 | MyPython* 23 | Icon 24 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the version of Python and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3.11" 13 | 14 | # Build documentation in the doc/ directory with Sphinx 15 | sphinx: 16 | configuration: doc/user_guide/source/conf.py 17 | 18 | # We recommend specifying your dependencies to enable reproducible builds: 19 | # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html 20 | python: 21 | install: 22 | - requirements: doc/user_guide/requirements.txt 23 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Guidelines for contributing to NOMAD - A blackbox optimization software. 2 | 3 | ### NOMAD 4 4 | For questions, bugs, feature requests and other issues, please open a new issue at https://github.com/bbopt/nomad/issues. 5 | To add a feature, especially if it involves algorithmic developments, or to otherwise suggest changes to the code, do [contact us](mailto:nomad@gerad.ca) for more information. 6 | 7 | ### Questions 8 | We are happy to help. An issue may be opened with the question, or you can [email us](mailto:nomad@gerad.ca). 9 | 10 | ### Bugs 11 | Make sure to include these informations: 12 | * A clear description of the bug, with the expected behavior 13 | * Steps to reproduce 14 | * OS / platform 15 | * NOMAD version 16 | * It may be useful to have a trace of the output with the parameter `DISPLAY_DEGREE 4` 17 | 18 | ### Features / Enhancements 19 | If the feature is already in the list of issues, input should be added to that issue. Otherwise, a new issue may be opened. Please check the [roadmap](https://github.com/bbopt/nomad/blob/master/ROADMAP.md) for upcoming features. 20 | 21 | ### Pull requests 22 | We will review carefully pull requests, but we will not merge them directly. Our current development path involves a private repository that we may update with the suggested changes before updating the public repository. 23 | 24 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Miguel Anjos 2 | Romain Couderc 3 | Miguel Diago Martinez 4 | Yassine Diouri 5 | Solène Kojtych 6 | Guillaume Lameynardie 7 | Wim Lavrijsen 8 | Alexis Montoison 9 | Ferdinand Mosca 10 | Jean-Max Redonnet 11 | Caroline Rocha 12 | Ludovic Salomon 13 | Renaud Saltet 14 | Jan Provaznik 15 | Tangi Migot 16 | Edward Hallé-Hannan 17 | Samuel Mendoza 18 | 19 | -------------------------------------------------------------------------------- /ROADMAP.md: -------------------------------------------------------------------------------- 1 | ## Next release 2 | 3 | ### v4.6 - Not before July 2025 4 | 5 | These are the features we consider for 4.6: 6 | 7 | * Paralel run of multiple algorithms 8 | 9 | * Suggest and Observe paradigm without control on the evaluations 10 | 11 | * Categorical variables 12 | -------------------------------------------------------------------------------- /bin/NOT_FOR_WINDOWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/bin/NOT_FOR_WINDOWS -------------------------------------------------------------------------------- /bin/nomad: -------------------------------------------------------------------------------- 1 | ../build/release/bin/nomad -------------------------------------------------------------------------------- /doc/doxygen/.gitignore: -------------------------------------------------------------------------------- 1 | html 2 | -------------------------------------------------------------------------------- /doc/doxygen/NOMAD_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/doxygen/NOMAD_background.jpg -------------------------------------------------------------------------------- /doc/doxygen/nomad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/doxygen/nomad.jpg -------------------------------------------------------------------------------- /doc/doxygen/src: -------------------------------------------------------------------------------- 1 | ../../src -------------------------------------------------------------------------------- /doc/user_guide/.gitignore: -------------------------------------------------------------------------------- 1 | html 2 | .env 3 | -------------------------------------------------------------------------------- /doc/user_guide/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /doc/user_guide/_logo/nomad_logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/_logo/nomad_logo.jpg -------------------------------------------------------------------------------- /doc/user_guide/bin/extractParamInfo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | egrep -v "^#|^ALGO_COMPATIBILITY_CHECK|^RESTART_ATTRIBUTE|UNIQUE_ENTRY" $1 | \ 4 | awk 'BEGIN{ biginfopassed = 0;} 5 | { 6 | if ("" == $0) { 7 | # do nothing 8 | } 9 | else if ("" == name) 10 | { 11 | name = $0; 12 | } 13 | else if ("" == type) 14 | { 15 | type = $0; 16 | } 17 | else if ("" == defval) 18 | { 19 | defval = $0; 20 | if ("\"\"" == defval || "-" == defval) 21 | { 22 | defval = "No default"; 23 | } 24 | sub(/\*/,"\\*",defval); 25 | #sub(/*/,"toto",defval); 26 | } 27 | else if ("" == info) 28 | { 29 | info = $0; 30 | sub(/\\\( */,"",info); 31 | sub(/ *\\\)/,"",info); 32 | } 33 | else if ("\\(" == $0) { 34 | # Flag used to ignore long info. 35 | biginfopassed = 0; 36 | } else if ("\\)" == $0) { 37 | biginfopassed = 1; 38 | } else if (1 == biginfopassed && 0 == lastline) { 39 | keywords = keywords" "$0; 40 | lastline = ($keywords ~ "\\\\)" ); # It took me a while to figure this one out! 41 | } 42 | if (1 == lastline) { 43 | # Compute argument (basic / advanced / developer) 44 | if ($keywords ~ "developer" || $keywords ~ "developper") 45 | { 46 | argument = "developer"; 47 | } 48 | else if ($keywords ~ "advanced") 49 | { 50 | argument = "advanced"; 51 | } 52 | else if ($keywords ~ "internal") 53 | { 54 | argument = "internal"; 55 | } 56 | else 57 | { 58 | argument = "basic"; 59 | } 60 | 61 | # Here we print the found fields, with commas for CSV format. 62 | if ("internal" != argument) 63 | { 64 | print name","type","argument",\""info"\","defval; 65 | } 66 | 67 | # Reset values. 68 | biginfopassed = 0; 69 | name = ""; 70 | type = ""; 71 | defval = ""; 72 | info = ""; 73 | keywords = ""; 74 | lastline = 0; 75 | } 76 | }' 77 | -------------------------------------------------------------------------------- /doc/user_guide/bin/getAllParametersInfo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Show txt files except for deprecated parameters; 4 | # Extract informations in CSV format; 5 | # Sort (by parameter name). 6 | curdir=`echo $0 | sed 's/\/.*//'` 7 | csvFile="$NOMAD_HOME/doc/user_guide/source/allParameters.csv" 8 | echo "Name , Type , Argument , Short description , Default" > $csvFile 9 | ls $NOMAD_HOME/src/Attribute/*.txt | grep -v deprecated | xargs cat | $curdir/extractParamInfo.sh | sort >> $csvFile 10 | 11 | -------------------------------------------------------------------------------- /doc/user_guide/figs/blackbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/blackbox.png -------------------------------------------------------------------------------- /doc/user_guide/figs/example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/example1.png -------------------------------------------------------------------------------- /doc/user_guide/figs/livre_DFO_AuHa2017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/livre_DFO_AuHa2017.png -------------------------------------------------------------------------------- /doc/user_guide/figs/mads-algo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/mads-algo.png -------------------------------------------------------------------------------- /doc/user_guide/figs/mexbuild1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/mexbuild1.png -------------------------------------------------------------------------------- /doc/user_guide/figs/mexbuild2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/mexbuild2.png -------------------------------------------------------------------------------- /doc/user_guide/figs/mexbuild3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/mexbuild3.png -------------------------------------------------------------------------------- /doc/user_guide/figs/mexrun1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/mexrun1.png -------------------------------------------------------------------------------- /doc/user_guide/figs/mexrun2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/mexrun2.png -------------------------------------------------------------------------------- /doc/user_guide/figs/mexsetup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/mexsetup.png -------------------------------------------------------------------------------- /doc/user_guide/figs/surrogate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/doc/user_guide/figs/surrogate.png -------------------------------------------------------------------------------- /doc/user_guide/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /doc/user_guide/requirements.txt: -------------------------------------------------------------------------------- 1 | 2 | sphinx 3 | sphinx_rtd_theme 4 | readthedocs-sphinx-search 5 | -------------------------------------------------------------------------------- /doc/user_guide/source/Appendix.rst: -------------------------------------------------------------------------------- 1 | .. _guide_matlab_mex: 2 | 3 | Guide to build Matlab interface for Windows using MinGW 4 | ======================================================= 5 | 6 | The following guide for building Matlab interface for Windows using MinGW has been provided by a user in `GitHub Issue #128 `_. 7 | 8 | `*` Update MATLAB’s MinGW using this `link to supported compilers `_. 9 | Follow on-screen instructions (for example, dragging and dropping in MATLAB’s command window) 10 | NB: Updates will be displayed in MATLAB’s Command window while installation is in progress. 11 | 12 | `*` Confirm set up by typing ``mex -setup`` in command window to verify installation following completion (Please check MATLAB and Simulink requirements on the same page using the link above as well) 13 | 14 | .. figure:: ../figs/mexsetup.png 15 | :align: center 16 | 17 | `*` Majority of the other installation procedures would be done using "Command Prompt Window". This can easily be accessed by typing "Command window" in the search tile on your Windows operating system. 18 | 19 | `*` Download `CMake `_. I recommend using the Windows x64 Installer option to enable you make your own installation settings. Make sure it is available for all users of the PC. Confirm that cmake is on the PC by typing ``cmake`` on command prompt. 20 | 21 | `*` Download your preferred NOMAD version and unzip the file. In the root folder, get a link which is done by easily double-clicking on the pane which bears the opened folder. 22 | 23 | `*` The interface build is managed by CMake that can be run at NOMAD root. Use the command ``cd copiedAddress`` command in command prompt to change the directory to the location you have copied above (replace copiedAddress with the link obtained) 24 | 25 | `*` To build the MATLAB interface, force the use of the 64bit version of the compiler with the command:: 26 | 27 | cmake -DTEST_OPENMP=OFF -DBUILD_INTERFACE_MATLAB=ON -S . -B build/release -A x64 28 | 29 | `*` Following the completion, use the command below that might take some minutes:: 30 | 31 | cmake --build build/release --config Release 32 | 33 | `*` Then, finally, use the command:: 34 | 35 | cmake --install build/release 36 | 37 | which must be run before using the Matlab nomadOpt function. You can expect to see the following during the build process: 38 | 39 | .. figure:: ../figs/mexbuild1.png 40 | :align: center 41 | 42 | .. figure:: ../figs/mexbuild2.png 43 | :align: center 44 | 45 | .. figure:: ../figs/mexbuild3.png 46 | :align: center 47 | 48 | `*` Make sure to add NOMAD subfolders on MATLAB before testing the installation. On MATLAB’s Home, use the "Set Path" menu to "Add with Subfolders" the whole NOMAD folder so that functions can easily be accessed 49 | 50 | `*` Run examples provided in the installation folder to confirm that the functions can now be called easily from MATLAB’s command window. For example, trying to solve problem three (3) should give you something similar to: 51 | 52 | .. figure:: ../figs/mexrun1.png 53 | :align: center 54 | 55 | .. figure:: ../figs/mexrun2.png 56 | :align: center 57 | 58 | 59 | 60 | 61 | .. _appendix_parameters: 62 | 63 | Complete list of parameters 64 | =========================== 65 | 66 | A set of parameters is available in the table below for fine tuning algorithmic settings. Additional information on each parameter is available by typing ``$NOMAD_HOME/bin/nomad -h PARAM_NAME``. 67 | 68 | .. csv-table:: NOMAD 4 parameters 69 | :file: ../source/allParameters.csv 70 | :widths: 20,3,10,50,10 71 | 72 | .. toctree:: 73 | :hidden: 74 | 75 | ListOfParameters 76 | -------------------------------------------------------------------------------- /doc/user_guide/source/ListOfParameters.rst: -------------------------------------------------------------------------------- 1 | Detailed information 2 | ^^^^^^^^^^^^^^^^^^^^ 3 | 4 | **In progress** 5 | 6 | BB_INPUT_TYPE 7 | 8 | :: 9 | 10 | Type: NOMAD::BBInputTypeList 11 | 12 | Default: * R 13 | 14 | Description: 15 | 16 | . Blackbox input types 17 | 18 | . List of types for each variable 19 | 20 | . Available types: 21 | . B: binary 22 | . I: integer 23 | . R: continuous 24 | 25 | . Examples: 26 | . BB_INPUT_TYPE * I # all variables are integers 27 | . BB_INPUT_TYPE ( R I B ) # for all 3 variables 28 | . BB_INPUT_TYPE 1-3 B # NOT YET SUPPORTED ( variables 1 to 3 are binary ) 29 | . BB_INPUT_TYPE 0 I # NOT YET SUPPORTED ( first variable is integer ) 30 | 31 | .. _dimension_2: 32 | 33 | DIMENSION 34 | 35 | :: 36 | 37 | Type: size_t 38 | 39 | Default: 0 40 | 41 | Description : 42 | 43 | . Number of variables 44 | 45 | . Argument: one positive integer 46 | 47 | . Example: DIMENSION 3 48 | -------------------------------------------------------------------------------- /doc/user_guide/source/ReleaseNotes.rst: -------------------------------------------------------------------------------- 1 | Release notes and future developments 2 | ===================================== 3 | 4 | NOMAD 4 is a complete redesign compared with NOMAD 3, with a new architecture providing more flexible code, some added functionalities and reusable code. 5 | 6 | Some functionalities available in NOMAD 3 will be included in NOMAD 4 in future releases: 7 | 8 | `-` *RobustMads* [AudIhaLedTrib2016]_ and *StoMads* [G-2019-30]_ 9 | 10 | `-` Categorical [AuDe01a]_ and periodical variables [AuLe2012]_ 11 | 12 | The performance of NOMAD 4 and 3 are similar when the default parameters of NOMAD 3 are used (see [AuLeRoTr2021]_). 13 | 14 | .. topic:: References 15 | 16 | .. [AudIhaLedTrib2016] C. Audet, A. Ihaddadene, S. Le Digabel, and C. Tribes. 2018. Robust optimization of noisy blackbox problems using the Mesh Adaptive Direct Search algorithm. *Optimization Letters* 12, 4 (2018), 675–689 17 | .. [G-2019-30] C. Audet, K.J. Dzahini, M. Kokkolaras, and S. Le Digabel. 2021.Stochastic mesh adaptive direct search for blackbox optimization using probabilistic estimates. *Technical Report* G-2019-30. Les cahiers du GERAD. To appear in *Computational Optimization and Applications*. 18 | .. [AuDe01a] C. Audet and J.E. Dennis, Jr. 2001. Pattern Search Algorithms for Mixed Variable Programming. *SIAM Journal on Optimization* 11, 3 (2001), 573–594. 19 | .. [AuLe2012] C. Audet and S. Le Digabel. 2012. The mesh adaptive direct search algorithm for periodic variables. *Pacific Journal of Optimization* 8, 1 (2012),103–119 20 | -------------------------------------------------------------------------------- /doc/user_guide/source/TricksOfTheTrade.rst: -------------------------------------------------------------------------------- 1 | .. _tricks_of_the_trade: 2 | 3 | Tricks of the trade 4 | =================== 5 | 6 | NOMAD has default values for all algorithmic parameters. These values represent a compromise between robustness and performance obtained by developers on sets of problems used for benchmarking. But you might want to improve NOMAD performance for your problem by tuning the parameters or use advanced functionalities. The following sections provide tricks that may work for you. 7 | 8 | Here are a few suggestions for tuning NOMAD when facing different symptoms. The suggestions can be tested one by one or all together. 9 | 10 | .. csv-table:: Suggestions for tuning NOMAD 11 | :header: "Symptom", "Suggestion", "Ref." 12 | :widths: 20,7,20 13 | 14 | I want to see more display , Increase display degree , :ref:`display_degree` 15 | Quantifiable constraints , Try PB EB or combinations , :ref:`bb_output_type` 16 | Difficult constraint , Try PB instead of EB , :ref:`bb_output_type` 17 | No initial point , Add a LH search , :ref:`LH Search and X0 ` 18 | Variables of different magnitudes , Change blackbox input scaling , :ref:`create_blackbox_program` 19 | " ", Change :math:`\Delta_0` per variable , :ref:`initial_mesh_size` 20 | " ", Tighten bounds , :ref:`bounds` 21 | Many variables , Fix some variables , :ref:`fixed_variable` 22 | " ", Use *PSD-MADS* , :ref:`psd_mads` 23 | Unsatisfactory solution , Change direction type to ``2N`` or ``N+1 UNI`` or ``N+1 NEG`` , :ref:`direction_type` 24 | " ", Change initial point , :ref:`LH Search and X0 ` 25 | " ", Add a LH search , :ref:`LH Search and X0 ` 26 | " ", Add a VNS Mads search , :ref:`VNS Mads Search ` 27 | " ", Tighten bounds , :ref:`bounds` 28 | " ", Change :math:`\Delta_0` , :ref:`initial_mesh_size` 29 | " ", Modify seeds that affect algorithms , :ref:`seed` 30 | " ", Disable quadratic models , set ``QUAD_MODEL_SEARCH no`` 31 | " ", Unable *SGTELIB* models , set ``SGTELIB_MODEL_SEARCH yes`` 32 | " ", Disable opportunistic evaluations, set ``EVAL_OPPORTUNISTIC no`` 33 | " ", Disable anisotropic mesh , set ``ANISOTROPIC_MESH no`` 34 | " ", Change anisotropy factor , set ``ANISOTROPY_FACTOR 0.05`` 35 | Improvements get negligible , Change stopping criteria , Type ``nomad -h stop`` 36 | " ", Disable quadratic models , set ``QUAD_MODEL_SEARCH no`` 37 | It takes long to improve :math:`f` , Decrease :math:`\Delta_0` , :ref:`initial_mesh_size` 38 | Optimization is time consuming , Perform parallel blackbox evaluations , :ref:`block_evaluations` and :ref:`parallel_evaluations` 39 | Blackbox is not that expensive , Setup maximum wall-clock time , remove ``MAX_BB_EVAL`` and set ``MAX_TIME`` 40 | " ", Add a LH search , :ref:`LH Search and X0 ` 41 | " ", Add a VNS Mads search , :ref:`VNS Mads Search ` 42 | -------------------------------------------------------------------------------- /doc/user_guide/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | # import os 14 | # import sys 15 | # sys.path.insert(0, os.path.abspath('.')) 16 | 17 | import sphinx_rtd_theme 18 | 19 | # -- Project information ----------------------------------------------------- 20 | 21 | project = 'Nomad 4' 22 | copyright = '2021, C. Tribes and V. Rochon Montplaisir' 23 | author = 'C. Tribes and V. Rochon Montplaisir' 24 | 25 | 26 | # -- General configuration --------------------------------------------------- 27 | 28 | # Add any Sphinx extension module names here, as strings. They can be 29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 30 | # ones. 31 | extensions = [ "sphinx_rtd_theme"] 32 | 33 | # Add any paths that contain templates here, relative to this directory. 34 | templates_path = ['_templates'] 35 | 36 | # List of patterns, relative to source directory, that match files and 37 | # directories to ignore when looking for source files. 38 | # This pattern also affects html_static_path and html_extra_path. 39 | exclude_patterns = [] 40 | 41 | 42 | # -- Options for HTML output ------------------------------------------------- 43 | 44 | # The theme to use for HTML and HTML Help pages. See the documentation for 45 | # a list of builtin themes. 46 | # 47 | html_theme = "sphinx_rtd_theme" 48 | html_logo = '../_logo/nomad_logo.jpg' 49 | 50 | # Add any paths that contain custom static files (such as style sheets) here, 51 | # relative to this directory. They are copied after the builtin static files, 52 | # so a file named "default.css" will overwrite the builtin "default.css". 53 | # html_static_path = ['_static'] 54 | -------------------------------------------------------------------------------- /doc/user_guide/source/index.rst: -------------------------------------------------------------------------------- 1 | Nomad 4 User Guide 2 | ================== 3 | 4 | .. warning:: 5 | 6 | This user guide is specific to NOMAD 4. 7 | 8 | NOMAD 3 is still available. It will be replaced by NOMAD 4 in the future. 9 | 10 | Get NOMAD 3 and 4 at ``_. 11 | 12 | 13 | NOMAD is a blackbox optimization software. A general presentation of NOMAD is given in :ref:`introduction`. 14 | 15 | **New users of NOMAD should refer to** 16 | 17 | * :ref:`installation` 18 | * :ref:`getting_started` 19 | 20 | **Using NOMAD** 21 | 22 | * Starting from :ref:`basic_nomad_usage`, all users can find ways to tailor problem definition, algorithmic settings and software output. 23 | 24 | * Refer to :ref:`advanced_functionalities` and :ref:`tricks_of_the_trade` for specific problem solving. 25 | 26 | Please cite NOMAD 4 with reference: 27 | 28 | .. [AuLeRoTr2021] C. Audet, S. Le Digabel, V. Rochon Montplaisir, and C. Tribes. 29 | Algorithm 1027: 30 | NOMAD version 4: Nonlinear optimization with the MADS algorithm. 31 | *ACM Transactions on Mathematical Software* 32 | Volume 48, Issue 3, Article No.: 35, pp 1–22 33 | https://doi.org/10.1145/3544489 34 | 35 | .. sidebar:: Reference book 36 | 37 | |dfo_book| 38 | 39 | A complete introduction to derivative-free and blackbox optimization can be found in the textbook: 40 | 41 | .. [AuHa2017] C. Audet and W. Hare. 42 | Derivative-Free and Blackbox Optimization. 43 | *Springer Series in Operations Research and Financial Engineering.* 44 | Springer International Publishing, Berlin, 2017. 45 | 46 | .. |dfo_book| image:: ../figs/livre_DFO_AuHa2017.png 47 | :width: 60 pt 48 | 49 | .. toctree:: 50 | :maxdepth: 1 51 | :caption: Introduction: 52 | 53 | Introduction 54 | 55 | .. toctree:: 56 | :maxdepth: 1 57 | :caption: Installation and tests: 58 | 59 | Installation 60 | 61 | .. toctree:: 62 | :maxdepth: 2 63 | :caption: NOMAD steps: 64 | 65 | GettingStarted 66 | HowToUseNomad 67 | LibraryMode 68 | TricksOfTheTrade 69 | AdvancedFunctionalities 70 | SgteLib 71 | 72 | 73 | .. toctree:: 74 | :maxdepth: 1 75 | :caption: Additional information: 76 | 77 | ReleaseNotes 78 | Appendix 79 | 80 | Indices and tables 81 | ================== 82 | 83 | * :ref:`genindex` 84 | * :ref:`modindex` 85 | * :ref:`search` 86 | -------------------------------------------------------------------------------- /examples/advanced/batch/BBOutputRedirection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bb_redirect.exe bb_redirect.cpp ) 3 | set_target_properties(bb_redirect.exe PROPERTIES SUFFIX "") 4 | 5 | # installing executables and libraries 6 | install(TARGETS bb_redirect.exe 7 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | # Add a test for this example 10 | message(STATUS " Add example advanced batch BB redirection") 11 | 12 | # Test run in working directory AFTER install of bb_redirect.exe executable 13 | add_test(NAME ExampleAdvancedBatchRedirect 14 | COMMAND ${CMAKE_INSTALL_PREFIX}/bin/nomad param.txt 15 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 16 | -------------------------------------------------------------------------------- /examples/advanced/batch/BBOutputRedirection/param.txt: -------------------------------------------------------------------------------- 1 | # PROBLEM PARAMETERS 2 | #################### 3 | 4 | DIMENSION 2 # number of variables 5 | 6 | BB_EXE bb_redirect.exe # 'bb_redirect.exe' is a program that 7 | # takes in argument the name of 8 | # a text file ('input filename') 9 | # containing 2 10 | # values, and that write 1 11 | # values that correspond to the 12 | # objective function value (OBJ) 13 | # in a file inputfilename.output 14 | # IN THAT CASE WE MUST HAVE THE OPTION 15 | # BB_REDIRECTION no 16 | # To have log file use BB_EXE "bb_redirect.exe $>> $log.txt" 17 | 18 | BB_OUTPUT_TYPE OBJ 19 | BB_REDIRECTION no # For a blackbox that manages the output file 20 | # NOMAD expect an output file with a name 21 | # of the input file + ".output' 22 | # INPUT and OUTPUT files have a fixed name 23 | # during optimization. 24 | 25 | 26 | X0 ( 2 2 ) # starting point 27 | 28 | 29 | MAX_BB_EVAL 100 # the algorithm terminates when 30 | # 100 black-box evaluations have 31 | # been made 32 | 33 | # STATS_FILE stat.txt 34 | 35 | # DISPLAY_ALL_EVAL yes 36 | 37 | DISPLAY_STATS BBE ( SOL ) OBJ # Display the number of evaluation (BBE), 38 | DISPLAY_DEGREE 2 # the current solution ( SOL ) and the objective 39 | -------------------------------------------------------------------------------- /examples/advanced/batch/CountEval/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bb_cnt_eval.exe bb_cnt_eval.cpp ) 3 | set_target_properties(bb_cnt_eval.exe PROPERTIES SUFFIX "") 4 | 5 | # installing executables and libraries 6 | install(TARGETS bb_cnt_eval.exe 7 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | # Add a test for this example 10 | message(STATUS " Add example advanced batch count eval") 11 | 12 | # Test run in working directory AFTER install of bb_cnt_eval.exe executable 13 | add_test(NAME CountEvalAdvancedBatch 14 | COMMAND ${CMAKE_INSTALL_PREFIX}/bin/nomad param.txt 15 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 16 | -------------------------------------------------------------------------------- /examples/advanced/batch/CountEval/param.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Example: count eval flag is provided by the blackbox 3 | # If a hidden constraint is not verified, the remaining constraints are not computed, 4 | # the objective is set to infinity and the evaluation is not counted. 5 | # NOTE: For library mode, the countEval flag is an output argument of the eval_x function. 6 | 7 | 8 | # PROBLEM PARAMETERS 9 | #################### 10 | 11 | # Number of variables 12 | DIMENSION 10 13 | 14 | # Black box 15 | BB_EXE bb_cnt_eval.exe 16 | BB_OUTPUT_TYPE CNT_EVAL OBJ PB PB # CNT_EVAL is for the flag passed from the bb to Nomad 17 | 18 | # Starting point 19 | X0 ( 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 ) 20 | 21 | # Bounds are useful to avoid extreme values 22 | LOWER_BOUND * -20.0 23 | UPPER_BOUND * 20.0 24 | 25 | 26 | # ALGORITHM PARAMETERS 27 | ###################### 28 | 29 | # The algorithm terminates after that number black-box evaluations 30 | MAX_BB_EVAL 100 31 | 32 | # Formatted stats into a file 33 | STATS_FILE stats.txt BBE SOL BBO 34 | 35 | DISPLAY_ALL_EVAL yes 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /examples/advanced/batch/DiscoMads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bb_disco.exe bb_disco.cpp) 3 | set_target_properties(bb_disco.exe PROPERTIES SUFFIX "") 4 | 5 | # installing executables and libraries 6 | install(TARGETS bb_disco.exe 7 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | # No test for this example 10 | -------------------------------------------------------------------------------- /examples/advanced/batch/DiscoMads/paramEscapeDiscont.txt: -------------------------------------------------------------------------------- 1 | ## Run DiscoMads to reveal and escape discontinuities 2 | 3 | # The problem is described sec. 5.1 "Results of a typical run" of [1] and more detailled 4 | # following eq. 2.52, p.53 in [2]. 5 | 6 | # [1] Escaping Unknown Discontinuous Regions in Blackbox Optimization 7 | # Charles Audet, Alain Batailly, and Solène Kojtych, SIAM Journal on Optimization, 2022 8 | # doi/10.1137/21M1420915 9 | # [2] Contributions à l'optimisation de systèmes mécaniques non réguliers : reconception 10 | # d'aubes de compresseur 11 | # Solène Kojtych, Ph.D. thesis 2022 12 | # doi/10.1137/21M1420915 13 | #################### 14 | 15 | 16 | # PROBLEM PARAMETERS 17 | #################### 18 | 19 | # Number of variables 20 | DIMENSION 2 21 | 22 | # Black box 23 | BB_EXE bb_disco.exe 24 | 25 | # BB output (-R indicates a revealing output) 26 | BB_OUTPUT_TYPE OBJ-R PB-R 27 | # Only revealing output are considered to reveal discontinuities with DiscoMads 28 | 29 | # Starting point 30 | X0 ( -5 -5 ) 31 | 32 | LOWER_BOUND * -10 33 | UPPER_BOUND * 10 34 | 35 | # GENERAL ALGORITHM PARAMETERS 36 | ###################### 37 | 38 | # The algorithm terminates after that number black-box evaluations 39 | # or when min mesh size is reached 40 | MAX_BB_EVAL 2000 41 | MIN_MESH_SIZE * 1E-9 42 | 43 | # Parameters for display degree 44 | DISPLAY_DEGREE 2 45 | DISPLAY_ALL_EVAL true 46 | DISPLAY_STATS BBE ( SOL ) OBJ 47 | 48 | 49 | # DISCOMADS PARAMETERS 50 | ###################### 51 | DISCO_MADS_OPTIMIZATION true 52 | 53 | # Characterization of discontinuities 54 | DISCO_MADS_DETECTION_RADIUS 0.25 55 | DISCO_MADS_LIMIT_RATE 0.3 56 | ## A discontinuity is revealed if the rate of change of at least one revealing output 57 | ## between two points at distance < DISCO_MADS_DETECTION_RADIUS exceeds DISCO_MADS_LIMIT_RATE 58 | 59 | # Remoteness to discontinuities wished 60 | DISCO_MADS_EXCLUSION_RADIUS 0.25 61 | 62 | # Revealing poll 63 | DISCO_MADS_REVEALING_POLL_RADIUS 0.505 # e.g. 1.01*(DISCO_MADS_DETECTION_RADIUS+DISCO_MADS_EXCLUSION_RADIUS) 64 | DISCO_MADS_REVEALING_POLL_NB_POINTS 2 # defaut= problem dimension 65 | 66 | 67 | # RECOMMENDED PARAMETERS FOR DISCOMADS 68 | ###################### 69 | 70 | # Quadratic model: desactivated as they may be slow with DiscoMads 71 | QUAD_MODEL_SEARCH false 72 | EVAL_QUEUE_SORT DIR_LAST_SUCCESS 73 | DIRECTION_TYPE ORTHO 2N 74 | 75 | 76 | # SPECIFIC THESIS PARAMETERS USED IN [2] 77 | ###################### 78 | ## Uncomment the following parameters to reproduce the thesis parameters 79 | #DIRECTION_TYPE ORTHO N+1 NEG # comment previous "DIRECTION_TYPE" command 80 | #SEED 3698370 81 | #ANISOTROPIC_MESH false 82 | #NM_SEARCH false 83 | #SPECULATIVE_SEARCH true -------------------------------------------------------------------------------- /examples/advanced/batch/DiscoMads/paramEscapeHiddenConstraints.txt: -------------------------------------------------------------------------------- 1 | ## Run DiscoMads to reveal and escape hidden constraints regions 2 | 3 | 4 | # The problem is described sec. 5.3 "5.3. Design of a styrene production process." of [1] and more detailled 5 | # in section 2.5.4, p.61 of [2]. 6 | 7 | # IMPORTANT : The blackbox used is Styrene, run in hybrid library/batch mode. 8 | # The styrene standalone executable is registered with "BB_EXE truth.exe" 9 | # To run this optimization, this file must be executed in a path where styrene truth.exe executable is available. 10 | # Styrene sources are available at https://github.com/bbopt/styrene and must be compiled prior to run this optimization. 11 | 12 | # [1] Escaping Unknown Discontinuous Regions in Blackbox Optimization 13 | # Charles Audet, Alain Batailly, and Solène Kojtych, SIAM Journal on Optimization, 2022 14 | # doi/10.1137/21M1420915 15 | # [2] Contributions à l'optimisation de systèmes mécaniques non réguliers : reconception 16 | # d'aubes de compresseur 17 | # Solène Kojtych, Ph.D. thesis 2022 18 | # doi/10.1137/21M1420915 19 | #################### 20 | 21 | 22 | # PROBLEM PARAMETERS 23 | #################### 24 | 25 | # Number of variables 26 | DIMENSION 8 27 | 28 | # Black box 29 | BB_EXE truth.exe 30 | 31 | # BB output (-R indicates a revealing output) 32 | BB_OUTPUT_TYPE EB EB EB EB PB PB PB PB PB PB PB OBJ-R 33 | # Only revealing output are considered to reveal hidden constraints with DiscoMads 34 | 35 | # Starting point 36 | X0 ( 100 87.82280202 95.36797348 0 0 49.04338841 42.41599794 41.01732603 ) 37 | 38 | LOWER_BOUND * 0 39 | UPPER_BOUND * 100 40 | 41 | # GENERAL ALGORITHM PARAMETERS 42 | ###################### 43 | 44 | # The algorithm terminates after that number black-box evaluations 45 | # or when min mesh size is reached 46 | MAX_BB_EVAL 1000 47 | MIN_MESH_SIZE * 1E-7 48 | 49 | # Parameters for display degree 50 | DISPLAY_DEGREE 2 51 | DISPLAY_ALL_EVAL true 52 | DISPLAY_STATS BBE OBJ 53 | 54 | 55 | # DISCOMADS PARAMETERS 56 | ###################### 57 | DISCO_MADS_OPTIMIZATION true 58 | DISCO_MADS_HID_CONST true # escape hidden constraints instead of discontinuities 59 | 60 | # Remoteness to hidden constraints wished 61 | DISCO_MADS_EXCLUSION_RADIUS 15 62 | 63 | # Revealing poll 64 | DISCO_MADS_REVEALING_POLL_RADIUS 20 65 | DISCO_MADS_REVEALING_POLL_NB_POINTS 8 # default= problem dimension 66 | 67 | 68 | # RECOMMENDED PARAMETERS FOR DISCOMADS 69 | ###################### 70 | 71 | # Quadratic model: desactivated as they may be slow with DiscoMads 72 | QUAD_MODEL_SEARCH false 73 | EVAL_QUEUE_SORT DIR_LAST_SUCCESS 74 | DIRECTION_TYPE ORTHO 2N 75 | 76 | #INITIAL_FRAME_SIZE * 5.05 77 | 78 | # SPECIFIC THESIS PARAMETERS USED IN [2] 79 | ###################### 80 | ## Uncomment the following parameters to reproduce the thesis parameters 81 | #DIRECTION_TYPE ORTHO N+1 NEG # comment previous "DIRECTION_TYPE" command 82 | #SEED 3698370 83 | #ANISOTROPIC_MESH false 84 | #NM_SEARCH false 85 | #SPECULATIVE_SEARCH true -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.exe 3 | cache.txt 4 | out* 5 | -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(uu.exe uu.cpp ) 3 | set_target_properties(uu.exe PROPERTIES SUFFIX "") 4 | 5 | # installing executables and libraries 6 | install(TARGETS uu.exe 7 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/param.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 5 7 | 8 | # Black box 9 | BB_EXE uu.exe 10 | 11 | # ALGORITHM PARAMETERS 12 | ###################### 13 | 14 | # Starting point 15 | X0 ( 4 6 6 6 5 ) 16 | 17 | LOWER_BOUND ( -10.0 - - - -5.0 ) 18 | UPPER_BOUND * 31.0 19 | 20 | # The algorithm terminates after that number black-box evaluations 21 | MAX_BB_EVAL 1000 22 | 23 | # Parameters for display degree 24 | DISPLAY_DEGREE 2 25 | DISPLAY_ALL_EVAL true 26 | 27 | GRANULARITY * 0.01 28 | 29 | MAX_EVAL 1000 30 | 31 | #DISPLAY_STATS BBE THREAD_NUM OBJ ( SOL ) OBJ CONS_H H_MAX 32 | DISPLAY_STATS BBE ( SOL ) OBJ 33 | BB_OUTPUT_TYPE PB OBJ 34 | ADD_SEED_TO_FILE_NAMES false 35 | 36 | EVAL_OPPORTUNISTIC true 37 | H_MAX_0 200000 38 | FIXED_VARIABLE 0-2 39 | 40 | CACHE_FILE cache.txt 41 | -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/param1.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 5 7 | 8 | # Black box 9 | BB_EXE uu.exe 10 | 11 | # ALGORITHM PARAMETERS 12 | ###################### 13 | 14 | # Starting point 15 | X0 ( 4 6 6 6 5 ) 16 | 17 | LOWER_BOUND ( -10.0 - - - -5.0 ) 18 | UPPER_BOUND * 31.0 19 | 20 | # The algorithm terminates after that number black-box evaluations 21 | MAX_BB_EVAL 1000 22 | 23 | # Parameters for display degree 24 | DISPLAY_DEGREE 2 25 | DISPLAY_ALL_EVAL false 26 | 27 | GRANULARITY * 0.01 28 | 29 | MAX_EVAL 1000 30 | 31 | DISPLAY_STATS BBE ( MESH_SIZE ) ( POLL_SIZE ) ( SOL ) OBJ 32 | BB_OUTPUT_TYPE PB OBJ 33 | ADD_SEED_TO_FILE_NAMES false 34 | 35 | EVAL_OPPORTUNISTIC true 36 | H_MAX_0 200000 37 | FIXED_VARIABLE 0-2 38 | 39 | CACHE_FILE cache.txt 40 | -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/param10.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 5 7 | 8 | # Black box 9 | BB_EXE uu.exe 10 | 11 | # ALGORITHM PARAMETERS 12 | ###################### 13 | 14 | # Starting point 15 | # Take best from cache 16 | #X0 ( 4 6 6 6 5 ) 17 | 18 | LOWER_BOUND ( -10.0 - - - -5.0 ) 19 | UPPER_BOUND * 31.0 20 | 21 | # The algorithm terminates after that number black-box evaluations 22 | MAX_BB_EVAL 1000 23 | 24 | # Parameters for display degree 25 | DISPLAY_DEGREE 2 26 | DISPLAY_ALL_EVAL true 27 | 28 | GRANULARITY * 0.01 29 | 30 | MAX_EVAL 1000 31 | 32 | DISPLAY_STATS BBE ( MESH_SIZE ) ( POLL_SIZE ) ( SOL ) OBJ CONS_H 33 | BB_OUTPUT_TYPE PB OBJ 34 | ADD_SEED_TO_FILE_NAMES false 35 | 36 | EVAL_OPPORTUNISTIC true 37 | H_MAX_0 200000 38 | 39 | CACHE_FILE cache.txt 40 | -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/param2.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 5 7 | 8 | # Black box 9 | BB_EXE uu.exe 10 | 11 | # ALGORITHM PARAMETERS 12 | ###################### 13 | 14 | # Starting point 15 | # Should take best from cache 16 | #X0 ( 4 6 6 6 5 ) 17 | 18 | LOWER_BOUND ( -10.0 - - - -5.0 ) 19 | UPPER_BOUND * 31.0 20 | 21 | # The algorithm terminates after that number black-box evaluations 22 | MAX_BB_EVAL 1000 23 | 24 | # Parameters for display degree 25 | DISPLAY_DEGREE 2 26 | 27 | GRANULARITY * 0.01 28 | 29 | MAX_EVAL 1000 30 | 31 | DISPLAY_STATS BBE ( MESH_SIZE ) ( POLL_SIZE ) ( SOL ) OBJ 32 | BB_OUTPUT_TYPE PB OBJ 33 | ADD_SEED_TO_FILE_NAMES false 34 | 35 | EVAL_OPPORTUNISTIC true 36 | H_MAX_0 200000 37 | FIXED_VARIABLE 2-3 38 | 39 | CACHE_FILE cache.txt 40 | -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/param3.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 5 7 | 8 | # Black box 9 | BB_EXE uu.exe 10 | 11 | # ALGORITHM PARAMETERS 12 | ###################### 13 | 14 | # Starting point 15 | # Take best from cache 16 | #X0 ( 4 6 6 6 5 ) 17 | 18 | LOWER_BOUND ( -10.0 - - - -5.0 ) 19 | UPPER_BOUND * 31.0 20 | 21 | # The algorithm terminates after that number black-box evaluations 22 | MAX_BB_EVAL 1000 23 | 24 | # Parameters for display degree 25 | DISPLAY_DEGREE 2 26 | 27 | GRANULARITY * 0.01 28 | 29 | MAX_EVAL 1000 30 | 31 | DISPLAY_STATS BBE ( MESH_SIZE ) ( POLL_SIZE ) ( SOL ) OBJ 32 | BB_OUTPUT_TYPE PB OBJ 33 | ADD_SEED_TO_FILE_NAMES false 34 | 35 | EVAL_OPPORTUNISTIC true 36 | H_MAX_0 200000 37 | FIXED_VARIABLE 3-4 38 | 39 | CACHE_FILE cache.txt 40 | -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/runFixed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Batch executable to run a problem using a series of fixed values. 3 | 4 | # Argument #1: path to Nomad install dir 5 | 6 | rm -f cache.txt 7 | # Fix 0-2 8 | echo "Fix 0-2" 9 | $1/bin/nomad param1.txt 10 | echo "Cache size: "; wc -l cache.txt 11 | # Fix 2-3 12 | echo "Fix 2-3" 13 | $1/bin/nomad param2.txt 14 | echo "Cache size: "; wc -l cache.txt 15 | # Fix 3-4 16 | echo "Fix 3-4" 17 | $1/bin/nomad param3.txt 18 | echo "Cache size: "; wc -l cache.txt 19 | # Fix nothing 20 | echo "Fix nothing" 21 | $1/bin/nomad param10.txt 22 | echo "Cache size: "; wc -l cache.txt 23 | -------------------------------------------------------------------------------- /examples/advanced/batch/FixedVariable/runFixedWin.sh: -------------------------------------------------------------------------------- 1 | #Batch executable to run a problem using a series of fixed values. 2 | 3 | nomad_exe=$1 4 | 5 | rm -f cache.txt 6 | # Fix 0-2 7 | echo "Fix 0-2" 8 | $nomad_exe param1.txt 9 | echo "Cache size: "; wc -l cache.txt 10 | # Fix 2-3 11 | echo "Fix 2-3" 12 | $nomad_exe param2.txt 13 | echo "Cache size: "; wc -l cache.txt 14 | # Fix 3-4 15 | echo "Fix 3-4" 16 | $nomad_exe param3.txt 17 | echo "Cache size: "; wc -l cache.txt 18 | # Fix nothing 19 | echo "Fix nothing" 20 | $nomad_exe param10.txt 21 | echo "Cache size: "; wc -l cache.txt 22 | -------------------------------------------------------------------------------- /examples/advanced/batch/IBEX/README.txt: -------------------------------------------------------------------------------- 1 | This file explains how to use NOMAD with IBEX thanks to an exemple. 2 | 3 | First, when you have the BB file of the problem you want to solve you have to create a "system" file that defines the problems i.e. defines the variables, the constraints, the initial domain etc.... In this case, the system file is "system_anneau.txt". 4 | 5 | Then, you have to use the files "create_set" or "create_set_with_volume" to create the Set (i.e. the caracterization of the domain with boxes) from the system file. Then you can give these information to NOMAD thanks to the param.txt file. In this case, in the param.txt file, the line 15 claims that you want to use IBEX, the line 16 claims that you already created the Set and the line 17 provides the name of the file that contains the Set. 6 | 7 | However, if you don't want to create the Set, you can only provide the system file name thanks to the attribute SYSTEM_FILE_NAME and the Set will be created automatically in NOMAD. The argument SET_FILE (bool) defines if you already created the Set or if you only want to pass the system file. 8 | 9 | Two differents use of NOMAD with IBEX are available. You can either call the Set in the BB file and project directly in the this file (see bb.cpp) or you can project the point in NOMAD, and in this case you give the informations needed thanks to the param.txt file, such as explained above. 10 | -------------------------------------------------------------------------------- /examples/advanced/batch/IBEX/how_to_use_create_set.txt: -------------------------------------------------------------------------------- 1 | This file explains how to use the binary files "create_set" and "create_set_with_volume". 2 | 3 | First, you have to create the file that corresponds to the problem you want to solve with NOMAD. 4 | It's a file containing the variables, the constraints, the domain, etc... 5 | http://www.ibex-lib.org/doc/minibex.html provides more explanation on the syntax. 6 | 7 | Once this file is created, you can use it with the file param.txt. It corresponds to the attribute SYSTEM_FILE_NAME. 8 | 9 | But you can use it directly to create the file that allow us to know the feasible domain, thanks to the binary file "create_set" or "create_set_with_volume". To use these files, the SYSTEM_FILE_NAME has to be "system.txt". Then you can call these binary files, with one argument witch is the precision of the domaine (float). The less the precision is, the more accurate the domain will be but the longer it will be to create the file. 10 | 11 | For exemple : ./create_set 1 or ./create_set_with_volume 0.1 12 | 13 | Once the Set file is created, you can use it with the file param.txt, it corresponds to the attribute SET_FILE_NAME. 14 | 15 | The binary file create_set_with_volume create another file with gives information on if the precision used is pertinent. It gives the percentage of the volume of the boundary boxes compared to the box that defines the feasible domain. 16 | If this percentage equals from 50% to 90%, then you have to decrease the precision. 17 | A precision is good between 0 and 20%. 18 | -------------------------------------------------------------------------------- /examples/advanced/batch/IBEX/makefile: -------------------------------------------------------------------------------- 1 | SRCS=$(filter-out vibes.cpp, $(wildcard *.cpp)) 2 | BINS=$(SRCS:.cpp=) 3 | 4 | CXXFLAGS := $(shell pkg-config --cflags ibex) 5 | LIBS := $(shell pkg-config --libs ibex) 6 | 7 | ifeq ($(DEBUG), yes) 8 | CXXFLAGS := $(CXXFLAGS) -O0 -g -pg -Wall 9 | else 10 | CXXFLAGS := $(CXXFLAGS) -O3 -DNDEBUG 11 | endif 12 | 13 | CXXFLAGS := $(CXXFLAGS) -std=c++11 -DIBEX_BENCHS_DIR=\"${ROOT_DIR}../benchs/solver\" -U__STRICT_ANSI__ 14 | 15 | DOC_OUT_TXT=doc-arithmetic.txt doc-modeling.txt doc-separator.txt doc-set.txt 16 | DOC_SET_OUT=set-sep set-example set-inter set-union set-contract set-interval 17 | 18 | EX_WITH_VIBES="doc-set lab1 lab2 lab3 lab4 lab5 lab6 lab7 lab8" 19 | VIBES_MSG="INFO: The example $@ uses VIBes to plot data, you need to launch VIBes-viewer before running this test" 20 | 21 | all: $(BINS) 22 | 23 | % : %.cpp 24 | @case $(EX_WITH_VIBES) in *$@*) echo "$(VIBES_MSG)" ;; esac 25 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $< $(LIBS) 26 | 27 | clean: 28 | rm -f $(BINS) $(DOC_OUT_TXT) $(DOC_SET_OUT) 29 | 30 | #plugins/optim/examples/doc-contractor.cpp 31 | -------------------------------------------------------------------------------- /examples/advanced/batch/IBEX/param.txt: -------------------------------------------------------------------------------- 1 | DIMENSION 2 2 | 3 | DISPLAY_DEGREE 2 4 | DISPLAY_STATS BBE ( SOL ) OBJ CONS_H TIME 5 | 6 | BB_EXE bb 7 | BB_OUTPUT_TYPE OBJ PB PB 8 | 9 | 10 | X0 (-1 2) 11 | 12 | lower_bound ( -6 -6 ) 13 | upper_bound ( 6 6 ) 14 | 15 | USE_IBEX true 16 | SET_FILE true 17 | SET_FILE_NAME set_anneau.txt 18 | 19 | 20 | MAX_BB_EVAL 500 21 | 22 | TMP_DIR /tmp 23 | -------------------------------------------------------------------------------- /examples/advanced/batch/IBEX/system_anneau.txt: -------------------------------------------------------------------------------- 1 | Variables 2 | x[2] in [-6,6]; 3 | Constraints 4 | x[0]^2 + x[1]^2 <= 36; 5 | x[0]^2 + x[1]^2 >= 25; 6 | end 7 | -------------------------------------------------------------------------------- /examples/advanced/batch/LHonly/.gitignore: -------------------------------------------------------------------------------- 1 | u.o 2 | u.exe 3 | -------------------------------------------------------------------------------- /examples/advanced/batch/LHonly/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(u.exe u.cpp ) 3 | set_target_properties(u.exe PROPERTIES SUFFIX "") 4 | 5 | # installing executables and libraries 6 | install(TARGETS u.exe 7 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | # No test for this example 10 | -------------------------------------------------------------------------------- /examples/advanced/batch/LHonly/param.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 10 7 | 8 | # Black box 9 | BB_EXE u.exe 10 | 11 | BB_OUTPUT_TYPE PB OBJ 12 | 13 | # ALGORITHM PARAMETERS 14 | ###################### 15 | LH_EVAL 100 16 | 17 | LOWER_BOUND * 0 18 | UPPER_BOUND * 30 19 | 20 | # Parameters for display degree 21 | DISPLAY_DEGREE 2 22 | DISPLAY_ALL_EVAL true 23 | 24 | DISPLAY_STATS BBE ( %2.2SOL ) BBO 25 | -------------------------------------------------------------------------------- /examples/advanced/batch/PSDMadsWithPythonBB/X0.txt: -------------------------------------------------------------------------------- 1 | 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 2 | 3 | -------------------------------------------------------------------------------- /examples/advanced/batch/PSDMadsWithPythonBB/bb.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import re 4 | import numpy as np 5 | 6 | 7 | input_file_name=sys.argv[1] 8 | X=np.genfromtxt(input_file_name) 9 | 10 | #print(X) 11 | 12 | # Standard output is grabbed by Nomad evaluator 13 | dim = len(X) 14 | assert (dim%2==0), "Dimension must be an even number" 15 | 16 | f = 0 17 | for i in range(1,int(dim/2)): 18 | f += pow( 10*X[2*i-1] - pow(X[2*i-2],2), 2) + pow(1-X[2*i-2],2) 19 | print(f) 20 | exit(0) 21 | -------------------------------------------------------------------------------- /examples/advanced/batch/PSDMadsWithPythonBB/param.txt: -------------------------------------------------------------------------------- 1 | DIMENSION 50 2 | 3 | BB_EXE '$python3 bb.py ' 4 | BB_OUTPUT_TYPE OBJ 5 | 6 | X0 * 0.5 7 | 8 | LOWER_BOUND * -10 9 | UPPER_BOUND * 10 10 | 11 | 12 | MAX_BB_EVAL 1000 13 | 14 | PSD_MADS_OPTIMIZATION yes 15 | PSD_MADS_NB_SUBPROBLEM 4 16 | 17 | DISPLAY_DEGREE 2 18 | DISPLAY_STATS BBE ( SOL ) OBJ 19 | -------------------------------------------------------------------------------- /examples/advanced/batch/SuggestAndObserve/.gitignore: -------------------------------------------------------------------------------- 1 | cache*.txt 2 | !cache0.txt 3 | x*.txt 4 | f*.txt 5 | param*.txt 6 | !param0.txt 7 | *.o 8 | -------------------------------------------------------------------------------- /examples/advanced/batch/SuggestAndObserve/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(suggest.exe suggest.cpp ) 3 | add_executable(observe.exe observe.cpp ) 4 | add_executable(bbr.exe bbr.cpp ) 5 | 6 | add_library (utils OBJECT utils.cpp) 7 | 8 | set_target_properties(suggest.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 9 | set_target_properties(observe.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 10 | set_target_properties(bbr.exe PROPERTIES SUFFIX "") 11 | 12 | if(OpenMP_CXX_FOUND) 13 | target_link_libraries(utils PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 14 | target_link_libraries(suggest.exe PUBLIC utils nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 15 | target_link_libraries(observe.exe PUBLIC utils nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 16 | else() 17 | target_link_libraries(utils PUBLIC nomadAlgos nomadUtils nomadEval) 18 | target_link_libraries(suggest.exe PUBLIC utils nomadAlgos nomadUtils nomadEval) 19 | target_link_libraries(observe.exe PUBLIC utils nomadAlgos nomadUtils nomadEval) 20 | endif() 21 | 22 | # installing executables and libraries 23 | install(TARGETS suggest.exe observe.exe bbr.exe 24 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 25 | 26 | # No test for this example 27 | -------------------------------------------------------------------------------- /examples/advanced/batch/SuggestAndObserve/README.txt: -------------------------------------------------------------------------------- 1 | # Loop Suggest and Observe 2 | 3 | This project runs a loop of suggestion and observation using the executables `suggest.exe`, `bbr.exe`, and `observe.exe`. 4 | 5 | ## Description 6 | 7 | The `loopSuggestAndObserve.sh` script executes a series of iterations where points are suggested, evaluated, and observed. The process continues until no new points are suggested or the maximum number of iterations is reached. 8 | 9 | ## Usage 10 | 11 | To run the script, ensure that the executables `suggest.exe`, `bbr.exe`, and `observe.exe` are present in the same directory as the script. Then, execute the script with the following command: 12 | 13 | ./loopSuggestAndObserve.sh 14 | 15 | ## Generated Files 16 | 17 | . cache.txt, cache[1-9]*.txt: Cache files used and updated in each iteration. 18 | 19 | . x*.txt: Files containing the suggested points for each iteration. 20 | 21 | . f*.txt: Files containing the evaluation results for each iteration. 22 | 23 | . param[1-9]*.txt: Parameter files updated in each iteration. 24 | 25 | ## Notes 26 | 27 | Ensure that the executables suggest.exe, bbr.exe, and observe.exe are properly compiled and accessible by using the CMake build procedure. 28 | 29 | The script is configured for a maximum of 10 iterations, but this number can be adjusted by modifying the condition in the until loop. 30 | 31 | 32 | -------------------------------------------------------------------------------- /examples/advanced/batch/SuggestAndObserve/loopSuggestAndObserve.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -f cache.txt cache[1-9]*.txt x*.txt f*.txt param[1-9]*.txt 4 | 5 | i=0 6 | until [ $i -gt 10 ] 7 | do 8 | ./suggest.exe cache$i.txt param$i.txt > x$i.txt 9 | nbPoints=`wc -l x$i.txt | awk '{print $1}'` 10 | echo "Iteration $i generated $nbPoints points" 11 | if [ 0 -eq $nbPoints ] 12 | then 13 | break 14 | fi 15 | echo "Evaluate $nbPoints points" 16 | ./bbr.exe x$i.txt > f$i.txt 17 | j=$((i+1)) 18 | echo "Observe $nbPoints points" 19 | ./observe.exe x$i.txt f$i.txt cache$i.txt cache$j.txt param$i.txt > param$j.txt 20 | i=$j 21 | done 22 | echo "Normal termination" 23 | -------------------------------------------------------------------------------- /examples/advanced/batch/SuggestAndObserve/param0.txt: -------------------------------------------------------------------------------- 1 | INITIAL_FRAME_SIZE ( 0.1 0.1 ) 2 | H_MAX_0 INF 3 | -------------------------------------------------------------------------------- /examples/advanced/batch/UseCacheFileForRerun/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bb_cache.exe bb.cpp ) 3 | set_target_properties(bb_cache.exe PROPERTIES SUFFIX "") 4 | 5 | # installing executables and libraries 6 | install(TARGETS bb_cache.exe 7 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | # No test for this example 10 | -------------------------------------------------------------------------------- /examples/advanced/batch/UseCacheFileForRerun/README.txt: -------------------------------------------------------------------------------- 1 | # Utilization of a cache file for a hot restart 2 | 3 | This project illustrates how a first optimization run can be continued with 4 | a second run with more evaluations. 5 | 6 | The example uses a cache file to resume an optimization if the initial attempt 7 | is prematurely stopped. To simulate this situation we have two parameter files 8 | that can be ran in sequence. 9 | 10 | This functionality is only possible if the problem definition is not changed 11 | between the runs. 12 | 13 | ## Usage 14 | 15 | To run the first optimization execute the following command: 16 | 17 | $NOMAD_HOME/bin/nomad param_firstRun.txt 18 | 19 | This creates a cache file `cache.txt` containing 100 evaluated points. 20 | 21 | To continue this optimization with 50 more points, execute the following command: 22 | 23 | $NOMAD_HOME/bin/nomad param_secondRun.txt 24 | 25 | In the second run, the `MAX_BB_EVAL` parameter is increased to 150, and the 26 | `USE_CACHE_FILE_FOR_RERUN` option is enabled. This means that the first 100 27 | evaluations of the second run will be loaded from the cache file instead of 28 | being re-evaluated by the blackbox function. The optimization algorithm will 29 | then proceed with new evaluations until it reaches the maximum number of 30 | evaluations specified. 31 | 32 | 33 | 34 | ## Notes 35 | 36 | Running two times using `param_firstRun.txt` will produce different results 37 | because the cache file is used. We can note that the cache hits increase between 38 | two runs. 39 | 40 | For repeatability, the cache file must removed after doing the two steps of the procedure. 41 | 42 | For using the best point obtained after a first run and stored in a cache, 43 | the user can remove initial point provide in `X0`. 44 | -------------------------------------------------------------------------------- /examples/advanced/batch/UseCacheFileForRerun/param_firstRun.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 10 7 | 8 | # Black box 9 | BB_EXE bb_cache.exe 10 | BB_OUTPUT_TYPE OBJ PB PB PB 11 | 12 | # Starting point 13 | X0 ( 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 ) 14 | 15 | # Bounds are useful to avoid extreme values 16 | LOWER_BOUND * -20.0 17 | UPPER_BOUND * 20.0 18 | 19 | 20 | 21 | # ALGORITHM PARAMETERS 22 | ###################### 23 | 24 | # The algorithm terminates after that number black-box evaluations 25 | MAX_BB_EVAL 100 26 | CACHE_FILE cache.txt 27 | 28 | # Parameters for display 29 | DISPLAY_DEGREE 2 30 | DISPLAY_ALL_EVAL 1 31 | DISPLAY_STATS BBE ( SOL ) OBJ CONS_H 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /examples/advanced/batch/UseCacheFileForRerun/param_secondRun.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 10 7 | 8 | # Black box 9 | BB_EXE bb_cache.exe 10 | BB_OUTPUT_TYPE OBJ PB PB PB 11 | 12 | # Starting point 13 | X0 ( 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 ) 14 | 15 | # Bounds are useful to avoid extreme values 16 | LOWER_BOUND * -20.0 17 | UPPER_BOUND * 20.0 18 | 19 | 20 | 21 | # ALGORITHM PARAMETERS 22 | ###################### 23 | 24 | # The algorithm terminates after that number black-box evaluations 25 | MAX_BB_EVAL 150 26 | 27 | # If cache.txt exits it will be used. 28 | # Possible Use Case: 29 | # - first run (no cache file) with max_bb_eval 100. Cache file is created 30 | # - increase max_bb_eval to 150. 31 | # - second run uses the first 100 in the cache file and continues with real bb evals to reach 150 32 | USE_CACHE_FILE_FOR_RERUN true 33 | CACHE_FILE cache.txt 34 | 35 | # Parameters for display 36 | DISPLAY_DEGREE 2 37 | DISPLAY_ALL_EVAL 1 38 | DISPLAY_STATS BBE ( SOL ) OBJ CONS_H 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/advanced/library/COOPMads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Example only for OPENMP build 2 | 3 | add_executable(rosenbrockCoop.exe rosenbrockCoop.cpp ) 4 | 5 | target_include_directories(rosenbrockCoop.exe PRIVATE 6 | ${CMAKE_SOURCE_DIR}/src) 7 | 8 | set_target_properties(rosenbrockCoop.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 9 | 10 | target_link_libraries(rosenbrockCoop.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | 12 | # installing executables and libraries 13 | install(TARGETS rosenbrockCoop.exe 14 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 15 | 16 | 17 | # Add a test for this example 18 | message(STATUS " Add example test for COOPMads") 19 | 20 | if (WIN32) 21 | add_test(NAME ExampleAdvancedCOOPMads 22 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./rosenbrockCoop.exe 23 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 24 | ) 25 | else() 26 | add_test(NAME ExampleAdvancedCOOPMads 27 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./rosenbrockCoop.exe 28 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 29 | ) 30 | endif() 31 | 32 | -------------------------------------------------------------------------------- /examples/advanced/library/CustomCompForOrdering/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(customCompForOrdering.exe customCompForOrdering.cpp ) 2 | 3 | target_include_directories(customCompForOrdering.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(customCompForOrdering.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(customCompForOrdering.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(customCompForOrdering.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS customCompForOrdering.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/CustomOpportunistic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(customOpport.exe customOpport.cpp ) 2 | 3 | target_include_directories(customOpport.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(customOpport.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(customOpport.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(customOpport.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS customOpport.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/CustomPollMethod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(customPollMethod.exe customPollMethod.cpp ) 2 | 3 | target_include_directories(customPollMethod.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(customPollMethod.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(customPollMethod.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(customPollMethod.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS customPollMethod.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example 21 | -------------------------------------------------------------------------------- /examples/advanced/library/CustomSearchMethod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(customSearchMethod.exe customSearchMethod.cpp ) 2 | 3 | target_include_directories(customSearchMethod.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(customSearchMethod.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(customSearchMethod.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(customSearchMethod.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS customSearchMethod.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example 21 | -------------------------------------------------------------------------------- /examples/advanced/library/CustomStatSum/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(customStatSum.exe customStatSum.cpp ) 2 | 3 | target_include_directories(customStatSum.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(customStatSum.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(customStatSum.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(customStatSum.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS customStatSum.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/DiscoMads/EscapeDiscontinuities/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(DiscoMadsEscapeDiscont.exe DiscoMadsEscapeDiscont.cpp ) 2 | 3 | target_include_directories(DiscoMadsEscapeDiscont.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(DiscoMadsEscapeDiscont.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(DiscoMadsEscapeDiscont.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(DiscoMadsEscapeDiscont.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS DiscoMadsEscapeDiscont.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | # No test for this example 20 | -------------------------------------------------------------------------------- /examples/advanced/library/DiscoMads/EscapeHiddenConstraints/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(DiscoMadsEscapeHiddenConstraints.exe DiscoMadsEscapeHiddenConstraints.cpp ) 2 | 3 | target_include_directories(DiscoMadsEscapeHiddenConstraints.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(DiscoMadsEscapeHiddenConstraints.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(DiscoMadsEscapeHiddenConstraints.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(DiscoMadsEscapeHiddenConstraints.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS DiscoMadsEscapeHiddenConstraints.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/FixedVariable/.gitignore: -------------------------------------------------------------------------------- 1 | nomadtmp.* 2 | *.o 3 | *.exe 4 | cache.txt 5 | out* 6 | -------------------------------------------------------------------------------- /examples/advanced/library/FixedVariable/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(fixedVariable.exe fixedVariable.cpp ) 2 | add_executable(ufl.exe u.cpp ) 3 | 4 | target_include_directories(fixedVariable.exe PRIVATE 5 | ${CMAKE_SOURCE_DIR}/src) 6 | 7 | set_target_properties(fixedVariable.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 8 | set_target_properties(ufl.exe PROPERTIES SUFFIX "") 9 | 10 | 11 | if(OpenMP_CXX_FOUND) 12 | target_link_libraries(fixedVariable.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 13 | else() 14 | target_link_libraries(fixedVariable.exe PUBLIC nomadAlgos nomadUtils nomadEval) 15 | endif() 16 | 17 | # installing executables and libraries 18 | install(TARGETS fixedVariable.exe ufl.exe 19 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 20 | 21 | # Add a test for this example 22 | message(STATUS " Add example for fixed variables") 23 | 24 | if (WIN32) 25 | add_test(NAME ExampleAdvancedFixedVariables 26 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./fixedVariable.exe 27 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 28 | ) 29 | else() 30 | add_test(NAME ExampleAdvancedFixedVariables 31 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./fixedVariable.exe 32 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 33 | ) 34 | endif() 35 | -------------------------------------------------------------------------------- /examples/advanced/library/HandlingHiddenConstraints/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(handlingHiddenCons.exe handlingHiddenCons.cpp ) 2 | 3 | target_include_directories(handlingHiddenCons.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(handlingHiddenCons.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(handlingHiddenCons.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(handlingHiddenCons.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS handlingHiddenCons.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/NMonly/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.exe 3 | -------------------------------------------------------------------------------- /examples/advanced/library/NMonly/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(NMOpt.exe NMOpt.cpp ) 2 | 3 | target_include_directories(NMOpt.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(NMOpt.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(NMOpt.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(NMOpt.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS NMOpt.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/NestedOptim/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(nestedOptim.exe nestedOptim.cpp) 3 | 4 | target_include_directories(nestedOptim.exe PRIVATE 5 | ${CMAKE_SOURCE_DIR}/src) 6 | 7 | set_target_properties(nestedOptim.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 8 | 9 | target_link_libraries(nestedOptim.exe PUBLIC nomadAlgos nomadUtils nomadEval) 10 | 11 | # installing executables and libraries 12 | install(TARGETS nestedOptim.exe 13 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 14 | 15 | 16 | # Add a test for this example 17 | message(STATUS " Add example for nested optimization") 18 | 19 | if (WIN32) 20 | add_test(NAME ExampleAdvancedNestedMads 21 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./nestedOptim.exe 22 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 23 | ) 24 | else() 25 | add_test(NAME ExampleAdvancedNestedMads 26 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./nestedOptim.exe 27 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 28 | ) 29 | endif() 30 | -------------------------------------------------------------------------------- /examples/advanced/library/PSDMads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Example only for OPENMP build 2 | 3 | add_executable(rosenbrock.exe rosenbrock.cpp ) 4 | 5 | target_include_directories(rosenbrock.exe PRIVATE 6 | ${CMAKE_SOURCE_DIR}/src) 7 | 8 | set_target_properties(rosenbrock.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 9 | 10 | target_link_libraries(rosenbrock.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | 12 | # installing executables and libraries 13 | install(TARGETS rosenbrock.exe 14 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 15 | 16 | 17 | # Add a test for this example 18 | message(STATUS " Add example test for PSDMads") 19 | 20 | if (WIN32) 21 | add_test(NAME ExampleAdvancedPSDMads 22 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./rosenbrock.exe 23 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 24 | ) 25 | else() 26 | add_test(NAME ExampleAdvancedPSDMads 27 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./rosenbrock.exe 28 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 29 | ) 30 | endif() 31 | 32 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/SingleSuggestAndObserve/.gitignore: -------------------------------------------------------------------------------- 1 | cache.txt 2 | cache*.txt 3 | !cache0.txt 4 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/SingleSuggestAndObserve/cache0.txt: -------------------------------------------------------------------------------- 1 | BB_OUTPUT_TYPE OBJ 2 | ( -0.5 -1 1 ) EVAL_OK ( -0.5 ) 3 | ( -0.5 1 0.5 ) EVAL_OK ( 1 ) 4 | ( 0 0 1 ) EVAL_OK ( 3 ) 5 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/SingleSuggestAndObserve/runTestSingleSuggestAndObserve.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | import shutil 3 | 4 | def bb(x): 5 | out =[] 6 | for i in range(len(x)): 7 | f =[] 8 | f.append(sum( [ x[i][j] for j in range(len(x[i])) ] )) 9 | out.append(f) 10 | return out 11 | 12 | 13 | # copy cache file 14 | shutil.copyfile("cache0.txt","cache.txt") 15 | 16 | params = ["DISPLAY_DEGREE 2", "DIMENSION 3", "LOWER_BOUND ( -1 -1 -1 )", "UPPER_BOUND * 1", "BB_OUTPUT_TYPE OBJ", "CACHE_FILE cache.txt","MEGA_SEARCH_POLL yes" ] 17 | 18 | # Suggest candidates using Mads MegaSearchPoll (a cache file must be provided) 19 | print("Initial parameters:\n",params) 20 | candidates = PyNomad.suggest(params) 21 | 22 | # Eval candidates points 23 | evals=bb(candidates) 24 | print("Suggested candidates with evals:\n",candidates,evals) 25 | 26 | # Observe new evals -> update parameters and cache 27 | updatedParams = PyNomad.observe(params,candidates,evals,"cache1.txt") 28 | 29 | print("Update parameters:\n",updatedParams) 30 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/readme.txt: -------------------------------------------------------------------------------- 1 | # Project Title 2 | 3 | Simple examples to illustrate PyNomad utilization. 4 | 5 | ## Installation and limitations 6 | 7 | To run these examples, PyNomad must have been installed. Refer to the user guide or $NOMAD_HOME/README.txt for building PyNomad from source. PyNomad is also available from PyPi (pip install PyNomadBBO) for different OS and Python versions. 8 | 9 | PyNomad built for OSX using Clang does not support OpenMP. Example 'simpleExample_basic_parallelEval.py' will trigger an exception because the parameter 'NB_THREADS_PARALLEL_EVAL' is set to a value greater than one. 10 | This concern also the versions for OSX obtained from PyPi. 11 | 12 | For OSX, it is possible to build PyNomad using gcc which supports OpenMP. 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_BlockEval.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | import sys 3 | 4 | # This example is for a block, i.e., a vector of EvalPoints. 5 | # Evaluations may be conducted in parallel. The parallelism must be managed by the 6 | # user. 7 | # The blackbox output must be put in each EvalPoint passed as argument. 8 | def bb_block(block): 9 | nbPoints = block.size() 10 | evalOk = [False for i in range(nbPoints)] 11 | try: 12 | for k in range(nbPoints): 13 | # eval each point 14 | x = block.get_x(k) 15 | dim = x.size() 16 | f = sum([x.get_coord(i)**2 for i in range(dim)]) 17 | x.setBBO(str(f).encode("UTF-8")) 18 | evalOk[k] = True 19 | except Exception as e: 20 | print("Unexpected error in bb_block()", str(e)) 21 | return 0 22 | return evalOk # list where 1 is success, 0 is a failed evaluation 23 | 24 | x0 = [0.71, 0.51, 0.51] 25 | lb = [-1, -1, -1] 26 | ub=[] 27 | 28 | params = ["BB_OUTPUT_TYPE OBJ", "MAX_BB_EVAL 100", "UPPER_BOUND * 1"] 29 | params += ["DISPLAY_DEGREE 2", "DISPLAY_STATS BBE BLK_SIZE OBJ", "DISPLAY_ALL_EVAL false"] 30 | params += ["MEGA_SEARCH_POLL yes", "BB_MAX_BLOCK_SIZE 4"] 31 | 32 | result = PyNomad.optimize(bb_block, x0, lb, ub, params) 33 | 34 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 35 | output = "\n".join(fmt) 36 | print("\nNOMAD results \n" + output + " \n") 37 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_BlockEvalParallel.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | import sys 3 | 4 | from asyncio import gather, run 5 | 6 | 7 | # This example is for a block, i.e., a vector of EvalPoints, evaluated asynchronously. 8 | 9 | # Evaluation of a single point. 10 | async def bb_single(x): 11 | try: 12 | dim = x.size() 13 | f = sum([x.get_coord(i)**2 for i in range(dim)]) 14 | except Exception as e: 15 | print("Unexpected error in bb_single()", str(e)) 16 | return "Inf" 17 | return str(f) 18 | 19 | # The blackbox output must be put in each EvalPoint passed as argument (x.setBBO()). 20 | async def async_bb_block(block): 21 | nbPoints = block.size() 22 | evals = [] 23 | evalOk = [] 24 | for i in range(nbPoints): 25 | evalOk.append(False) 26 | xs = block.get_x(i) 27 | evals.append(bb_single(xs)) 28 | 29 | try: 30 | results = await gather(*evals) 31 | for k in range(nbPoints): 32 | x = block.get_x(k) 33 | x.setBBO(results[k].encode("UTF-8")) 34 | evalOk[k] = True 35 | except Exception as e: 36 | print("Unexpected error in async_bb_block()", str(e)) 37 | return 0 38 | return evalOk # list where 1 is success, 0 is a failed evaluation 39 | 40 | def sync_bb_block(block): 41 | result = run(async_bb_block(block)) 42 | return result 43 | 44 | 45 | x0 = [0.71, 0.51, 0.51] 46 | lb = [-1, -1, -1] 47 | ub=[] 48 | 49 | params = ["BB_OUTPUT_TYPE OBJ", "MAX_BB_EVAL 100", "UPPER_BOUND * 1", "DIRECTION_TYPE ORTHO N+1 NEG"] 50 | params += ["DISPLAY_DEGREE 2", "DISPLAY_STATS BBE BLK_SIZE OBJ", "DISPLAY_ALL_EVAL true"] 51 | params += ["MEGA_SEARCH_POLL yes", "BB_MAX_BLOCK_SIZE 4"] 52 | 53 | result = PyNomad.optimize(sync_bb_block, x0, lb, ub, params) 54 | 55 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 56 | output = "\n".join(fmt) 57 | print("\nNOMAD results \n" + output + " \n") 58 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_NMOptimization.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | 3 | # This example of blackbox function is for a single process 4 | # The blackbox output must be put in the EvalPoint passed as argument 5 | def bb(x): 6 | dim = x.size() 7 | f = sum([x.get_coord(i)**2 for i in range(dim)]) 8 | x.setBBO(str(f).encode("UTF-8")) 9 | return 1 # 1: success 0: failed evaluation 10 | 11 | x0 = [0.71, 0.51, 0.51] 12 | lb = [-1, -1, -1] 13 | ub=[] 14 | 15 | params = ["BB_OUTPUT_TYPE OBJ", "MAX_BB_EVAL 100","NM_OPTIMIZATION yes", "UPPER_BOUND * 1", "DISPLAY_DEGREE 2", "DISPLAY_ALL_EVAL false", "DISPLAY_STATS BBE OBJ"] 16 | 17 | result = PyNomad.optimize(bb, x0, lb, ub, params) 18 | 19 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 20 | output = "\n".join(fmt) 21 | print("\nNOMAD results \n" + output + " \n") 22 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_PbMultiObj.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | import sys 3 | 4 | # This example of blackbox function is for a single process 5 | # The blackbox output must be put in the EvalPoint passed as argument 6 | def bb(x): 7 | try: 8 | x0 = x.get_coord(0) 9 | x1 = x.get_coord(1) 10 | f1 = (x0-1.0)*(x0-1.0)+(x0-x1)*(x0-x1) 11 | f2 = (x0-x1) * (x0-x1) + (x1-3) * (x1-3) 12 | rawBBO = str(f1) + " " + str(f2) 13 | x.setBBO(rawBBO.encode("UTF-8")) 14 | except: 15 | print("Unexpected eval error", sys.exc_info()[0]) 16 | return 0 17 | return 1 # 1: success 0: failed evaluation 18 | 19 | X0 = [0, 0] 20 | params = ["DIMENSION 2","BB_OUTPUT_TYPE OBJ OBJ", "DMULTIMADS_OPTIMIZATION yes", "DIRECTION_TYPE ORTHO 2N", "MAX_BB_EVAL 400", "X0 * 2.0" , "LOWER_BOUND * -1" ,"UPPER_BOUND * 5" , "DISPLAY_DEGREE 2", "SOLUTION_FILE SOL.txt"] 21 | 22 | # NOTES: 23 | # Result returned by PyNomad.optimize() return a single point 24 | # Solution file contains pareto points 25 | 26 | result = PyNomad.optimize(bb, X0, [] , [], params) 27 | 28 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 29 | output = "\n".join(fmt) 30 | print("\nNOMAD results \n" + output + " \n") 31 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_PbWithConst.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | import sys 3 | 4 | # This example of blackbox function is for a single process 5 | # The blackbox output must be put in the EvalPoint passed as argument 6 | def bb(x): 7 | try: 8 | dim = x.size() 9 | f = x.get_coord(4) 10 | g1 = sum([(x.get_coord(i)-1)**2 for i in range(dim)])-25 11 | g2 = 25-sum([(x.get_coord(i)+1)**2 for i in range(dim)]) 12 | rawBBO = str(f) + " " + str(g1) + " " + str(g2) 13 | x.setBBO(rawBBO.encode("UTF-8")) 14 | except: 15 | print("Unexpected eval error", sys.exc_info()[0]) 16 | return 0 17 | return 1 # 1: success 0: failed evaluation 18 | 19 | X0 = [0, 0, 0, 0, 0] 20 | params = ["DIMENSION 5","BB_OUTPUT_TYPE OBJ EB EB", "MAX_BB_EVAL 100", "X0 * 0" , "LOWER_BOUND * -6" , "DISPLAY_DEGREE 2", "DISPLAY_ALL_EVAL false", "DISPLAY_STATS BBE OBJ"] 21 | 22 | result = PyNomad.optimize(bb, X0, [] , [], params) 23 | 24 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 25 | output = "\n".join(fmt) 26 | print("\nNOMAD results \n" + output + " \n") 27 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_WithSurrogate.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | import sys 3 | 4 | # This example of blackbox function is for a single process 5 | # The blackbox output must be put in the EvalPoint passed as argument 6 | def bb(x): 7 | try: 8 | dim = x.size() 9 | f = x.get_coord(4) 10 | g1 = sum([(x.get_coord(i)-1)**2 for i in range(dim)])-25 11 | g2 = 25-sum([(x.get_coord(i)+1)**2 for i in range(dim)]) 12 | rawBBO = str(f) + " " + str(g1) + " " + str(g2) 13 | x.setBBO(rawBBO.encode("UTF-8")) 14 | except: 15 | print("Unexpected eval error", sys.exc_info()[0]) 16 | return 0 17 | return 1 # 1: success 0: failed evaluation 18 | 19 | def surrogate(x): 20 | try: 21 | dim = x.size() 22 | f = x.get_coord(4) 23 | g1 = (x.get_coord(0)-1)**2 + (x.get_coord(1)-1)**2-15 24 | g2 = 15-(x.get_coord(0)+1)**2+(x.get_coord(1)+1)**2 25 | rawBBO = str(f) + " " + str(g1) + " " + str(g2) 26 | x.setBBO(rawBBO.encode("UTF-8")) 27 | except: 28 | print("Unexpected eval error", sys.exc_info()[0]) 29 | return 0 30 | return 1 # 1: success 0: failed evaluation 31 | 32 | X0 = [0, 0, 0, 0, 0] 33 | params = ["DIMENSION 5","BB_OUTPUT_TYPE OBJ EB EB", "MAX_BB_EVAL 100", "EVAL_QUEUE_SORT SURROGATE", "X0 * 0" , "LOWER_BOUND * -6" , "DISPLAY_DEGREE 2", "DISPLAY_ALL_EVAL false", "DISPLAY_STATS BBE OBJ CONS_H"] 34 | 35 | result = PyNomad.optimize(bb, X0, [] , [], params, surrogate) 36 | 37 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 38 | output = "\n".join(fmt) 39 | print("\nNOMAD results \n" + output + " \n") 40 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_WithSurrogateAndVNS.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | import sys 3 | 4 | # This example of blackbox function is for a single process 5 | # The blackbox output must be put in the EvalPoint passed as argument 6 | def bb(x): 7 | try: 8 | dim = x.size() 9 | f = x.get_coord(4) 10 | g1 = sum([(x.get_coord(i)-1)**2 for i in range(dim)])-25 11 | g2 = 25-sum([(x.get_coord(i)+1)**2 for i in range(dim)]) 12 | rawBBO = str(f) + " " + str(g1) + " " + str(g2) 13 | x.setBBO(rawBBO.encode("UTF-8")) 14 | except: 15 | print("Unexpected eval error", sys.exc_info()[0]) 16 | return 0 17 | return 1 # 1: success 0: failed evaluation 18 | 19 | def surrogate(x): 20 | try: 21 | dim = x.size() 22 | f = x.get_coord(4) 23 | g1 = (x.get_coord(0)-1)**2 + (x.get_coord(1)-1)**2-15 24 | g2 = 15-(x.get_coord(0)+1)**2+(x.get_coord(1)+1)**2 25 | rawBBO = str(f) + " " + str(g1) + " " + str(g2) 26 | x.setBBO(rawBBO.encode("UTF-8")) 27 | except: 28 | print("Unexpected eval error", sys.exc_info()[0]) 29 | return 0 30 | return 1 # 1: success 0: failed evaluation 31 | 32 | X0 = [0, 0, 0, 0, 0] 33 | params = ["DIMENSION 5","BB_OUTPUT_TYPE OBJ EB EB", "MAX_BB_EVAL 100", "EVAL_QUEUE_SORT SURROGATE", "X0 * 0" , "LOWER_BOUND * -6" , "DISPLAY_DEGREE 2", "DISPLAY_ALL_EVAL false", "DISPLAY_STATS BBE OBJ CONS_H", "VNS_MADS_SEARCH_WITH_SURROGATE true"] 34 | 35 | result = PyNomad.optimize(bb, X0, [] , [], params, surrogate) 36 | 37 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 38 | output = "\n".join(fmt) 39 | print("\nNOMAD results \n" + output + " \n") 40 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_basic.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | 3 | # This example of blackbox function is for a single process 4 | # The blackbox output must be put in the EvalPoint passed as argument 5 | def bb(x): 6 | dim = x.size() 7 | f = sum([x.get_coord(i)**2 for i in range(dim)]) 8 | x.setBBO(str(f).encode("UTF-8")) 9 | return 1 # 1: success 0: failed evaluation 10 | 11 | x0 = [0.71, 0.51, 0.51] 12 | lb = [-1, -1, -1] 13 | ub=[] 14 | 15 | params = ["BB_OUTPUT_TYPE OBJ", "MAX_BB_EVAL 100", "UPPER_BOUND * 1", "DISPLAY_DEGREE 2", "DISPLAY_ALL_EVAL false", "DISPLAY_STATS BBE OBJ"] 16 | 17 | result = PyNomad.optimize(bb, x0, lb, ub, params) 18 | 19 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 20 | output = "\n".join(fmt) 21 | print("\nNOMAD results \n" + output + " \n") 22 | -------------------------------------------------------------------------------- /examples/advanced/library/PyNomad/simpleExample_basic_parallelEval.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | 3 | # This example of blackbox function is for a single process 4 | # The blackbox output must be put in the EvalPoint passed as argument 5 | 6 | # Nomad parallel bb evaluations 7 | 8 | def bb(x): 9 | dim = x.size() 10 | f = sum([x.get_coord(i)**2 for i in range(dim)]) 11 | x.setBBO(str(f).encode("UTF-8")) 12 | 13 | return 1 # 1: success 0: failed evaluation 14 | 15 | x0 = [0.71, 0.51, 0.51] 16 | lb = [-1, -1, -1] 17 | ub=[] 18 | 19 | params = ["BB_OUTPUT_TYPE OBJ", "MAX_BB_EVAL 100", "UPPER_BOUND * 1","DIRECTION_TYPE ORTHO 2n", "DISPLAY_DEGREE 2", "DISPLAY_ALL_EVAL true", "DISPLAY_STATS THREAD_NUM BBE OBJ","NB_THREADS_PARALLEL_EVAL 4"] 20 | 21 | result = PyNomad.optimize(bb, x0, lb, ub, params) 22 | 23 | fmt = ["{} = {}".format(n,v) for (n,v) in result.items()] 24 | output = "\n".join(fmt) 25 | print("\nNOMAD results \n" + output + " \n") 26 | -------------------------------------------------------------------------------- /examples/advanced/library/Restart/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(restart.exe restart.cpp ) 2 | 3 | target_include_directories(restart.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(restart.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(restart.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(restart.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS restart.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example 21 | -------------------------------------------------------------------------------- /examples/advanced/library/StopIfBBFails/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(stopIfBBFails.exe stopIfBBFails.cpp ) 2 | 3 | target_include_directories(stopIfBBFails.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(stopIfBBFails.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(stopIfBBFails.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(stopIfBBFails.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS stopIfBBFails.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/StopOnConsecutiveFails/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(stopOnConsecutiveFails.exe stopOnConsecutiveFails.cpp ) 2 | 3 | target_include_directories(stopOnConsecutiveFails.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(stopOnConsecutiveFails.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(stopOnConsecutiveFails.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(stopOnConsecutiveFails.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS stopOnConsecutiveFails.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/c_api/example1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(example1_c_api.exe example1_c_api.c ) 2 | 3 | target_include_directories( 4 | example1_c_api.exe 5 | PRIVATE 6 | ${CMAKE_SOURCE_DIR}/src 7 | ${CMAKE_SOURCE_DIR}/interfaces/CInterface 8 | ) 9 | 10 | set_target_properties( 11 | example1_c_api.exe 12 | PROPERTIES 13 | INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" 14 | SUFFIX "" 15 | ) 16 | 17 | 18 | if(OpenMP_CXX_FOUND) 19 | target_link_libraries( 20 | example1_c_api.exe 21 | PUBLIC 22 | nomadCInterface 23 | OpenMP::OpenMP_CXX 24 | ) 25 | else() 26 | target_link_libraries( 27 | example1_c_api.exe 28 | PUBLIC nomadCInterface 29 | ) 30 | endif() 31 | 32 | if (NOT WIN32) 33 | target_link_libraries( 34 | example1_c_api.exe 35 | PUBLIC m 36 | ) 37 | endif() 38 | 39 | # installing executables and libraries 40 | install(TARGETS example1_c_api.exe 41 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 42 | 43 | # Add a test for this example 44 | message(STATUS " Add example test for c-api 1") 45 | 46 | # Can run this test after install 47 | 48 | if (WIN32) 49 | # MAYBE ENABLE the test when script is adapted to windows 50 | # add_test(NAME ExampleAdvancedC-API1 51 | # COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./example1_c_api.exe 52 | # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 53 | # ) 54 | else() 55 | add_test(NAME ExampleAdvancedC-API1 56 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./example1_c_api.exe 57 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 58 | ) 59 | endif() 60 | -------------------------------------------------------------------------------- /examples/advanced/library/c_api/example2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(example2_c_api.exe example2_c_api.c ) 2 | 3 | target_include_directories( 4 | example2_c_api.exe 5 | PRIVATE 6 | ${CMAKE_SOURCE_DIR}/src 7 | ${CMAKE_SOURCE_DIR}/interfaces/CInterface 8 | ) 9 | 10 | set_target_properties( 11 | example2_c_api.exe 12 | PROPERTIES 13 | INSTALL_RPATH 14 | "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" 15 | SUFFIX "" 16 | ) 17 | 18 | 19 | if(OpenMP_CXX_FOUND) 20 | target_link_libraries( 21 | example2_c_api.exe 22 | PUBLIC 23 | nomadCInterface 24 | OpenMP::OpenMP_CXX 25 | ) 26 | else() 27 | target_link_libraries( 28 | example2_c_api.exe 29 | PUBLIC nomadCInterface 30 | ) 31 | endif() 32 | 33 | if (NOT WIN32) 34 | target_link_libraries( 35 | example2_c_api.exe 36 | PUBLIC m 37 | ) 38 | endif() 39 | 40 | # installing executables and libraries 41 | install(TARGETS example2_c_api.exe 42 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 43 | 44 | 45 | # No test for this example -------------------------------------------------------------------------------- /examples/advanced/library/c_api/example3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(example3_c_api.exe example3_c_api.c) 2 | 3 | target_include_directories( 4 | example3_c_api.exe 5 | PRIVATE 6 | ${CMAKE_SOURCE_DIR}/src 7 | ${CMAKE_SOURCE_DIR}/interfaces/CInterface 8 | ) 9 | 10 | set_target_properties( 11 | example3_c_api.exe 12 | PROPERTIES 13 | INSTALL_RPATH 14 | "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" 15 | SUFFIX "" 16 | ) 17 | 18 | 19 | if(OpenMP_CXX_FOUND) 20 | target_link_libraries( 21 | example3_c_api.exe 22 | PUBLIC 23 | nomadCInterface 24 | OpenMP::OpenMP_CXX 25 | ) 26 | else() 27 | target_link_libraries( 28 | example3_c_api.exe 29 | PUBLIC nomadCInterface 30 | ) 31 | endif() 32 | 33 | if (NOT WIN32) 34 | target_link_libraries( 35 | example3_c_api.exe 36 | PUBLIC m 37 | ) 38 | endif() 39 | 40 | # installing executables and libraries 41 | install(TARGETS example3_c_api.exe 42 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 43 | 44 | 45 | # No test for this example 46 | -------------------------------------------------------------------------------- /examples/advanced/library/exampleSuggestAndObserve/.gitignore: -------------------------------------------------------------------------------- 1 | cache*.txt 2 | !cache0.txt 3 | -------------------------------------------------------------------------------- /examples/advanced/library/exampleSuggestAndObserve/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(suggestAndObserve.exe suggestAndObserve.cpp ) 2 | add_executable(loopSuggestAndObserve.exe loopSuggestAndObserve.cpp ) 3 | 4 | target_include_directories(suggestAndObserve.exe PRIVATE 5 | ${CMAKE_SOURCE_DIR}/src) 6 | target_include_directories(loopSuggestAndObserve.exe PRIVATE 7 | ${CMAKE_SOURCE_DIR}/src) 8 | 9 | 10 | set_target_properties(suggestAndObserve.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 11 | set_target_properties(loopSuggestAndObserve.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 12 | 13 | 14 | if(OpenMP_CXX_FOUND) 15 | target_link_libraries(suggestAndObserve.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 16 | target_link_libraries(loopSuggestAndObserve.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 17 | else() 18 | target_link_libraries(suggestAndObserve.exe PUBLIC nomadAlgos nomadUtils nomadEval) 19 | target_link_libraries(loopSuggestAndObserve.exe PUBLIC nomadAlgos nomadUtils nomadEval) 20 | endif() 21 | 22 | # installing executables and libraries 23 | install(TARGETS suggestAndObserve.exe 24 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 25 | install(TARGETS loopSuggestAndObserve.exe 26 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 27 | 28 | # Add a test for this example 29 | message(STATUS " Add example library tests using Suggest And Observe") 30 | 31 | # Can run this test after install 32 | if (WIN32) 33 | add_test(NAME ExampleAdvancedSuggestAndObserve 34 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./suggestAndObserve.exe 35 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 36 | add_test(NAME ExampleAdvancedLoopSuggestAndObserve 37 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./loopSuggestAndObserve.exe 38 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 39 | else() 40 | add_test(NAME ExampleAdvancedSuggestAndObserve 41 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./suggestAndObserve.exe 42 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 43 | add_test(NAME ExampleAdvancedLoopSuggestAndObserve 44 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./loopSuggestAndObserve.exe 45 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 46 | endif() 47 | 48 | -------------------------------------------------------------------------------- /examples/advanced/library/exampleSuggestAndObserve/cache0.txt: -------------------------------------------------------------------------------- 1 | BB_OUTPUT_TYPE OBJ 2 | ( 0.4 0.1 ) EVAL_OK ( 0.72 ) 3 | ( 0.4 0.2 ) EVAL_OK ( 0.52 ) 4 | ( 0.4 0.3 ) EVAL_OK ( 2.32 ) 5 | ( 0.4 0.4 ) EVAL_OK ( 6.12 ) 6 | ( 0.4 0.6 ) EVAL_OK ( 19.72 ) 7 | ( 0.5 0.3 ) EVAL_OK ( 0.5 ) 8 | ( 0.5 0.5 ) EVAL_OK ( 6.5 ) 9 | -------------------------------------------------------------------------------- /examples/basic/batch/MatlabBB/README.txt: -------------------------------------------------------------------------------- 1 | % WARNING: The command to run matlab in batch mode may vary with Matlab version and OS. 2 | % The given bat (bb.bat) command has been tested with Matlab 2021b on Windows. 3 | % - To make sure the command works properly with your Matlab version, start a Windows shell command terminal. 4 | % - Go into the directory of this example 5 | % - Test the following command: bb.bat X0.txt 6 | % - Matlab should start in background and run the 'fun.m' function. 7 | % - The command should only display '4 -10 -30', that is the objective and constraints values for X0. 8 | % - When the blackbox Matlab command is working you can run Nomad on it. 9 | % 10 | % The given shell script command (bb.sh) has been tested with Matlab 2022a on OSX and Linux 11 | % - To test the command, go into the directory of this example 12 | % - Run the command: ./bb.sh X0.txt 13 | % - Matlab should start in background and run the 'fun.m' function. 14 | % - The command should only display '4 -10 -30', that is the objective and constraints values for X0. 15 | -------------------------------------------------------------------------------- /examples/basic/batch/MatlabBB/X0.txt: -------------------------------------------------------------------------------- 1 | 0 1 2 3 4 2 | -------------------------------------------------------------------------------- /examples/basic/batch/MatlabBB/bb.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @copy %1 inputMatlab.txt >NUL 3 | matlab -nojvm -batch "run('fun'); exit" 4 | -------------------------------------------------------------------------------- /examples/basic/batch/MatlabBB/bb.sh: -------------------------------------------------------------------------------- 1 | cp $1 inputMatlab.txt 2 | matlab -batch "run('fun'); exit" 3 | -------------------------------------------------------------------------------- /examples/basic/batch/MatlabBB/fun.m: -------------------------------------------------------------------------------- 1 | 2 | % CRESCENT 5 3 | 4 | X = load('inputMatlab.txt'); 5 | 6 | n=size(X,2); 7 | 8 | if ( n ~= 5) 9 | error('Black box function must be provided with points of dimension 5 (=number of columns)'); 10 | end 11 | 12 | % objective 13 | obj=X(5); 14 | % constraints 15 | c1=sum((X(:)-1).^2)-25; 16 | c2=25-sum((X(:)+1).^2); 17 | 18 | disp([obj c1 c2]); 19 | 20 | -------------------------------------------------------------------------------- /examples/basic/batch/MatlabBB/inputMatlab.txt: -------------------------------------------------------------------------------- 1 | 0 -3 -2 2 -1 2 | -------------------------------------------------------------------------------- /examples/basic/batch/MatlabBB/paramNomad.txt: -------------------------------------------------------------------------------- 1 | dimension 5 2 | 3 | % WARNING: The command to run matlab in batch mode may vary with Matlab version and OS. 4 | % The given bat (bb.bat) command has been tested with Matlab 2021b on Windows. 5 | % - To make sure the command works properly with your Matlab version, start a Windows shell command terminal. 6 | % - Go into the directory of this example 7 | % - Test the following command: bb.bat X0.txt 8 | % - Matlab should start in background and run the 'fun.m' function. 9 | % - The command should display '4 -10 -30', that is the objective and constraints values for X0. 10 | % - When the blackbox Matlab command is working you can run Nomad on it. 11 | % 12 | % The given shell script command (bb.sh) has been tested with Matlab 2022a on OSX and Linux 13 | % - To test the command, go into the directory of this example 14 | % - Run the command: ./bb.sh X0.txt 15 | %. - The command should display '4 -10 -30', that is the objective and constraints values for X0. 16 | 17 | # bb_exe bb.sh # for linux/osx 18 | bb_exe bb.bat # for windows is a cmd prompt windows 19 | 20 | 21 | 22 | X0 ( 0 0 0 0 0 ) 23 | LOWER_BOUND * -6 24 | UPPER_BOUND * 6 25 | 26 | display_degree 2 27 | display_stats BBE ( SOL ) BBO 28 | display_all_eval yes 29 | 30 | max_bb_eval 5 31 | 32 | bb_output_type OBJ PB PB 33 | -------------------------------------------------------------------------------- /examples/basic/batch/PythonBB/bb.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import re 4 | input_file_name=sys.argv[1] 5 | with open(input_file_name,'r') as openfile: 6 | line = openfile.read().strip() 7 | X = re.sub(r'\s+',' ',line).strip().split() 8 | openfile.close() 9 | 10 | # Standard output is grabbed by Nomad evaluator 11 | dim = 5 12 | f = float(X[4]) 13 | g1 = sum([(float(X[i])-1)**2 for i in range(dim)])-25 14 | g2 = 25-sum([(float(X[i])+1)**2 for i in range(dim)]) 15 | print(f,g1,g2) 16 | -------------------------------------------------------------------------------- /examples/basic/batch/PythonBB/param.txt: -------------------------------------------------------------------------------- 1 | DIMENSION 5 2 | 3 | BB_EXE '$python3 bb.py ' 4 | BB_OUTPUT_TYPE OBJ PB EB 5 | 6 | X0 ( 0 0 0 0 0 ) 7 | 8 | LOWER_BOUND * -6.0 9 | UPPER_BOUND ( 5 6 7 - - ) 10 | 11 | 12 | MAX_BB_EVAL 100 13 | DISPLAY_DEGREE 2 14 | DISPLAY_ALL_EVAL yes 15 | 16 | DISPLAY_STATS BBE ( SOL ) OBJ 17 | -------------------------------------------------------------------------------- /examples/basic/batch/example1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bb1.exe bb.cpp ) 3 | set_target_properties(bb1.exe PROPERTIES SUFFIX "") 4 | 5 | # installing executables and libraries 6 | install(TARGETS bb1.exe 7 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | 10 | # Add a test for this example 11 | message(STATUS " Add example batch #1") 12 | 13 | # Test run in working directory AFTER install of bb1.exe executable 14 | add_test(NAME Example1BasicBatch 15 | COMMAND ${CMAKE_INSTALL_PREFIX}/bin/nomad param.txt 16 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 17 | -------------------------------------------------------------------------------- /examples/basic/batch/example1/param.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 10 7 | 8 | # Black box 9 | BB_EXE bb1.exe 10 | BB_OUTPUT_TYPE OBJ PB PB EB 11 | 12 | # Starting point 13 | X0 ( 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 ) 14 | 15 | # Bounds are useful to avoid extreme values 16 | LOWER_BOUND * -20.0 17 | UPPER_BOUND * 20.0 18 | 19 | # Some variables must be multiple of 1, others of 0.5 20 | GRANULARITY ( 1 1 0.5 1 1 1 1 0.5 1 1 ) 21 | 22 | 23 | # ALGORITHM PARAMETERS 24 | ###################### 25 | 26 | # The algorithm terminates after that number black-box evaluations 27 | MAX_BB_EVAL 1000 28 | 29 | # The algorithm terminates after that total number of evaluations, 30 | # including cache hits 31 | MAX_EVAL 200 32 | 33 | # Formatted stats into a file 34 | #STATS_FILE stats.txt BBE SOL OBJ 35 | 36 | # History file (just inputs and outputs) 37 | #HISTORY_FILE history.txt 38 | 39 | # Solution file (just best inputs found) 40 | #SOLUTION_FILE sol.txt 41 | 42 | -------------------------------------------------------------------------------- /examples/basic/batch/example1/param_LH.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 10 7 | 8 | # Black box 9 | BB_EXE bb1.exe 10 | BB_OUTPUT_TYPE OBJ PB PB PB 11 | 12 | # Starting point 13 | # X0 ( 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 ) 14 | 15 | # Bounds for variables 16 | LOWER_BOUND * -10 17 | UPPER_BOUND * 20 18 | 19 | # All variables must be multiple of 0.0001 20 | GRANULARITY * 0.0001 21 | 22 | 23 | # ALGORITHM PARAMETERS 24 | ###################### 25 | 26 | # The algorithm terminates after that number black-box evaluations 27 | MAX_BB_EVAL 1000 28 | 29 | # The algorithm terminates after that total number of evaluations, 30 | # including cache hits 31 | MAX_EVAL 1100 32 | 33 | # Latin Hypercube Search parameters 34 | LH_SEARCH 100 10 35 | 36 | 37 | # DISPLAY PARAMETERS 38 | #################### 39 | DISPLAY_DEGREE 2 40 | DISPLAY_INFEASIBLE true 41 | DISPLAY_STATS BBE EVAL ( SOL ) OBJ CONS_H H_MAX 42 | #STATS_FILE stats.txt BBE SOL OBJ 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/basic/batch/example1/param_LH_ONLY.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 10 7 | 8 | # Black box 9 | BB_EXE bb1.exe 10 | BB_OUTPUT_TYPE OBJ PB PB EB 11 | 12 | # Starting point 13 | X0 ( 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 ) 14 | 15 | LOWER_BOUND * 0.0 16 | UPPER_BOUND * 10.0 17 | 18 | 19 | # ALGORITHM PARAMETERS 20 | ###################### 21 | 22 | LH_EVAL 10 # Enabling LH eval disables default Mads optimization 23 | 24 | # Parameters for display 25 | DISPLAY_DEGREE 3 26 | DISPLAY_STATS BBE ( SOL ) OBJ 27 | 28 | -------------------------------------------------------------------------------- /examples/basic/batch/example1/param_NM.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 10 7 | 8 | # Black box 9 | BB_EXE bb1.exe 10 | BB_OUTPUT_TYPE OBJ PB PB PB 11 | 12 | # Starting point 13 | X0 ( 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 ) 14 | 15 | 16 | # ALGORITHM PARAMETERS 17 | ###################### 18 | 19 | # Use Nelder Mead algorithm, not Mads, to solve this problem 20 | NM_OPTIMIZATION true 21 | 22 | # The algorithm terminates after that number black-box evaluations 23 | MAX_BB_EVAL 1000 24 | 25 | 26 | # DISPLAY PARAMETERS 27 | #################### 28 | # Show more info - display degree = 3 29 | DISPLAY_STATS BBE ( SOL ) OBJ CONS_H 30 | #STATS_FILE stats.txt BBE SOL OBJ 31 | 32 | -------------------------------------------------------------------------------- /examples/basic/batch/example1/param_parallelEval.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 10 7 | 8 | # Black box 9 | BB_EXE bb1.exe 10 | BB_OUTPUT_TYPE OBJ PB PB EB 11 | 12 | # Starting point 13 | X0 ( 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 ) 14 | 15 | # Bounds are useful to avoid extreme values 16 | LOWER_BOUND * -20.0 17 | UPPER_BOUND * 20.0 18 | 19 | 20 | 21 | # ALGORITHM PARAMETERS 22 | ###################### 23 | 24 | # The algorithm terminates after that number black-box evaluations 25 | MAX_BB_EVAL 1000 26 | 27 | # The algorithm terminates after that total number of evaluations, 28 | # including cache hits 29 | MAX_EVAL 200 30 | 31 | # Number of threads managed by Nomad for parallel evaluations 32 | NB_THREADS_PARALLEL_EVAL 4 33 | 34 | # Formatted stats into a file 35 | #STATS_FILE stats.txt BBE SOL OBJ 36 | 37 | # History file (just inputs and outputs) 38 | #HISTORY_FILE history.txt 39 | 40 | # Solution file (just best inputs found) 41 | #SOLUTION_FILE sol.txt 42 | 43 | DISPLAY_STATS BBE THREAD_NUM ( SOL ) OBJ CONS_H # Display the number of evaluation (BBE), 44 | # the thread number, the current solution ( SOL ) and the objective 45 | 46 | -------------------------------------------------------------------------------- /examples/basic/batch/example1/x0.txt: -------------------------------------------------------------------------------- 1 | 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 2 | -------------------------------------------------------------------------------- /examples/basic/batch/example2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bb2.exe bb.cpp ) 3 | set_target_properties(bb2.exe PROPERTIES SUFFIX "") 4 | 5 | # installing executables and libraries 6 | install(TARGETS bb2.exe 7 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | # Add a test for this example 10 | message(STATUS " Add example batch #2") 11 | 12 | # Test run in working directory AFTER install of bb executable 13 | add_test(NAME Example2BasicBatch 14 | COMMAND ${CMAKE_INSTALL_PREFIX}/bin/nomad param.txt 15 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 16 | -------------------------------------------------------------------------------- /examples/basic/batch/example2/param.txt: -------------------------------------------------------------------------------- 1 | 2 | # PROBLEM PARAMETERS 3 | #################### 4 | 5 | # Number of variables 6 | DIMENSION 5 7 | 8 | # Black box 9 | BB_EXE bb2.exe 10 | BB_OUTPUT_TYPE OBJ PB EB 11 | 12 | # Starting point 13 | X0 ( 5.0 5.0 5.0 5.0 5.0 ) 14 | 15 | # Some variables are integer, others are multiple of 0.5 16 | GRANULARITY ( 1 1 0.5 1 0.5 ) 17 | 18 | 19 | # ALGORITHM PARAMETERS 20 | ###################### 21 | 22 | # The algorithm terminates after that number black-box evaluations 23 | MAX_BB_EVAL 1000 24 | 25 | MEGA_SEARCH_POLL true # Generate search and poll steps trial points before starting evaluation 26 | 27 | NB_THREADS_PARALLEL_EVAL 4 # Number of threads to perform blackbox evaluation 28 | # This requires to have Nomad built with OpenMP (see $NOMAD_HOME/README.txt) 29 | # With this parameter, the default thread number (1) is replaced. 30 | 31 | # The algorithm terminates after that total number of evaluations, 32 | # including cache hits 33 | MAX_EVAL 200 34 | 35 | # DISPLAY PARAMETERS 36 | #################### 37 | DISPLAY_DEGREE 2 38 | DISPLAY_ALL_EVAL 1 39 | DISPLAY_STATS BBE THREAD_NUM ( SOL ) OBJ 40 | #STATS_FILE stats.txt BBE SOL OBJ 41 | 42 | -------------------------------------------------------------------------------- /examples/basic/batch/example2/x0.txt: -------------------------------------------------------------------------------- 1 | 0 0 0 0 0 2 | -------------------------------------------------------------------------------- /examples/basic/batch/multi_obj/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bbMO.exe bb.cpp ) 3 | set_target_properties(bbMO.exe PROPERTIES SUFFIX "") 4 | 5 | 6 | # installing executables and libraries 7 | install(TARGETS bbMO.exe 8 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 9 | 10 | # Add a test for this example 11 | message(STATUS " Add example batch multi_obj") 12 | 13 | # Test run in working directory AFTER install of bb.exe executable 14 | add_test(NAME ExampleMultiObjBasicBatch 15 | COMMAND ${CMAKE_INSTALL_PREFIX}/bin/nomad param.txt 16 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 17 | -------------------------------------------------------------------------------- /examples/basic/batch/multi_obj/param.txt: -------------------------------------------------------------------------------- 1 | DIMENSION 2 # number of variables 2 | 3 | 4 | BB_EXE bbMO.exe # 'bbMO.exe' is a program that 5 | BB_OUTPUT_TYPE OBJ OBJ # takes in argument the name of 6 | # a text file containing 2 7 | # values, and that displays 2 8 | # values that correspond to the 9 | # objective function value (OBJ), 10 | 11 | X0 ( 2 2 ) # starting point 12 | 13 | LOWER_BOUND * -1 # all variables are >= -1 14 | UPPER_BOUND * 5 # all variables are <= 5 15 | 16 | MAX_BB_EVAL 400 # the algorithm terminates when 17 | # 100 black-box evaluations have 18 | # been made 19 | 20 | # DMultiMads is enabled (default Mads is disabled) 21 | DMULTIMADS_OPTIMIZATION yes 22 | 23 | # For multiobjctive, sort should not use the default quad model info 24 | EVAL_QUEUE_SORT DIR_LAST_SUCCESS 25 | 26 | # Let's deactivate all default search methods except NM (prototype) 27 | # and do ORTHO 2n for more intense poll (default is n+1) 28 | DIRECTION_TYPE ORTHO 2n 29 | QUAD_MODEL_SEARCH no 30 | SPECULATIVE_SEARCH no 31 | DMULTIMADS_NM_STRATEGY MULTI 32 | 33 | DISPLAY_DEGREE 2 34 | DISPLAY_ALL_EVAL yes 35 | DISPLAY_STATS BBE ( SOL ) BBO # Display the number of evaluation (BBE), 36 | # the current points ( SOL ) and the blackbox outputs 37 | 38 | SOLUTION_FILE sol.txt # Write the approximated Pareto points 39 | # in a solution file 40 | 41 | SOLUTION_FILE_FINAL true # Write the solution file only once at the end 42 | 43 | # HISTORY_FILE history.txt 44 | -------------------------------------------------------------------------------- /examples/basic/batch/multi_obj/x.txt: -------------------------------------------------------------------------------- 1 | 2.0 2.0 2 | -------------------------------------------------------------------------------- /examples/basic/batch/multi_obj2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bbMO2.exe bb.cpp ) 3 | set_target_properties(bbMO2.exe PROPERTIES SUFFIX "") 4 | 5 | 6 | # installing executables and libraries 7 | install(TARGETS bbMO2.exe 8 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 9 | 10 | # No test for this example -------------------------------------------------------------------------------- /examples/basic/batch/multi_obj2/param.txt: -------------------------------------------------------------------------------- 1 | DIMENSION 3 # number of variables 2 | 3 | 4 | BB_EXE bbMO2.exe 5 | BB_OUTPUT_TYPE OBJ OBJ 6 | 7 | X0 ( 0 0 0 ) # starting point 8 | 9 | LOWER_BOUND * -5 10 | UPPER_BOUND * 5 11 | 12 | MAX_BB_EVAL 1000 13 | 14 | # DMultiMads is enabled (default Mads is disabled) 15 | DMULTIMADS_OPTIMIZATION yes 16 | 17 | # For multiobjctive, sort should not use the default quad model info 18 | EVAL_QUEUE_SORT DIR_LAST_SUCCESS 19 | 20 | # Let's deactivate all default search methods 21 | # and do ORTHO n+1 Neg (Neg is for disabling quad model (n+1)th direction) 22 | DIRECTION_TYPE ORTHO n+1 neg 23 | QUAD_MODEL_SEARCH no 24 | NM_SEARCH no 25 | SPECULATIVE_SEARCH no 26 | 27 | DISPLAY_DEGREE 2 28 | DISPLAY_STATS BBE ( SOL ) BBO # Display the number of evaluation (BBE), 29 | # the current solution ( SOL ) and the objectives 30 | 31 | 32 | SOLUTION_FILE sol.txt # Write the approximated Pareto points 33 | # in a file during the run 34 | 35 | 36 | HISTORY_FILE history.txt 37 | 38 | -------------------------------------------------------------------------------- /examples/basic/batch/multi_obj2/param_testQMS.txt: -------------------------------------------------------------------------------- 1 | DIMENSION 3 # number of variables 2 | 3 | 4 | BB_EXE bbMO2.exe 5 | BB_OUTPUT_TYPE OBJ OBJ 6 | 7 | X0 ( 0 0 0 ) # starting point 8 | 9 | LOWER_BOUND * -5 10 | UPPER_BOUND * 5 11 | 12 | MAX_BB_EVAL 1000 13 | 14 | # DMultiMads is enabled (default Mads is disabled) 15 | DMULTIMADS_OPTIMIZATION yes 16 | 17 | # Quad model search using DMS strategy 18 | QUAD_MODEL_SEARCH yes 19 | DMULTIMADS_QUAD_MODEL_STRATEGY DMS 20 | 21 | # For multiobjctive, sort should not use the default quad model info 22 | EVAL_QUEUE_SORT DIR_LAST_SUCCESS 23 | 24 | # Let's deactivate all default search methods 25 | # and do ORTHO n+1 Neg (Neg is for disabling quad model (n+1)th direction) 26 | DIRECTION_TYPE ORTHO n+1 neg 27 | NM_SEARCH no 28 | SPECULATIVE_SEARCH no 29 | 30 | DISPLAY_DEGREE 2 31 | DISPLAY_UNSUCCESSFUL yes 32 | DISPLAY_STATS BBE ( SOL ) BBO # Display the number of evaluation (BBE), 33 | # the current solution ( SOL ) and the objectives 34 | 35 | 36 | SOLUTION_FILE sol.txt # Write the approximated Pareto points 37 | SOLUTION_FILE_FINAL yes # in a file at the end of the run 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/basic/batch/multi_obj2/x.txt: -------------------------------------------------------------------------------- 1 | 2.0 2.0 2 | -------------------------------------------------------------------------------- /examples/basic/batch/single_obj_MPIparallel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(MPI QUIET) 2 | 3 | if(MPI_FOUND) 4 | 5 | include_directories(${MPI_INCLUDE_PATH}) 6 | 7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_CXX_FLAGS}") 8 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_EXE_LINKER_FLAGS}") 9 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 10 | 11 | add_executable(bb4.exe bb.cpp ) 12 | set_target_properties(bb4.exe PROPERTIES SUFFIX "") 13 | 14 | target_link_libraries(bb4.exe PUBLIC MPI::MPI_CXX) 15 | 16 | # installing executables and libraries 17 | install(TARGETS bb4.exe 18 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 19 | 20 | message(STATUS " Add example batch single_obj_MPIparallel (MPI found).") 21 | 22 | # Test run in working directory AFTER install of bb executable 23 | add_test(NAME ExampleBasicBatchSingleObjMPIParallel 24 | COMMAND ${CMAKE_INSTALL_PREFIX}/bin/nomad param.txt 25 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 26 | endif() 27 | -------------------------------------------------------------------------------- /examples/basic/batch/single_obj_MPIparallel/param.txt: -------------------------------------------------------------------------------- 1 | DIMENSION 5 # number of variables 2 | 3 | BB_EXE '$mpirun $-np $4 bb4.exe' # WARNING Adjust the path to mpirun 4 | # or mpiexec according to your setup. 5 | 6 | 7 | BB_MAX_BLOCK_SIZE 20 8 | MEGA_SEARCH_POLL yes # Generate search and poll trial points before evaluation 9 | # Max points put in block. Without this option, single point 10 | # can be passed in a block for evaluation creating a bottleneck. 11 | DIRECTION_TYPE ORTHO 2N # Single pass for generating poll trial points 12 | # Better to have more points in blocks 13 | 14 | 15 | BB_OUTPUT_TYPE OBJ PB PB 16 | 17 | X0 ( 0 0 0 0 0 ) # starting point 18 | 19 | LOWER_BOUND * -6.0 # all variables are >= -6 20 | UPPER_BOUND ( 5 6 7 - - ) # x_1 <= 5, x_2 <= 6, x_3 <= 7 21 | # x_4 and x_5 have no bounds 22 | 23 | MAX_BB_EVAL 200 24 | 25 | DISPLAY_DEGREE 2 26 | DISPLAY_STATS BLK_EVA BLK_SIZE OBJ 27 | DISPLAY_ALL_EVAL true 28 | -------------------------------------------------------------------------------- /examples/basic/batch/single_obj_MPIparallel/x.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 4 5 2 | 0 0 0 0 0 3 | 1 1 1 1 1 4 | 2 2 2 2 2 5 | 3 3 3 3 3 6 | 4 4 4 4 4 7 | 5 5 5 5 5 8 | 6 5 4 3 2 9 | -------------------------------------------------------------------------------- /examples/basic/batch/single_obj_MPIparallel/xsingle.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 4 5 2 | -------------------------------------------------------------------------------- /examples/basic/batch/single_obj_parallel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_EXECUTABLE_SUFFIX .exe) 2 | add_executable(bb_s.exe bb.cpp ) 3 | set_target_properties(bb_s.exe PROPERTIES SUFFIX "") 4 | 5 | target_link_libraries(bb_s.exe PUBLIC OpenMP::OpenMP_CXX) 6 | 7 | # installing executables and libraries 8 | install(TARGETS bb_s.exe 9 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 10 | 11 | # Add a test for this example 12 | message(STATUS " Add example batch single_obj_parallel") 13 | 14 | # Test run in working directory AFTER install of bb executable 15 | add_test(NAME ExampleBasicBatchSingleObjParallel 16 | COMMAND ${CMAKE_INSTALL_PREFIX}/bin/nomad param.txt 17 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | -------------------------------------------------------------------------------- /examples/basic/batch/single_obj_parallel/param.txt: -------------------------------------------------------------------------------- 1 | DIMENSION 5 # number of variables 2 | 3 | BB_EXE bb_s.exe 4 | 5 | # Blocks of points are provided to the BB. 6 | # BB evaluate points in parallel. 7 | # Nomad queue for parallel evaluations is not 8 | # used in this example. Look into example 2 for 9 | # using this feature. 10 | BB_MAX_BLOCK_SIZE 4 11 | 12 | BB_OUTPUT_TYPE OBJ PB EB 13 | 14 | X0 ( 0 0 0 0 0 ) # starting point 15 | 16 | LOWER_BOUND * -6.0 # all variables are >= -6 17 | UPPER_BOUND ( 5 6 7 - - ) # x_1 <= 5, x_2 <= 6, x_3 <= 7 18 | # x_4 and x_5 have no bounds 19 | 20 | MAX_BLOCK_EVAL 20 # the algorithm terminates when 21 | # 20 blocks have been evaluated 22 | 23 | DISPLAY_DEGREE 2 24 | DISPLAY_STATS BLK_EVA BLK_SIZE ( SOL ) OBJ CONS_H 25 | DISPLAY_ALL_EVAL true 26 | -------------------------------------------------------------------------------- /examples/basic/batch/single_obj_parallel/x.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 4 5 2 | 0 0 0 0 0 3 | 2 2 2 2 2 4 | 5 4 3 2 1 5 | -------------------------------------------------------------------------------- /examples/basic/batch/surrogate_sort/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(ss_bb.exe bb.cpp ) 2 | add_executable(ss_sgte.exe sgte.cpp ) 3 | set_target_properties(ss_bb.exe PROPERTIES SUFFIX "") 4 | set_target_properties(ss_sgte.exe PROPERTIES SUFFIX "") 5 | 6 | # installing executables and libraries 7 | install(TARGETS ss_bb.exe ss_sgte.exe 8 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 9 | 10 | # No test for this example 11 | -------------------------------------------------------------------------------- /examples/basic/batch/surrogate_sort/param.txt: -------------------------------------------------------------------------------- 1 | # PROBLEM PARAMETERS 2 | #################### 3 | 4 | # Number of variables 5 | DIMENSION 2 6 | 7 | # Black box 8 | BB_EXE ss_bb.exe 9 | BB_OUTPUT_TYPE OBJ 10 | 11 | # Surrogate 12 | SURROGATE_EXE ss_sgte.exe 13 | EVAL_SURROGATE_COST 2 14 | 15 | # Starting point 16 | X0 ( 5.0 5.0 ) 17 | 18 | # Bounds are useful to avoid extreme values 19 | LOWER_BOUND * -20.0 20 | UPPER_BOUND * 20.0 21 | 22 | 23 | # ALGORITHM PARAMETERS 24 | ###################### 25 | # The algorithm terminates after that number black-box evaluations 26 | MAX_BB_EVAL 100 27 | 28 | # Use surrogate executable to sort points before evaluating them with the blackbox 29 | EVAL_QUEUE_SORT SURROGATE 30 | 31 | # Display parameters 32 | #################### 33 | DISPLAY_DEGREE 2 34 | DISPLAY_ALL_EVAL true 35 | DISPLAY_STATS BBE SURROGATE_EVAL ( SOL ) OBJ 36 | 37 | -------------------------------------------------------------------------------- /examples/basic/batch/surrogate_sort/param_VNSMadsSurrogateSearch.txt: -------------------------------------------------------------------------------- 1 | # PROBLEM PARAMETERS 2 | #################### 3 | 4 | # Number of variables 5 | DIMENSION 2 6 | 7 | # Black box 8 | BB_OUTPUT_TYPE OBJ 9 | BB_EXE ss_bb.exe 10 | 11 | # Surrogate 12 | SURROGATE_EXE ss_sgte.exe 13 | EVAL_SURROGATE_COST 3 14 | 15 | # Starting point 16 | X0 ( 5.0 5.0 ) 17 | 18 | # Bounds are useful to avoid extreme values 19 | LOWER_BOUND * -20.0 20 | UPPER_BOUND * 20.0 21 | 22 | 23 | # ALGORITHM PARAMETERS 24 | ###################### 25 | # The algorithm terminates after that number surrogate evaluations 26 | MAX_BB_EVAL 400 27 | 28 | VNS_MADS_SEARCH_WITH_SURROGATE yes 29 | QUAD_MODEL_SEARCH yes 30 | NM_SEARCH no 31 | 32 | # Use surrogate executable to sort points before evaluating them with the blackbox 33 | EVAL_QUEUE_SORT SURROGATE 34 | 35 | # Display parameters 36 | #################### 37 | DISPLAY_ALL_EVAL true 38 | DISPLAY_STATS SURROGATE_EVAL BBE ( SOL ) OBJ 39 | 40 | -------------------------------------------------------------------------------- /examples/basic/batch/surrogate_sort/param_surrogateOptim.txt: -------------------------------------------------------------------------------- 1 | # PROBLEM PARAMETERS 2 | #################### 3 | 4 | # Number of variables 5 | DIMENSION 2 6 | 7 | # Black box 8 | BB_OUTPUT_TYPE OBJ 9 | 10 | # Surrogate 11 | SURROGATE_EXE ss_sgte.exe 12 | 13 | # Starting point 14 | X0 ( 5.0 5.0 ) 15 | 16 | # Bounds are useful to avoid extreme values 17 | LOWER_BOUND * -20.0 18 | UPPER_BOUND * 20.0 19 | 20 | 21 | # ALGORITHM PARAMETERS 22 | ###################### 23 | # The algorithm terminates after that number surrogate evaluations 24 | MAX_SURROGATE_EVAL_OPTIMIZATION 100 25 | 26 | # Use surrogate evaluation for optimization 27 | EVAL_SURROGATE_OPTIMIZATION yes 28 | 29 | # Display parameters 30 | #################### 31 | DISPLAY_ALL_EVAL true 32 | DISPLAY_STATS SURROGATE_EVAL ( SOL ) OBJ 33 | 34 | -------------------------------------------------------------------------------- /examples/basic/library/CustomSurrogateOrdering/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(customSurrogateOrdering.exe customSurrogateOrdering.cpp ) 2 | 3 | target_include_directories(customSurrogateOrdering.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(customSurrogateOrdering.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(customSurrogateOrdering.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(customSurrogateOrdering.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS customSurrogateOrdering.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example -------------------------------------------------------------------------------- /examples/basic/library/StopOnFTarget/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(stopOnFTarget.exe stopOnFTarget.cpp ) 2 | 3 | target_include_directories(stopOnFTarget.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(stopOnFTarget.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(stopOnFTarget.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(stopOnFTarget.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS stopOnFTarget.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | 20 | # No test for this example -------------------------------------------------------------------------------- /examples/basic/library/example1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(example1_lib.exe example1_lib.cpp ) 2 | 3 | target_include_directories(example1_lib.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(example1_lib.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(example1_lib.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(example1_lib.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS example1_lib.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | # Add a test for this example 20 | message(STATUS " Add example library #1") 21 | 22 | # Can run this test after install 23 | if (WIN32) 24 | add_test(NAME Example1BasicLib 25 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./example1_lib.exe 26 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 27 | else() 28 | add_test(NAME Example1BasicLib 29 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./example1_lib.exe 30 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 31 | endif() 32 | -------------------------------------------------------------------------------- /examples/basic/library/example2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(example2_lib.exe example2_lib.cpp ) 2 | 3 | target_include_directories(example2_lib.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(example2_lib.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(example2_lib.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(example2_lib.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS example2_lib.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | # Add a test for this example 20 | message(STATUS " Add example library #2") 21 | 22 | # Can run this test after install 23 | if (WIN32) 24 | add_test(NAME Example2BasicLib 25 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./example2_lib.exe 26 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 27 | else() 28 | add_test(NAME Example2BasicLib 29 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./example2_lib.exe 30 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 31 | endif() 32 | -------------------------------------------------------------------------------- /examples/basic/library/multi_obj/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(multi_obj_lib.exe multi_obj_lib.cpp) 2 | 3 | target_include_directories(multi_obj_lib.exe PRIVATE ${CMAKE_SOURCE_DIR}/src) 4 | 5 | set_target_properties(multi_obj_lib.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 6 | 7 | if(OpenMP_CXX_FOUND) 8 | target_link_libraries(multi_obj_lib.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 9 | else() 10 | target_link_libraries(multi_obj_lib.exe PUBLIC nomadAlgos nomadUtils nomadEval) 11 | endif() 12 | 13 | # installing executables and libraries 14 | install(TARGETS multi_obj_lib.exe 15 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 16 | 17 | # Add a test for this example 18 | message(STATUS " Add multi obj library example") 19 | 20 | # Can run this test after install 21 | if (WIN32) 22 | add_test(NAME MultiObjBasicLib 23 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./multi_obj_lib.exe 24 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 25 | else() 26 | add_test(NAME MultiObjBasicLib 27 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./multi_obj_lib.exe 28 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 29 | endif() 30 | -------------------------------------------------------------------------------- /examples/basic/library/single_obj_parallel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(single_obj_parallel.exe basic_lib.cpp ) 2 | 3 | target_include_directories(single_obj_parallel.exe PRIVATE 4 | ${CMAKE_SOURCE_DIR}/src) 5 | 6 | set_target_properties(single_obj_parallel.exe PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" SUFFIX "") 7 | 8 | 9 | if(OpenMP_CXX_FOUND) 10 | target_link_libraries(single_obj_parallel.exe PUBLIC nomadAlgos nomadUtils nomadEval OpenMP::OpenMP_CXX) 11 | else() 12 | target_link_libraries(single_obj_parallel.exe PUBLIC nomadAlgos nomadUtils nomadEval) 13 | endif() 14 | 15 | # installing executables and libraries 16 | install(TARGETS single_obj_parallel.exe 17 | RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} ) 18 | 19 | # Add a test for this example 20 | message(STATUS " Add example library single_obj_parallel") 21 | 22 | # Can run this test after install 23 | if (WIN32) 24 | add_test(NAME SingleObjParallelBasicLib 25 | COMMAND bash.exe ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./single_obj_parallel.exe 26 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 27 | else() 28 | add_test(NAME SingleObjParallelBasicLib 29 | COMMAND ${CMAKE_BINARY_DIR}/examples/runExampleTest.sh ./single_obj_parallel.exe 30 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) 31 | endif() 32 | -------------------------------------------------------------------------------- /ext/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sgtelib) 2 | -------------------------------------------------------------------------------- /ext/sgtelib/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.pdb 3 | *.exp 4 | *.ilk 5 | *.lib 6 | lib/sgtelib.dll 7 | sgtelib_predict/sgtelib_predict.vcxproj.filters 8 | VisualStudio/.vs/sgtelib/v14/.suo 9 | VisualStudio/sgtelib.VC.db 10 | VisualStudio/sgtelib_predict.vcxproj.filters 11 | -------------------------------------------------------------------------------- /ext/sgtelib/CMakeListsLibs.txt: -------------------------------------------------------------------------------- 1 | # Shared library 2 | # 3 | 4 | add_library( 5 | sgtelib 6 | SHARED ${SGTELIB_SOURCES} 7 | ) 8 | 9 | target_include_directories( 10 | sgtelib 11 | PUBLIC 12 | $ 13 | $ 14 | ) 15 | 16 | set_target_properties( 17 | sgtelib 18 | PROPERTIES 19 | VERSION "${SGTELIB_VERSION}" 20 | SOVERSION "${SGTELIB_VERSION_MAJOR}.${SGTELIB_VERSION_MINOR}" 21 | NO_SONAME ${NO_SONAME} 22 | ) 23 | 24 | # export symbols on Windows 25 | if (WIN32) 26 | target_compile_definitions( 27 | sgtelib 28 | PRIVATE -DDLL_EXPORTS 29 | ) 30 | endif() 31 | 32 | # installing library 33 | install( 34 | TARGETS sgtelib 35 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 36 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 37 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sgtelib 38 | ) 39 | -------------------------------------------------------------------------------- /ext/sgtelib/CMakeListsLibsStatic.txt: -------------------------------------------------------------------------------- 1 | # Static library 2 | # 3 | 4 | add_library( 5 | sgtelibStatic 6 | STATIC ${SGTELIB_SOURCES} 7 | ) 8 | 9 | target_include_directories( 10 | sgtelibStatic 11 | PUBLIC 12 | $ 13 | $ 14 | ) 15 | 16 | set_target_properties( 17 | sgtelibStatic 18 | PROPERTIES 19 | VERSION "${SGTELIB_VERSION}" 20 | SOVERSION "${SGTELIB_VERSION_MAJOR}.${SGTELIB_VERSION_MINOR}" 21 | OUTPUT_NAME sgtelibStatic 22 | ) 23 | 24 | # export symbols on Windows 25 | if (WIN32) 26 | target_compile_definitions( 27 | sgtelibStatic 28 | PRIVATE -DNOMAD_STATIC_BUILD 29 | ) 30 | endif() 31 | 32 | # installing library 33 | install( 34 | TARGETS sgtelibStatic 35 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 36 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 37 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sgtelib 38 | ) 39 | -------------------------------------------------------------------------------- /ext/sgtelib/src/Exception.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | #ifndef __SGTELIB_EXCEPTION__ 27 | #define __SGTELIB_EXCEPTION__ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | namespace SGTELIB { 34 | 35 | class Exception : public std::exception { 36 | 37 | private: 38 | 39 | std::string _file; 40 | int _line; 41 | std::string _err_msg; 42 | 43 | mutable std::string _tmp; 44 | 45 | public: 46 | 47 | virtual const char * what ( void ) const throw() { 48 | std::ostringstream oss; 49 | oss << _file << ":" << _line << " (" << _err_msg << ")"; 50 | _tmp = oss.str(); 51 | return _tmp.c_str(); 52 | } 53 | 54 | Exception ( const std::string & file , 55 | int line , 56 | const std::string & err_msg ) 57 | : _file(file) , _line(line) , _err_msg(err_msg) {} 58 | 59 | virtual ~Exception ( void ) throw() {} 60 | }; 61 | } 62 | 63 | // usage: throw SGTELIB::Exception ( "file.cpp" , __LINE__ , "error message" ); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /ext/sgtelib/src/Kernel.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | #ifndef __KERNEL__ 27 | #define __KERNEL__ 28 | 29 | #include "Defines.hpp" 30 | #include "Exception.hpp" 31 | #include "Matrix.hpp" 32 | namespace SGTELIB { 33 | 34 | // kernel type: 35 | enum kernel_t { 36 | KERNEL_D1 , 37 | KERNEL_D2 , 38 | KERNEL_D3 , 39 | KERNEL_D4 , 40 | KERNEL_D5 , 41 | KERNEL_D6 , 42 | KERNEL_D7 , 43 | KERNEL_I0 , 44 | KERNEL_I1 , 45 | KERNEL_I2 , 46 | KERNEL_I3 , 47 | KERNEL_I4 48 | }; 49 | const int NB_KERNEL_TYPES = 11; 50 | const int NB_DECREASING_KERNEL_TYPES = 6; 51 | 52 | // kernel 53 | double kernel ( const SGTELIB::kernel_t kt , const double ks ,const double r ); 54 | SGTELIB::Matrix kernel ( const SGTELIB::kernel_t kt , const double ks , SGTELIB::Matrix R ); 55 | // kernel is decreasing ? 56 | bool kernel_is_decreasing ( const SGTELIB::kernel_t kt ); 57 | // kernel has a shape parameter ? 58 | bool kernel_has_parameter ( const SGTELIB::kernel_t kt ); 59 | // kernel has a shape parameter ? 60 | int kernel_dmin ( const SGTELIB::kernel_t kt ); 61 | // Kernel to str 62 | std::string kernel_type_to_str ( SGTELIB::kernel_t ); 63 | // string to kernel type 64 | SGTELIB::kernel_t str_to_kernel_type ( const std::string & s ); 65 | SGTELIB::kernel_t int_to_kernel_type ( const int i ); 66 | } 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /ext/sgtelib/src/Surrogate_CN.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | #ifndef __SGTELIB_SURROGATE_CN__ 27 | #define __SGTELIB_SURROGATE_CN__ 28 | 29 | #include "Surrogate.hpp" 30 | 31 | namespace SGTELIB { 32 | 33 | /*--------------------------------------*/ 34 | /* Surrogate_CN class */ 35 | /*--------------------------------------*/ 36 | class Surrogate_CN : public SGTELIB::Surrogate { 37 | 38 | private: 39 | 40 | virtual bool build_private (void) override; 41 | 42 | virtual void predict_private ( const SGTELIB::Matrix & XXs, 43 | SGTELIB::Matrix * ZZs) override; 44 | 45 | virtual void predict_private_objective ( const std::vector & XXd, 46 | SGTELIB::Matrix * ZZsurr_around ) override; 47 | 48 | // Compute metrics 49 | virtual const SGTELIB::Matrix * get_matrix_Zvs (void) override; 50 | virtual const SGTELIB::Matrix * get_matrix_Zhs (void) override; 51 | virtual const SGTELIB::Matrix * get_matrix_Svs (void) override; 52 | virtual const SGTELIB::Matrix * get_matrix_Shs (void) override; 53 | 54 | bool compute_cv_values (void); 55 | 56 | public: 57 | 58 | // Constructor 59 | Surrogate_CN ( SGTELIB::TrainingSet & trainingset , 60 | const SGTELIB::Surrogate_Parameters& param) ; 61 | 62 | // destructor: 63 | virtual ~Surrogate_CN ( void ); 64 | 65 | virtual void display_private ( std::ostream & out ) const override; 66 | 67 | }; 68 | } 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /ext/sgtelib/src/Surrogate_Factory.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | #ifndef __SURROGATE_FACTORY__ 27 | #define __SURROGATE_FACTORY__ 28 | 29 | #include "Defines.hpp" 30 | #include "Exception.hpp" 31 | #include "Surrogate.hpp" 32 | #include "Surrogate_KS.hpp" 33 | #include "Surrogate_CN.hpp" 34 | #include "Surrogate_RBF.hpp" 35 | #include "Surrogate_PRS.hpp" 36 | #include "Surrogate_PRS_EDGE.hpp" 37 | #include "Surrogate_PRS_CAT.hpp" 38 | #include "Surrogate_Ensemble.hpp" 39 | #include "Surrogate_Ensemble_Stat.hpp" 40 | #include "Surrogate_LOWESS.hpp" 41 | #include "Surrogate_Kriging.hpp" 42 | 43 | namespace SGTELIB { 44 | 45 | DLL_API SGTELIB::Surrogate * Surrogate_Factory ( SGTELIB::TrainingSet & C, 46 | const std::string & s ); 47 | 48 | DLL_API SGTELIB::Surrogate * Surrogate_Factory ( SGTELIB::Matrix & X0, 49 | SGTELIB::Matrix & Z0, 50 | const std::string & s ); 51 | 52 | DLL_API void surrogate_delete ( SGTELIB::Surrogate * S ); 53 | 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /ext/sgtelib/src/Surrogate_KS.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | #ifndef __SGTELIB_SURROGATE_KS__ 27 | #define __SGTELIB_SURROGATE_KS__ 28 | 29 | #include "Surrogate.hpp" 30 | 31 | namespace SGTELIB { 32 | 33 | /*--------------------------------------*/ 34 | /* Surrogate_KS class */ 35 | /*--------------------------------------*/ 36 | class Surrogate_KS : public SGTELIB::Surrogate { 37 | 38 | private: 39 | 40 | virtual bool build_private (void) override; 41 | 42 | virtual void predict_private ( const SGTELIB::Matrix & XXs, 43 | SGTELIB::Matrix * ZZs) override; 44 | 45 | // Predict only objectives (used in Surrogate Ensemble Stat) 46 | virtual void predict_private_objective ( const std::vector & XXd, 47 | SGTELIB::Matrix * ZZsurr_around ) override; 48 | 49 | // Compute metrics 50 | virtual const SGTELIB::Matrix * get_matrix_Zvs (void) override; 51 | virtual const SGTELIB::Matrix * get_matrix_Zhs (void) override; 52 | 53 | public: 54 | 55 | // Constructor 56 | Surrogate_KS ( SGTELIB::TrainingSet & trainingset , 57 | const SGTELIB::Surrogate_Parameters& param) ; 58 | 59 | // destructor: 60 | virtual ~Surrogate_KS ( void ); 61 | 62 | virtual void display_private ( std::ostream & out ) const override; 63 | 64 | }; 65 | } 66 | 67 | #endif 68 | 69 | -------------------------------------------------------------------------------- /ext/sgtelib/src/Surrogate_PRS_CAT.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | #ifndef __SGTELIB_SURROGATE_PRS_CAT__ 27 | #define __SGTELIB_SURROGATE_PRS_CAT__ 28 | 29 | #include "Surrogate_PRS.hpp" 30 | 31 | namespace SGTELIB { 32 | 33 | /*--------------------------------------*/ 34 | /* Surrogate_PRS_CAT class */ 35 | /*--------------------------------------*/ 36 | class Surrogate_PRS_CAT : public SGTELIB::Surrogate_PRS { 37 | 38 | protected: 39 | std::set _cat; // Categories 40 | int _nb_cat; // Number of categories 41 | 42 | virtual const SGTELIB::Matrix compute_design_matrix ( const SGTELIB::Matrix& Monomes, 43 | const SGTELIB::Matrix & Xs ) override; 44 | // build model (private): 45 | virtual bool build_private (void) override; 46 | virtual bool init_private (void) override; 47 | public: 48 | 49 | // Constructor 50 | Surrogate_PRS_CAT ( SGTELIB::TrainingSet & trainingset , 51 | const SGTELIB::Surrogate_Parameters& param) ; 52 | 53 | // destructor: 54 | virtual ~Surrogate_PRS_CAT ( void ); 55 | 56 | virtual void display_private ( std::ostream & out ) const override; 57 | 58 | }; 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /ext/sgtelib/src/Surrogate_PRS_EDGE.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | #ifndef __SGTELIB_SURROGATE_PRS_EDGE__ 27 | #define __SGTELIB_SURROGATE_PRS_EDGE__ 28 | 29 | #include "Surrogate_PRS.hpp" 30 | 31 | namespace SGTELIB { 32 | 33 | /*--------------------------------------*/ 34 | /* Surrogate_PRS_EDGE class */ 35 | /*--------------------------------------*/ 36 | class Surrogate_PRS_EDGE : public SGTELIB::Surrogate_PRS { 37 | 38 | protected: 39 | 40 | virtual const SGTELIB::Matrix compute_design_matrix ( const SGTELIB::Matrix& Monomes, 41 | const SGTELIB::Matrix & Xs ) override; 42 | 43 | // build model (private): 44 | virtual bool build_private (void) override; 45 | 46 | public: 47 | 48 | // Constructor 49 | Surrogate_PRS_EDGE ( SGTELIB::TrainingSet & trainingset , 50 | const SGTELIB::Surrogate_Parameters& param) ; 51 | // destructor: 52 | virtual ~Surrogate_PRS_EDGE ( void ); 53 | 54 | virtual void display_private ( std::ostream & out ) const override; 55 | 56 | }; 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /ext/sgtelib/src/header.txt: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.2 */ 4 | /* */ 5 | /* Copyright (C) 2012-2016 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | -------------------------------------------------------------------------------- /ext/sgtelib/src/sgtelib.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | // SGTELIB 2014-02-07 27 | 28 | #ifndef __SGTELIB__ 29 | #define __SGTELIB__ 30 | 31 | #include "Surrogate_Factory.hpp" 32 | #include "Tests.hpp" 33 | #include "Matrix.hpp" 34 | #include "Defines.hpp" 35 | #include "Surrogate_Utils.hpp" 36 | #include "sgtelib_help.hpp" 37 | 38 | namespace SGTELIB { 39 | void sgtelib_server ( const std::string & model , const bool verbose ); 40 | void sgtelib_predict ( const std::string & file_list , const std::string & model ); 41 | void sgtelib_best ( const std::string & file_list , const bool verbose ); 42 | void sgtelib_help ( std::string word="GENERAL" ); 43 | void sgtelib_test ( void ); 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /ext/sgtelib/src/sgtelib_help.hpp: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------------------*/ 2 | /* sgtelib - A surrogate model library for derivative-free optimization */ 3 | /* Version 2.0.3 */ 4 | /* */ 5 | /* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ 6 | /* Bastien Talgorn - McGill University, Montreal */ 7 | /* */ 8 | /* Author: Bastien Talgorn */ 9 | /* email: bastientalgorn@fastmail.com */ 10 | /* */ 11 | /* This program is free software: you can redistribute it and/or modify it under the */ 12 | /* terms of the GNU Lesser General Public License as published by the Free Software */ 13 | /* Foundation, either version 3 of the License, or (at your option) any later */ 14 | /* version. */ 15 | /* */ 16 | /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ 17 | /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ 18 | /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ 19 | /* */ 20 | /* You should have received a copy of the GNU Lesser General Public License along */ 21 | /* with this program. If not, see . */ 22 | /* */ 23 | /* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ 24 | /*-------------------------------------------------------------------------------------*/ 25 | 26 | #ifndef __SGTELIB_HELP__ 27 | #define __SGTELIB_HELP__ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include "Defines.hpp" 37 | 38 | 39 | namespace SGTELIB { 40 | DLL_API int dim_help_data (void); 41 | DLL_API std::string ** get_help_data (void); 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /ext/sgtelib/src/sgtelib_predict.cpp: -------------------------------------------------------------------------------- 1 | 2 | #define SGTELIB_PREDICT_VERSION "1.0 [Fev. 18th, 2019]" 3 | // sgtelib_predict.exe X.txt Z.txt XX.txt model.txt 4 | 5 | 6 | #include "sgtelib.hpp" 7 | #include "Surrogate_Factory.hpp" 8 | #include "Surrogate_Utils.hpp" 9 | 10 | #include 11 | #include 12 | 13 | using namespace std; 14 | 15 | 16 | 17 | char errstr[1024]; 18 | 19 | //Function Prototypes 20 | void printSolverInfo(); 21 | 22 | // Main Entry Function 23 | // ----------------------------------------------------------------- 24 | int main(int argc, char ** argv) 25 | { 26 | 27 | if (argc < 5) 28 | { 29 | printInfo(); 30 | return 0; 31 | } 32 | 33 | //Set Option Defaults 34 | int printLevel = 1; 35 | 36 | 37 | 38 | //Get the model definition in text format 39 | std::ifstream modelFile(argv[5]); 40 | std::string sgtelib_model= ""; 41 | if (! modelFile.good()) 42 | { 43 | std::cerr << "Error reading model file" << argv[5]; 44 | modelFile.close(); 45 | return false; 46 | } 47 | else 48 | { 49 | modelFile >> sgtelib_model; 50 | modelFile.close(); 51 | } 52 | 53 | //Internal Vars 54 | size_t mX, nX, mZ, nZ, mXX, nXX; 55 | SGTELIB::Matrix X(argv[1]); 56 | X.set_name("X"); 57 | X.display(std::cout); 58 | 59 | SGTELIB::Matrix Z(argv[2]); 60 | Z.set_name("Z"); 61 | Z.display(std::cout); 62 | 63 | SGTELIB::Matrix XX(argv[3]); 64 | XX.set_name("XX"); 65 | 66 | nXX = XX.get_nb_cols(); 67 | nX = Z.get_nb_rows(); 68 | SGTELIB::Matrix ZZ ("ZZ",mXX,nZ); 69 | 70 | //cout << "size of X: mRows=" << mX << " nCols=" << nX << endl; 71 | // cout << "size of Z: mRows=" << mZ << " nCols=" << nZ << endl; 72 | // cout << "size of XX: mRows=" << mXX << " nCols=" << nXX << endl; 73 | 74 | //Check Sizes 75 | if (mX == 0 || mZ == 0 || mXX == 0 || nX == 0 || nZ == 0 || nXX == 0) 76 | std::cerr << "error: size of X, Z and XX must be greater than 0" << std::endl; 77 | 78 | 79 | if (mX != mZ) 80 | std::cerr << "error: size of X and Z must be equal" << std::endl; 81 | 82 | 83 | //cout << " X nb_rows (nb points)= " << X.get_nb_rows() << std::endl; 84 | //cout << " X nb_cols (n) = " << X.get_nb_cols() << std::endl; 85 | //cout << " X nb_cols " << Z.get_nb_cols() << std::endl; 86 | 87 | try { 88 | SGTELIB::TrainingSet TS(X,Z); 89 | SGTELIB::Surrogate * S = Surrogate_Factory(TS,sgtelib_model); 90 | S->build(); 91 | 92 | TS.display(std::cout); 93 | 94 | S->predict(XX,&ZZ); 95 | ZZ.display(std::cout); 96 | } 97 | catch(exception &e) 98 | { 99 | std::cerr << "SGTELIB Error:" << e.what(); 100 | } 101 | 102 | return 0; 103 | } 104 | 105 | //Print Solver Information 106 | void printInfo() 107 | { 108 | std::cout 109 | << "\n-----------------------------------------------------------" << std::endl 110 | << " SGTELIB: 2.0.2 " << std::endl << " - Released under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html" << std::endl 111 | << " - Source available from: https://github.com/bastientalgorn/sgtelib" << std::endl << std::end 112 | << "Command line Interface C. Tribes 2018 " << std::endl 113 | << " usage: sgtelib_predict.exe X.txt Y.txt XX.txt model.txt" << std::endl 114 | << "-----------------------------------------------------------" << std::endl; 115 | } 116 | -------------------------------------------------------------------------------- /ext/sgtelib/user_guide/sgtelib_user_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbopt/nomad/b214ab9a268ebde013056655e01f40dccc55ca7c/ext/sgtelib/user_guide/sgtelib_user_guide.pdf -------------------------------------------------------------------------------- /interfaces/CInterface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Source and header 3 | # 4 | set( 5 | INTERFACE_SOURCES 6 | ${CMAKE_CURRENT_SOURCE_DIR}/NomadStdCInterface.cpp 7 | ) 8 | 9 | set( 10 | INTERFACE_HEADERS 11 | ${CMAKE_CURRENT_SOURCE_DIR}/NomadStdCInterface.h 12 | ) 13 | 14 | 15 | # 16 | # Build 17 | # 18 | add_library( 19 | nomadCInterface 20 | SHARED ${INTERFACE_SOURCES} 21 | ) 22 | 23 | target_include_directories( 24 | nomadCInterface 25 | PUBLIC 26 | $ 27 | $ 28 | ) 29 | 30 | target_link_libraries( 31 | nomadCInterface 32 | PUBLIC 33 | nomadAlgos 34 | nomadUtils 35 | nomadEval 36 | ) 37 | 38 | if (WIN32) 39 | target_compile_definitions( 40 | nomadCInterface 41 | PRIVATE -DNOMAD_INTERFACE_C_DLL 42 | ) 43 | endif() 44 | 45 | if(OpenMP_CXX_FOUND) 46 | target_link_libraries( 47 | nomadCInterface 48 | PUBLIC OpenMP::OpenMP_CXX 49 | ) 50 | endif() 51 | 52 | if (NOT WIN32) 53 | target_link_libraries( 54 | nomadCInterface 55 | PRIVATE m 56 | ) 57 | endif() 58 | 59 | set_target_properties( 60 | nomadCInterface 61 | PROPERTIES 62 | INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" 63 | VERSION "${NOMAD_VERSION}" 64 | SOVERSION "${NOMAD_VERSION_MAJOR}.${NOMAD_VERSION_MINOR}" 65 | NO_SONAME ${NO_SONAME} 66 | ) 67 | 68 | 69 | # 70 | # Install binary and header 71 | # 72 | install( 73 | TARGETS nomadCInterface 74 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 75 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 76 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ 77 | ) 78 | 79 | install( 80 | FILES ${INTERFACE_HEADERS} 81 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/interfaces/CInterface 82 | ) 83 | 84 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/.gitignore: -------------------------------------------------------------------------------- 1 | test_nomad_gerad.asv 2 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Build 3 | # 4 | 5 | 6 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") 7 | matlab_add_mex(NAME nomadOpt SHARED SRC Source/nomadmex.cpp LINK_TO nomadAlgos nomadUtils nomadEval ${Matlab_ROOT_DIR}/extern/lib/win64/microsoft/libut.lib) 8 | elseif(APPLE) 9 | matlab_add_mex(NAME nomadOpt SHARED SRC Source/nomadmex.cpp LINK_TO nomadAlgos nomadUtils nomadEval ${Matlab_ROOT_DIR}/bin/maci64/libut.dylib) 10 | elseif(LINUX) 11 | matlab_add_mex(NAME nomadOpt SHARED SRC Source/nomadmex.cpp LINK_TO nomadAlgos nomadUtils nomadEval ${Matlab_ROOT_DIR}/bin/glnxa64/libut.so) 12 | else() 13 | matlab_add_mex(NAME nomadOpt SHARED SRC Source/nomadmex.cpp LINK_TO nomadAlgos nomadUtils nomadEval) 14 | endif() 15 | 16 | 17 | set_target_properties(nomadOpt PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR};${Matlab_ROOT_DIR}/sys/os/glnxa64/;${Matlab_ROOT_DIR}/sys/os/maci64/" ) 18 | 19 | # 20 | # Install binary and header 21 | # 22 | install(TARGETS nomadOpt 23 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 24 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 25 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ 26 | ) 27 | 28 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_block_eval/cbFun.m: -------------------------------------------------------------------------------- 1 | function stop = cbFun(count,out,x) 2 | 3 | nb_points=size(x,1); % Number of evaluations 4 | n=size(x,2); % Dimension of each point 5 | 6 | nbOutValue = size(out,1); % Number of evaluations 7 | n_out=size(out,2); % Number of constraints + objective 8 | 9 | if ( n ~= 5) 10 | error('Black box function must be provided with points of dimension 5 (=number of columns)'); 11 | end 12 | 13 | % Take the best of all objective function values (BB_OUTPUT_TYPE defines 14 | % the type and order of output value) 15 | [best_obj, index]=min(out(:,1)); 16 | % Feasibility of the best objective function value 17 | c1_forBest = out(index,2); 18 | c2_forBest = out(index,3); 19 | 20 | stop = false; 21 | if (count > 10 && best_obj < -2.0 && c1_forBest <=0 && c2_forBest <= 0) 22 | stop = true; 23 | end 24 | return 25 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_block_eval/fun.m: -------------------------------------------------------------------------------- 1 | function [ fout ] = fun( X ) 2 | 3 | % CRESCENT 5 --- Block evals version 4 | 5 | nb_points=size(X,1); 6 | n=size(X,2); 7 | 8 | if ( n ~= 5) 9 | error('Black box function must be provided with points of dimension 5 (=number of columns)'); 10 | end 11 | 12 | % objective 13 | obj=X(:,5); 14 | % constraints 15 | for m=1:nb_points 16 | c1(m)=sum((X(m,:)-1).^2)-25; 17 | c2(m)=25-sum((X(m,:)+1).^2); 18 | end 19 | 20 | % Unlike in the standard nomad version, a point cannot be 21 | % rejected in the matlab version. 22 | % If some points cannot be evaluated, objective and constraints must be set 23 | % to Inf, otherwise the nomad evaluator for block of evaluations cannot 24 | % continue. 25 | fout=[obj , c1' , c2']; 26 | 27 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_block_eval/run_nomad.m: -------------------------------------------------------------------------------- 1 | % CRESCENT 5 2 | 3 | % Parallel pool must be started separately (for multiple runs) or in the 4 | % script (single run) 5 | %parpool(2); 6 | 7 | x0 = [0 0 0 0 0 ]; 8 | lb = [-6 -6 -6 -6 -6 ]; 9 | ub = [6 6 6 6 6]; 10 | 11 | params = struct('display_degree','2','max_bb_eval','100','direction_type','ortho 2n','bb_output_type','OBJ PB PB','bb_max_block_size','4'); 12 | 13 | % Start optimization 14 | 15 | % Without callback 16 | % [x,fval,hinf,exit_status,nfeval] = nomadOpt(@fun,x0,lb,ub,params); 17 | 18 | % With callback 19 | [x,fval,hinf,exit_status,nfeval] = nomadOpt(@fun,x0,lb,ub,params,@cbFun); 20 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_count_eval/bb.m: -------------------------------------------------------------------------------- 1 | function [eval ] = bb(x) 2 | 3 | % IMPORTANT 4 | % This example illustrates the case where blackbox evaluations are not 5 | % counted when a hidden constraint is not satisfied. 6 | 7 | % Let's say this is a hidden constraint (i.e. not in BB_OUTPUT_TYPE) 8 | g = 1-x(1); 9 | 10 | if ( g > 0 ) 11 | eval = [0 , Inf] ; % The evaluation is not counted 12 | else 13 | eval =[1 , 10*(x(2)-x(1)^2)]; 14 | end 15 | 16 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_count_eval/run_nomad.m: -------------------------------------------------------------------------------- 1 | % This example illustrates the case where blackbox evaluations are not 2 | % counted when a hidden constraint is not satisfied. See bb.m. 3 | 4 | clc 5 | x0 = [1;1]; 6 | 7 | params = struct('display_all_eval','yes','display_degree','2','bb_output_type','CNT_EVAL OBJ', 'MAX_BB_EVAL','30','display_stats','bbe bbo'); 8 | [x,fval] = nomadOpt(@bb,x0,[-10;-10],[10;10], params); 9 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_int_variables/run.m: -------------------------------------------------------------------------------- 1 | %% MINLP 1 [fval = -5] 2 | %clc 3 | fun = @(x) [ (x(1) - 5)^2 + x(2)^2 - 25; 4 | x(1)^2 - x(2) + 0.5 ]'; 5 | x0 = [10; 10]; 6 | params = struct('display_degree','2','bb_input_type','*I','max_eval','100','direction_type','ortho 2n','bb_output_type','OBJ PB'); 7 | 8 | [xr,fval,ef,iter] = nomadOpt(fun,x0,[],[],params); 9 | 10 | 11 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_multiobj/bb.m: -------------------------------------------------------------------------------- 1 | function [eval ] = bb(x) 2 | 3 | obj1=0; 4 | obj2=0; 5 | for i=1:2 6 | obj1 = obj1 -10*exp(-0.2*(x(i)*x(i)+x(i+1)*x(i+1))^0.5); 7 | end 8 | 9 | for i=1:3 10 | obj2 = obj2 + abs(x(i))^0.8+5.0*sin(x(i)^3.0); 11 | end 12 | 13 | eval=[obj1 , obj2]; 14 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_multiobj/run.m: -------------------------------------------------------------------------------- 1 | % F. Kursawe, “A variant of evolution strategies for vector optimization,” in PPSN I, Vol 496 Lect Notes in Comput Sc. Springer-Verlag, 1991, pp. 193–197. 2 | 3 | x0 = [0 0 0 ]; 4 | lb = [-5 -5 -5 ]; 5 | ub = [5 5 5 ]; 6 | 7 | params = struct('display_degree','2','max_eval','1000','direction_type','ortho 2n','bb_output_type','OBJ OBJ','DMULTIMADS_OPTIMIZATION','true','SOLUTION_FILE','sol.txt','SOLUTION_FILE_FINAL','YES'); 8 | 9 | [x,fval,hinf,exit_status,nfeval] = nomadOpt(@bb,x0,lb,ub,params); 10 | 11 | 12 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_plot/fun.m: -------------------------------------------------------------------------------- 1 | function [ fout ] = fun( X ) 2 | 3 | % Share index between different fun call 4 | persistent index 5 | if isempty(index) 6 | index = 0; 7 | end 8 | 9 | n=size(X,2); 10 | 11 | if ( n ~= 5) 12 | error('Black box function must be provided with points of dimension 5'); 13 | end 14 | 15 | % CRESCENT 5 16 | %%%%%%%%%%%%%% 17 | 18 | % objective 19 | obj=X(5); 20 | 21 | % constraints 22 | c1=(sum(X(:)-1).^2)-25; 23 | c2=25-sum((X(:)+1).^2); 24 | 25 | % Outputs 26 | fout=[obj , c1 , c2]; 27 | 28 | 29 | 30 | % update the index 31 | index = index +1; 32 | 33 | % Plot only feasible point 34 | if ( c1 < 0 && c2 < 0) 35 | plot (index,obj,'bo'); 36 | drawnow; 37 | end -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_plot/run_nomad.m: -------------------------------------------------------------------------------- 1 | % CRESCENT 5 2 | 3 | clear fun; % Clear persistent index 4 | 5 | x0 = [0 0 0 0 0 ]'; 6 | lb = [-6 -6 -6 -6 -6 ]'; 7 | ub = [6 6 6 6 6]'; 8 | params = struct('display_degree','2','max_bb_eval','100','direction_type','ortho 2n','bb_output_type','OBJ PB PB'); 9 | 10 | % Create the plot 11 | figure; 12 | hold on; 13 | 14 | % Start optimization 15 | [x,fval] = nomadOpt(@fun,x0,lb,ub,params); 16 | 17 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_sgtelib/bb.m: -------------------------------------------------------------------------------- 1 | function eval = bb(x) 2 | 3 | eval=(1-x(1))^2 + 100 *(x(2)-x(1)^2)^2; 4 | 5 | end 6 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_sgtelib/param.txt: -------------------------------------------------------------------------------- 1 | MODEL_SEARCH SGTELIB 2 | MODEL_EVAL_SORT SGTELIB 3 | SGTELIB_MODEL_DISPLAY OS 4 | SGTELIB_MODEL_EVAL_NB 1000 -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_sgtelib/run.m: -------------------------------------------------------------------------------- 1 | % Rosenbrock 2 | %clc 3 | 4 | x0 = [0;0]; 5 | params = struct('display_degree','2','max_eval','100','bb_output_type','OBJ','param_file','param.txt'); 6 | 7 | [xr,fval,ef,iter] = nomadOpt(@bb,x0,[-10;-10],[10;10],params); 8 | 9 | 10 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_static_surrogate/bbsur.m: -------------------------------------------------------------------------------- 1 | function eval = bbsur(x,sur) 2 | 3 | if (nargin==1) 4 | sur=false; 5 | end 6 | 7 | % Almost same function (just some scaling) for surrogate and truth (see the impact on performance with or without using surrogate) 8 | if ( sur == true ) 9 | eval = [10*(x(2)-x(1)^2)^2+0.1*(1-x(1))^2]; 10 | else 11 | eval = [100*(x(2)-x(1)^2)^2+(1-x(1))^2]; 12 | end 13 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_static_surrogate/run_nomad.m: -------------------------------------------------------------------------------- 1 | %% TEST SURROGATE 2 | clc 3 | x0 = [-10;-10]; 4 | 5 | % Let's disable quad model search to show the impact of trial point sorting more clearly 6 | 7 | % Default is to use quad model for sorting trial points before true objective evaluations. 8 | % params = struct('display_degree','2','bb_output_type','OBJ','MAX_BB_EVAL','1000','QUAD_MODEL_SEARCH','false'); 9 | 10 | % Use "surrogate" for sorting trial points before true objective evaluations 11 | params = struct('display_degree','2','bb_output_type','OBJ','MAX_BB_EVAL','1000','QUAD_MODEL_SEARCH','false','EVAL_QUEUE_SORT','SURROGATE'); 12 | [x,fval] = nomadOpt(@bbsur,x0,[-10;-10],[10;10],params); 13 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_user_callback/cbFun.m: -------------------------------------------------------------------------------- 1 | function stop = cbFun(count,f,x) 2 | 3 | stop = false; 4 | if (count > 10 && f < 1.0 ) 5 | stop = true; 6 | end 7 | return 8 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Examples/example_user_callback/run.m: -------------------------------------------------------------------------------- 1 | % Example for user callback to stop optimization 2 | 3 | fun = @(x) (1-x(1))^2 + 100 *(x(2)-x(1)^2)^2; 4 | x0 = [-2 1]'; 5 | lb = [-Inf;-1.5]; 6 | ub = [100;100]; 7 | 8 | 9 | params = struct('initial_mesh_size','* 10','MAX_BB_EVAL','100','DISPLAY_ALL_EVAL','yes','DISPLAY_STATS','BBE ( SOL ) BBO'); 10 | 11 | % Start optimization 12 | [x,fval,hinf,exit_status,nfeval] = nomadOpt(fun,x0,lb,ub,params,@cbFun); 13 | 14 | -------------------------------------------------------------------------------- /interfaces/Matlab_MEX/Functions/nomadOpt.m: -------------------------------------------------------------------------------- 1 | % NOMAD Solve a Global MINLP/NLP using NOMAD, a Blackbox Optimization Library 2 | % 3 | % min f(x) subject to: nlcon(x) <= 0 4 | % x lb <= x <= ub 5 | % x in R 6 | % 7 | %%%%%%%%%%%%% GERAD VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8 | % [x,fval,hinf,runflag,nfval] = nomadOpt(fun,x0,lb,ub,params,cbFun) 9 | % 10 | % Input arguments: 11 | % fun - nonlinear function handle (f and nlcon) 12 | % x0 - initial solution guess. 13 | % lb - decision variable lower bounds. An empty lb ([]) can be provided. 14 | % ub - decision variable upper bounds. An empty ub ([]) can be provided. 15 | % params - parameters passed to the blackbox function as an array of strings using Nomad syntax (see user guide for the syntax). 16 | % cbFun - callback function handle (optional). When present, the function is called after calling fun. The user must provide a function that receives three input arguments: count_eval, fevals and x. Count_eval is the number of times fun has been called. Fevals and x are respectively the outputs returned by fun and its inputs. The function returns a boolean. If cbFun returns true, the optimization stops prematurely. 17 | % 18 | % Return arguments: 19 | % x - Best point 20 | % fval - objective value at the best point 21 | % hinf - Infeasibility at best point 22 | % runflag - Nomad run termination flag (see below) 23 | % nfval - number of function evaluations taken by the solver 24 | % 25 | % Run flags: 26 | % 1 - Objective target reached OR Mads converged (mesh criterion) to a feasible point (true problem). 27 | % 0 - At least one feasible point obtained and evaluation budget (single bb or block of bb) spent or max iteration (user option) reached. 28 | % -1 - Mads mesh converged but no feasible point obtained (only infeasible) for the true problem. 29 | % -2 - No feasible point obtained (only infeasible) and evaluation budget (single bb or block of bb) spent or max iteration (user option) reached 30 | % -3 - Initial point failed to evaluate 31 | % -4 - Time limit reached (user option) 32 | % -5 - CTRL-C or user stopped (callback function) 33 | % -6 - Stop on feasible point (user option) 34 | % 35 | % 36 | % NOMAD is released under the Lesser GNU Public License (LGPL). 37 | % Type nomadOpt('-info') to see license and author details. 38 | % 39 | % MEX Interface by C. Tribes 40 | -------------------------------------------------------------------------------- /interfaces/PyNomad/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | PyNomad.cpp 3 | *.so 4 | *.pyd 5 | *.obj 6 | dist 7 | build 8 | PyNomad.egg-info 9 | PyNomadBBO.egg-info 10 | PyNomadDev.egg-info 11 | -------------------------------------------------------------------------------- /interfaces/PyNomad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(PYNOMAD_SOURCE 2 | ${CMAKE_CURRENT_SOURCE_DIR}/nomadCySimpleInterface.cpp 3 | ${CMAKE_CURRENT_SOURCE_DIR}/PyNomad.pyx 4 | ${CMAKE_CURRENT_SOURCE_DIR}/setup.py 5 | ) 6 | 7 | 8 | # Modern-ish approach that does not (openly) complain about being deprecated. 9 | # The build process supports both GCC and MSVC. 10 | 11 | add_custom_target( 12 | PyNomad ALL 13 | COMMAND 14 | ${CMAKE_COMMAND} -E env "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "NOMAD_SRC=${CMAKE_SOURCE_DIR}/src" "NOMAD_BUILD_DIR=${CMAKE_BINARY_DIR}" "NOMAD_MSVC_FLAG=${MSVC}" "NOMAD_MSVC_CONF=$" "BUILD_OPENMP=${OpenMP_FOUND}" ${Python_EXECUTABLE} -m pip wheel -w dist -- . 15 | DEPENDS 16 | nomadStatic 17 | ${PYNOMAD_SOURCE} 18 | WORKING_DIRECTORY 19 | ${CMAKE_CURRENT_SOURCE_DIR} 20 | VERBATIM 21 | ) 22 | -------------------------------------------------------------------------------- /interfaces/PyNomad/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include readme.txt 2 | include LICENSE 3 | include long_description.md 4 | -------------------------------------------------------------------------------- /interfaces/PyNomad/long_description.md: -------------------------------------------------------------------------------- 1 | NOMAD is a blackbox optimization software coded in C++. PyNomad is the Python interface to NOMAD. 2 | 3 | NOMAD stands for Nonlinear Optimization using the MADS (Mesh Adaptive Direct Search) Algorithm. NOMAD and PyNomad solve constrained optimization problems of blackbox functions in the form: 4 | 5 | minimize f(x) 6 | 7 | subject to: nlcon(x) <= 0, lb <= x <= ub and x in R 8 | 9 | Once PyNomad is installed, a longer description is obtained by running PyNomad.info(). Examples of PyNomad utilization are provided in https://github.com/bbopt/nomad/tree/master/examples/advanced/library/PyNomad. 10 | 11 | **Please cite NOMAD 4 with reference:** 12 | 13 | C. Audet, S. Le Digabel, V. Rochon Montplaisir, and C. Tribes. 14 | Algorithm 1027: NOMAD version 4: Nonlinear optimization with the MADS algorithm. 15 | *ACM Transactions on Mathematical Software*. 16 | Volume 48, Issue 3, Article No.: 35, pp 1–22. 17 | https://doi.org/10.1145/3544489 18 | -------------------------------------------------------------------------------- /interfaces/PyNomad/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "PyNomadBBO" 3 | version = "4.5.1" 4 | authors = [ 5 | { name = "Jan Provaznik and Christophe Tribes", email="christophe.tribes@polymtl.ca"}, 6 | ] 7 | maintainers = [ 8 | { name = "Christophe Tribes", email="christophe.tribes@polymtl.ca"}, 9 | ] 10 | description = "Python interface to Nomad 4" 11 | readme = { file = "long_description.md", content-type = "text/markdown"} 12 | requires-python = ">=3.8" 13 | classifiers = [ 14 | "Programming Language :: Python :: 3", 15 | "Programming Language :: C++", 16 | "Operating System :: OS Independent", 17 | ] 18 | 19 | [project.urls] 20 | Documentation = "https://nomad-4-user-guide.readthedocs.io/" 21 | Repository = "https://github.com/bbopt/nomad.git" 22 | Issues = "https://github.com/bbopt/nomad/issues" 23 | 24 | [build-system] 25 | requires = [ 26 | 'setuptools', 27 | 'cython', 28 | 'wheel' 29 | ] 30 | 31 | [tool.setuptools] 32 | py-modules = [] 33 | -------------------------------------------------------------------------------- /interfaces/PyNomad/tests/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /interfaces/PyNomad/tests/test_block.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | 3 | def objective (point): 4 | return sum(point.get_coord(index) ** 2 for index in range(point.size())) 5 | 6 | def blackbox (eval_point): 7 | eval_value = objective(eval_point) 8 | eval_point.setBBO(str(eval_value).encode('utf-8')) 9 | return True 10 | 11 | def blackbox_block (eval_block): 12 | eval_state = [] 13 | for index in range(eval_block.size()): 14 | eval_point = eval_block.get_x(index) 15 | eval_state.append(blackbox(eval_point)) 16 | return eval_state 17 | 18 | def test_block (): 19 | x0 = [ 0.71, 0.51, 0.51 ] 20 | lb = [ -1, -1, -1 ] 21 | ub = [] 22 | 23 | params = [ 24 | 'BB_OUTPUT_TYPE OBJ', 25 | 'UPPER_BOUND * 1', 26 | 'DISPLAY_DEGREE 1', 27 | 'DISPLAY_STATS BBE BLK_SIZE OBJ', 28 | 'DISPLAY_ALL_EVAL false', 29 | 'MEGA_SEARCH_POLL yes', 30 | 'BB_MAX_BLOCK_SIZE 4' 31 | ] 32 | 33 | result = PyNomad.optimize(blackbox_block, x0, lb, ub, params) 34 | 35 | assert result['run_flag'] == 1 36 | for value in result['x_best']: 37 | assert abs(value) < 1e-6 38 | 39 | -------------------------------------------------------------------------------- /interfaces/PyNomad/tests/test_single.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | 3 | def objective (point): 4 | return sum(point.get_coord(index) ** 2 for index in range(point.size())) 5 | 6 | def blackbox (eval_point): 7 | eval_value = objective(eval_point) 8 | eval_point.setBBO(str(eval_value).encode('utf-8')) 9 | return True 10 | 11 | def test_single (): 12 | x0 = [ 0.71, 0.51, 0.51 ] 13 | lb = [ -1, -1, -1 ] 14 | ub = [] 15 | 16 | params = [ 17 | 'BB_OUTPUT_TYPE OBJ', 18 | 'UPPER_BOUND * 1', 19 | 'DISPLAY_DEGREE 1', 20 | 'DISPLAY_ALL_EVAL false', 21 | 'DISPLAY_STATS BBE OBJ' 22 | ] 23 | 24 | result = PyNomad.optimize(blackbox, x0, lb, ub, params) 25 | 26 | assert result['run_flag'] == 1 27 | for value in result['x_best']: 28 | assert abs(value) < 1e-6 29 | 30 | -------------------------------------------------------------------------------- /interfaces/PyNomad/tests/test_single_constraint.py: -------------------------------------------------------------------------------- 1 | import PyNomad 2 | 3 | def objective (point): 4 | return point.get_coord(4) 5 | 6 | def square (point, shift): 7 | return sum((point.get_coord(index) + shift) ** 2 8 | for index in range(point.size())) 9 | 10 | def constraint_one (point): 11 | return square(point, - 1) - 25 12 | 13 | def constraint_two (point): 14 | return 25 - square(point, + 1) 15 | 16 | def blackbox (eval_point): 17 | eval_f0 = objective(eval_point) 18 | eval_g0 = constraint_one(eval_point) 19 | eval_g1 = constraint_two(eval_point) 20 | 21 | eval_point.setBBO(f'{eval_f0} {eval_g0} {eval_g1}'.encode('utf-8')) 22 | return True 23 | 24 | def test_single_constraint (): 25 | x0 = [0, 0, 0, 0, 0] 26 | params = [ 27 | 'DIMENSION 5', 28 | 'MAX_BB_EVAL 400', 29 | 'BB_OUTPUT_TYPE OBJ EB EB', 30 | 'X0 * 0' , 31 | 'LOWER_BOUND * -6' , 32 | 'DISPLAY_DEGREE 2', 33 | 'DISPLAY_ALL_EVAL false', 34 | 'DISPLAY_STATS BBE OBJ' 35 | ] 36 | 37 | result = PyNomad.optimize(blackbox, x0, [], [], params) 38 | 39 | f_result = result['f_best'] 40 | f_expect = -4.0 41 | 42 | assert result['run_flag'] == 0 43 | assert abs(f_expect - f_result) < 1e-1 44 | 45 | -------------------------------------------------------------------------------- /interfaces/jNomad/.gitignore: -------------------------------------------------------------------------------- 1 | *.cxx 2 | *.o 3 | *.h 4 | *.so 5 | *.jar 6 | *.class 7 | *.jnilib 8 | *.dylib 9 | *.dll 10 | -------------------------------------------------------------------------------- /interfaces/jNomad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(UseSWIG) 2 | include(UseJava) 3 | 4 | set(CMAKE_SWIG_FLAGS -package jNomad) 5 | set_property(SOURCE jNomad.i PROPERTY CPLUSPLUS ON) 6 | swig_add_library(jNomad TYPE SHARED LANGUAGE java SOURCES jNomad.i) 7 | target_include_directories(jNomad PRIVATE ${JNI_INCLUDE_DIRS} PRIVATE ${JNI_INCLUDE_DIRS}/darwin) 8 | 9 | # 10 | # Build 11 | # 12 | swig_link_libraries(jNomad PUBLIC nomadAlgos nomadUtils nomadEval) 13 | set_target_properties(jNomad PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") 14 | 15 | # 16 | # Jar 17 | # 18 | set(CMAKE_JNI_TARGET TRUE) 19 | set(SWIG_JAVA_FILES 20 | ${CMAKE_CURRENT_BINARY_DIR}/AllParameters.java 21 | ${CMAKE_CURRENT_BINARY_DIR}/ArrayOfDouble.java 22 | ${CMAKE_CURRENT_BINARY_DIR}/CacheBase.java 23 | ${CMAKE_CURRENT_BINARY_DIR}/Double.java 24 | ${CMAKE_CURRENT_BINARY_DIR}/Eval.java 25 | ${CMAKE_CURRENT_BINARY_DIR}/EvalParameters.java 26 | ${CMAKE_CURRENT_BINARY_DIR}/EvalPoint.java 27 | ${CMAKE_CURRENT_BINARY_DIR}/EvalPointVector.java 28 | ${CMAKE_CURRENT_BINARY_DIR}/EvalType.java 29 | ${CMAKE_CURRENT_BINARY_DIR}/Evaluator.java 30 | ${CMAKE_CURRENT_BINARY_DIR}/EvalXDefined.java 31 | ${CMAKE_CURRENT_BINARY_DIR}/jNomad.java 32 | ${CMAKE_CURRENT_BINARY_DIR}/jNomadConstants.java 33 | ${CMAKE_CURRENT_BINARY_DIR}/jNomadJNI.java 34 | ${CMAKE_CURRENT_BINARY_DIR}/MainStep.java 35 | ${CMAKE_CURRENT_BINARY_DIR}/Point.java 36 | ${CMAKE_CURRENT_BINARY_DIR}/Step.java 37 | ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_std__vectorT_bool_t.java 38 | ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_std__vectorT_double_t.java 39 | ${CMAKE_CURRENT_BINARY_DIR}/SWIGTYPE_p_std__vectorT_std__shared_ptrT_${NOMAD_SRC_TEMPLATE}__EvalPoint_t_t.java 40 | ) 41 | add_jar(jNomad_jar SOURCES ${SWIG_JAVA_FILES} OUTPUT_NAME "jNomad") 42 | 43 | set_target_properties(jNomad_jar PROPERTIES CLASSDIR "${CMAKE_CURRENT_BINARY_DIR}/") 44 | 45 | add_dependencies(jNomad_jar jNomad) 46 | 47 | # 48 | # Install binary, java, class and jar 49 | # 50 | install(TARGETS jNomad 51 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 52 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 53 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/) 54 | 55 | install_jar(jNomad_jar DESTINATION ${CMAKE_INSTALL_LIBDIR}) 56 | 57 | # This one is to run the example in the current source directory 58 | install_jar(jNomad_jar DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}) 59 | install(TARGETS jNomad DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}) 60 | -------------------------------------------------------------------------------- /interfaces/jNomad/Readme: -------------------------------------------------------------------------------- 1 | How to compile Java wrapper for Nomad ? 2 | ======================================= 3 | Requirements: 4 | - SWIG (http://www.swig.org/) 5 | - C/C++ compiler 6 | - Java (JDK >=8) 7 | 8 | Step 1: In the $NOMAD_HOME directory do 9 | cmake -DBUILD_INTERFACE_JAVA=ON -S . -B build/release 10 | cmake --build build/release 11 | cmake --install build/release 12 | 13 | Note: Building may require to set JAVA_HOME variable and uncomment 14 | lines in root CMakeLists.txt (issue #83) 15 | 16 | 17 | How to run the example ? 18 | ======================== 19 | 20 | Step 2: In the $NOMAD_HOME/interfaces/jNomad do 21 | javac -cp ./jNomad.jar Examples/Rosenbrock.java 22 | java -cp .:./jNomad.jar Examples/Rosenbrock 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Attribute/cacheAttributesDefinition.txt: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | ###### Definition of CacheParameters attributes ############ 3 | ##### 4 | ##### . Each definition must be separated by at least a comment line 5 | ##### (starting by #) 6 | ##### 7 | ##### . The definition must provide the name, type and default value 8 | ##### (no default: '-' or 'N/A') in this order, one by line. 9 | ##### 10 | ##### . Only a single word is considered for the name, 11 | ##### type and default value (extra is comment) 12 | ##### 13 | ##### . The short info, the help and the keywords must be provided in this 14 | ##### order within "\(" and "\). For keywords, the plural part of a word 15 | ##### can be put in parenthesis; both singular and plural will be keywords 16 | ##### 17 | ##### . The default value is automatically reported in the help. 18 | ##### 19 | ##### . In addition, the definition can have optional attributes: 20 | ##### - ALGO_COMPATIBILITY_CHECK yes/no, the default is no. If yes, the 21 | ##### value of this attribute can be used for comparing two sets of 22 | ##### attributes for algorithm compatibility. This is used by the 23 | ##### Runner. 24 | ##### 25 | ##### - RESTART_ATTRIBUTE yes/no, the default is no. If yes, the 26 | ##### value of this attribute can be modified during hot or warm 27 | ##### restart. Otherwise, modifying this attribute during hot restart 28 | ##### will trigger an error message. 29 | ##### 30 | ##### - UNIQUE_ENTRY yes/no, the default is yes. If no, multiple 31 | ##### values may be assigned to this parameter. 32 | ##### 33 | ############################################################################### 34 | CACHE_FILE 35 | std::string 36 | "" 37 | \( Cache file name \) 38 | \( 39 | 40 | . Cache file. If the specified file does not exist, it will be created. 41 | 42 | . Argument: one string. 43 | 44 | . If the string is empty, no cache file will be created. 45 | 46 | . Points already in the cache file will not be reevaluated. 47 | 48 | . Example: CACHE_FILE cache.txt 49 | 50 | \) 51 | \( basic cache file \) 52 | ALGO_COMPATIBILITY_CHECK no 53 | RESTART_ATTRIBUTE no 54 | ############################################################################### 55 | CACHE_SIZE_MAX 56 | size_t 57 | INF 58 | \( Maximum number of evaluation points to be stored in the cache \) 59 | \( 60 | 61 | . The cache will be purged from older points if it reaches this number 62 | of evaluation points. 63 | 64 | . Argument: one positive integer (expressed in number of evaluation points). 65 | 66 | . Example: CACHE_SIZE_MAX 10000 67 | 68 | \) 69 | \( advanced cache \) 70 | ALGO_COMPATIBILITY_CHECK no 71 | RESTART_ATTRIBUTE no 72 | ############################################################################### 73 | -------------------------------------------------------------------------------- /src/Attribute/runAttributesDefinitionCOOP.txt: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | ####### Definition of Run Parameters attributes (COOP) ############ 3 | ##### 4 | ##### . Each definition must be separated by at least a comment line 5 | ##### (starting by #) 6 | ##### 7 | ##### . The definition must provide the name, type and default value 8 | ##### (no default: '-' or 'N/A') in this order, one by line. 9 | ##### 10 | ##### . Only a single word is considered for the name, 11 | ##### type and default value (extra is comment) 12 | ##### 13 | ##### . The short info, the help and the keywords must be provided in this 14 | ##### order within "\(" and "\). For keywords, the plural part of a word 15 | ##### can be put in parenthesis; both singular and plural will be keywords 16 | ##### 17 | ##### . The default value is automatically reported in the help. 18 | ##### 19 | ##### . In addition, the definition can have optional attributes: 20 | ##### - ALGO_COMPATIBILITY_CHECK yes/no, the default is no. If yes, the 21 | ##### value of this attribute can be used for comparing two sets of 22 | ##### attributes for algorithm compatibility. This is used by the 23 | ##### Runner. 24 | ##### 25 | ##### - RESTART_ATTRIBUTE yes/no, the default is no. If yes, the 26 | ##### value of this attribute can be modified during hot or warm 27 | ##### restart. Otherwise, modifying this attribute during hot restart 28 | ##### will trigger an error message. 29 | ##### 30 | ##### - UNIQUE_ENTRY yes/no, the default is yes. If no, multiple 31 | ##### values may be assigned to this parameter. 32 | ##### 33 | ############################################################################### 34 | COOP_MADS_OPTIMIZATION 35 | bool 36 | false 37 | \( COOP-MADS optimization algorithm \) 38 | \( 39 | 40 | . Use COOP-MADS algorithm. Only available if code is built with OpenMP enabled. 41 | 42 | . Argument: bool 43 | 44 | . Description: Parallel concurrent Mads 45 | 46 | . This option deactivates any other optimization strategy. 47 | 48 | . Example: COOP_MADS_OPTIMIZATION true 49 | 50 | \) 51 | \( advanced coop mads parallel \) 52 | ALGO_COMPATIBILITY_CHECK yes 53 | RESTART_ATTRIBUTE no 54 | ################################################################################ 55 | COOP_MADS_NB_PROBLEM 56 | size_t 57 | 4 58 | \( Number of COOP-MADS problems \) 59 | \( 60 | 61 | . When using COOP MADS optimization, select the number of 62 | Mads problems ran in parallel. 63 | 64 | . In addition each Mads algorithm can perform evaluations in parallel when 65 | the NB_THREADS_PARALLEL_EVAL is greater than 1. 66 | 67 | . Argument: a positive integer. 68 | 69 | . This attribute is used only when COOP-Mads optimization is active. 70 | 71 | . Example: COOP_MADS_NB_PROBLEM 2 72 | 73 | \) 74 | \( advanced psd mads parallel decomposition subproblem \) 75 | ALGO_COMPATIBILITY_CHECK yes 76 | RESTART_ATTRIBUTE no 77 | ################################################################################ 78 | COOP_MADS_OPTIMIZATION_CACHE_SEARCH 79 | bool 80 | true 81 | \( COOP-MADS cache search for incumbent synchronization \) 82 | \( 83 | 84 | . Perform a cache search to update the best incumbent obtained by all Mads. 85 | This allows to synchronize the best solutions of the parallel Mads instances. 86 | 87 | . This attribute is used only when COOP-Mads optimization is active. 88 | 89 | . Argument: bool. 90 | 91 | . Example: COOP_MADS_OPTIMIZATION_CACHE_SEARCH false 92 | 93 | \) 94 | \( advanced psd mads parallel decomposition subproblem \) 95 | ALGO_COMPATIBILITY_CHECK yes 96 | RESTART_ATTRIBUTE no 97 | ################################################################################ 98 | -------------------------------------------------------------------------------- /src/Attribute/runAttributesDefinitionCS.txt: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | ####### Definition of Run Parameters attributes (CS) ############ 3 | ##### 4 | ##### . Each definition must be separated by at least a comment line 5 | ##### (starting by #) 6 | ##### 7 | ##### . The definition must provide the name, type and default value 8 | ##### (no default: '-' or 'N/A') in this order, one by line. 9 | ##### 10 | ##### . Only a single word is considered for the name, 11 | ##### type and default value (extra is comment) 12 | ##### 13 | ##### . The short info, the help and the keywords must be provided in this 14 | ##### order within "\(" and "\). For keywords, the plural part of a word 15 | ##### can be put in parenthesis; both singular and plural will be keywords 16 | ##### 17 | ##### . The default value is automatically reported in the help. 18 | ##### 19 | ##### . In addition, the definition can have optional attributes: 20 | ##### - ALGO_COMPATIBILITY_CHECK yes/no, the default is no. If yes, the 21 | ##### value of this attribute can be used for comparing two sets of 22 | ##### attributes for algorithm compatibility. This is used by the 23 | ##### Runner. 24 | ##### 25 | ##### - RESTART_ATTRIBUTE yes/no, the default is no. If yes, the 26 | ##### value of this attribute can be modified during hot or warm 27 | ##### restart. Otherwise, modifying this attribute during hot restart 28 | ##### will trigger an error message. 29 | ##### 30 | ##### - UNIQUE_ENTRY yes/no, the default is yes. If no, multiple 31 | ##### values may be assigned to this parameter. 32 | ##### 33 | ############################################################################### 34 | CS_OPTIMIZATION 35 | bool 36 | false 37 | \( Coordinate Search optimization \) 38 | \( 39 | 40 | . Coordinate search optimization. When enabled, the DIRECTION_TYPE is forced 41 | to CS. 42 | 43 | . Argument: bool 44 | 45 | . Example: CS_OPTIMIZATION true 46 | 47 | \) 48 | \( basic coordinate search \) 49 | ALGO_COMPATIBILITY_CHECK yes 50 | RESTART_ATTRIBUTE yes 51 | ################################################################################ 52 | -------------------------------------------------------------------------------- /src/Attribute/runAttributesDefinitionIBEX.txt: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | ####### Definition of Run Parameters attributes ############ 3 | ##### 4 | ##### . Each definition must be separated by at least a comment line 5 | ##### (starting by #) 6 | ##### 7 | ##### . The definition must provide the name, type and default value 8 | ##### (no default: '-' or 'N/A') in this order, one by line. 9 | ##### 10 | ##### . Only a single word is considered for the name, 11 | ##### type and default value (extra is comment) 12 | ##### 13 | ##### . The short info, the help and the keywords must be provided in this 14 | ##### order within "\(" and "\). For keywords, the plural part of a word 15 | ##### can be put in parenthesis; both singular and plural will be keywords 16 | ##### 17 | ##### . The default value is automatically reported in the help. 18 | ##### 19 | ##### . In addition, the definition can have optional attributes: 20 | ##### - ALGO_COMPATIBILITY_CHECK yes/no, the default is no. If yes, the 21 | ##### value of this attribute can be used for comparing two sets of 22 | ##### attributes for algorithm compatibility. This is used by the 23 | ##### Runner. 24 | ##### 25 | ##### - RESTART_ATTRIBUTE yes/no, the default is no. If yes, the 26 | ##### value of this attribute can be modified during hot or warm 27 | ##### restart. Otherwise, modifying this attribute during hot restart 28 | ##### will trigger an error message. 29 | ##### 30 | ##### - UNIQUE_ENTRY yes/no, the default is yes. If no, multiple 31 | ##### values may be assigned to this parameter. 32 | ##### 33 | ############################################################################### 34 | USE_IBEX 35 | bool 36 | false 37 | \( Boolean to determine if we want to use the functionnalities of IBEX \) 38 | \( 39 | 40 | . Argument : bool 41 | 42 | . Determine if you want to use the fonctionnalities of IBEX 43 | 44 | \) 45 | \( advanced project algorithm ibex snap \) 46 | ALGO_COMPATIBILITY_CHECK yes 47 | RESTART_ATTRIBUTE yes 48 | ################################################################################ 49 | SYSTEM_FILE_NAME 50 | string 51 | - 52 | \( File with the constraints \) 53 | \( 54 | 55 | . Minibex file name, describing the system (i.e constraints, variables...) of the problem. 56 | 57 | . See the documentation here for more detail : http://www.ibex-lib.org/doc/minibex.html on how to create it. 58 | 59 | \) 60 | \( advanced project algorithm ibex snap \) 61 | ALGO_COMPATIBILITY_CHECK yes 62 | RESTART_ATTRIBUTE yes 63 | ################################################################################ 64 | SET_FILE 65 | bool 66 | false 67 | \( Boolean to determine if the file of the set is already created \) 68 | \( 69 | 70 | . Argument : bool 71 | 72 | . Determine if the Set of the problem is already created. 73 | 74 | \) 75 | \( advanced project algorithm ibex snap \) 76 | ALGO_COMPATIBILITY_CHECK yes 77 | RESTART_ATTRIBUTE yes 78 | ################################################################################ 79 | SET_FILE_NAME 80 | string 81 | - 82 | \( File to load with the set \) 83 | \( 84 | 85 | . Argument : string 86 | 87 | . Name of the Set file. 88 | 89 | . No need to be provided if SET_FILE = false. 90 | 91 | \) 92 | \( advanced project algorithm ibex snap \) 93 | ALGO_COMPATIBILITY_CHECK yes 94 | RESTART_ATTRIBUTE yes 95 | ################################################################################ 96 | -------------------------------------------------------------------------------- /src/Attribute/runAttributesDefinitionLH.txt: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | ####### Definition of Run Parameters attributes ############ 3 | ##### 4 | ##### . Each definition must be separated by at least a comment line 5 | ##### (starting by #) 6 | ##### 7 | ##### . The definition must provide the name, type and default value 8 | ##### (no default: '-' or 'N/A') in this order, one by line. 9 | ##### 10 | ##### . Only a single word is considered for the name, 11 | ##### type and default value (extra is comment) 12 | ##### 13 | ##### . The short info, the help and the keywords must be provided in this 14 | ##### order within "\(" and "\). For keywords, the plural part of a word 15 | ##### can be put in parenthesis; both singular and plural will be keywords 16 | ##### 17 | ##### . The default value is automatically reported in the help. 18 | ##### 19 | ##### . In addition, the definition can have optional attributes: 20 | ##### - ALGO_COMPATIBILITY_CHECK yes/no, the default is no. If yes, the 21 | ##### value of this attribute can be used for comparing two sets of 22 | ##### attributes for algorithm compatibility. This is used by the 23 | ##### Runner. 24 | ##### 25 | ##### - RESTART_ATTRIBUTE yes/no, the default is no. If yes, the 26 | ##### value of this attribute can be modified during hot or warm 27 | ##### restart. Otherwise, modifying this attribute during hot restart 28 | ##### will trigger an error message. 29 | ##### 30 | ##### - UNIQUE_ENTRY yes/no, the default is yes. If no, multiple 31 | ##### values may be assigned to this parameter. 32 | ##### 33 | ############################################################################### 34 | LH_EVAL 35 | size_t 36 | 0 37 | \( Latin Hypercube Sampling of points (no optimization) \) 38 | \( 39 | 40 | . Latin-Hypercube sampling (evaluations) 41 | 42 | . Argument: A positive integer p < INF. 43 | 44 | . p: number of LH points 45 | 46 | . All points will be evaluated (no opportunism). 47 | 48 | . This option will not work with Mads but can be combined with quadratic 49 | model optimization to have enough points to construct models. 50 | 51 | . The LH sampling requires to have both lower and upper bounds defined. 52 | 53 | . Example: LH_EVAL 100 54 | 55 | \) 56 | \( basic latin hypercube sampling \) 57 | ALGO_COMPATIBILITY_CHECK yes 58 | RESTART_ATTRIBUTE yes 59 | ################################################################################ 60 | LH_SEARCH 61 | NOMAD::LHSearchType 62 | - 63 | \( Latin Hypercube Sampling Search method \) 64 | \( 65 | 66 | . Latin-Hypercube sampling (search) 67 | 68 | . Arguments: two size_t p0 and pi < INF. 69 | 70 | . p0: number of initial LH search points. These points are handled as X0s 71 | (no opportunism for evaluation). 72 | 73 | . pi: LH search points at each iteration. The iteration search can be 74 | opportunistic or not (parameter EVAL_OPPORTUNISTIC). 75 | 76 | . Example: LH_SEARCH 100 0 77 | 78 | \) 79 | \( basic search latin hypercube sampling \) 80 | ALGO_COMPATIBILITY_CHECK yes 81 | RESTART_ATTRIBUTE yes 82 | ################################################################################ 83 | -------------------------------------------------------------------------------- /src/CMakeListsExes.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Build executables 3 | # 4 | 5 | add_executable( 6 | nomadExecutable ${NOMAD_SOURCES} 7 | ) 8 | 9 | target_link_libraries( 10 | nomadExecutable 11 | PUBLIC nomadAlgos nomadUtils nomadEval 12 | ) 13 | 14 | target_include_directories( 15 | nomadExecutable 16 | PUBLIC 17 | $ 21 | $ 24 | ) 25 | 26 | if(OpenMP_CXX_FOUND) 27 | target_link_libraries( 28 | nomadExecutable 29 | PUBLIC OpenMP::OpenMP_CXX 30 | ) 31 | endif() 32 | 33 | set_target_properties( 34 | nomadExecutable 35 | PROPERTIES 36 | INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" 37 | ) 38 | 39 | 40 | set_target_properties( 41 | nomadExecutable 42 | PROPERTIES 43 | VERSION "${NOMAD_VERSION}" 44 | SOVERSION "${NOMAD_VERSION_MAJOR}.${NOMAD_VERSION_MINOR}" 45 | OUTPUT_NAME nomad 46 | ) 47 | 48 | # 49 | # Install executable 50 | # 51 | 52 | # installing executables and libraries 53 | install( 54 | TARGETS 55 | nomadExecutable 56 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 57 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 58 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ 59 | ) 60 | 61 | -------------------------------------------------------------------------------- /src/CMakeListsExesStatic.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Build executables 3 | # 4 | 5 | add_executable( 6 | nomadExecutableStatic ${NOMAD_SOURCES} 7 | ) 8 | 9 | target_link_libraries( 10 | nomadExecutableStatic 11 | PUBLIC nomadStatic 12 | ) 13 | 14 | target_include_directories( 15 | nomadExecutableStatic 16 | PUBLIC 17 | $ 21 | $ 24 | ) 25 | 26 | if(OpenMP_CXX_FOUND) 27 | target_link_libraries( 28 | nomadExecutableStatic 29 | PUBLIC OpenMP::OpenMP_CXX 30 | ) 31 | endif() 32 | 33 | set_target_properties( 34 | nomadExecutableStatic 35 | PROPERTIES 36 | VERSION "${NOMAD_VERSION}" 37 | SOVERSION "${NOMAD_VERSION_MAJOR}.${NOMAD_VERSION_MINOR}" 38 | OUTPUT_NAME nomad 39 | ) 40 | 41 | 42 | if (WIN32) 43 | target_compile_definitions( 44 | nomadExecutableStatic 45 | PRIVATE 46 | -DNOMAD_STATIC_BUILD 47 | ) 48 | endif() 49 | 50 | 51 | # 52 | # Install executable 53 | # 54 | 55 | # installing executables and libraries 56 | install( 57 | TARGETS 58 | nomadExecutableStatic 59 | RUNTIME 60 | DESTINATION ${CMAKE_INSTALL_BINDIR} 61 | LIBRARY 62 | DESTINATION ${CMAKE_INSTALL_LIBDIR} 63 | PUBLIC_HEADER 64 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ 65 | ) 66 | 67 | -------------------------------------------------------------------------------- /src/Util/defines.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------------*/ 2 | /* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct Search - */ 3 | /* */ 4 | /* NOMAD - Version 4 has been created and developed by */ 5 | /* Viviane Rochon Montplaisir - Polytechnique Montreal */ 6 | /* Christophe Tribes - Polytechnique Montreal */ 7 | /* */ 8 | /* The copyright of NOMAD - version 4 is owned by */ 9 | /* Charles Audet - Polytechnique Montreal */ 10 | /* Sebastien Le Digabel - Polytechnique Montreal */ 11 | /* Viviane Rochon Montplaisir - Polytechnique Montreal */ 12 | /* Christophe Tribes - Polytechnique Montreal */ 13 | /* */ 14 | /* NOMAD 4 has been funded by Rio Tinto, Hydro-Québec, Huawei-Canada, */ 15 | /* NSERC (Natural Sciences and Engineering Research Council of Canada), */ 16 | /* InnovÉÉ (Innovation en Énergie Électrique) and IVADO (The Institute */ 17 | /* for Data Valorization) */ 18 | /* */ 19 | /* NOMAD v3 was created and developed by Charles Audet, Sebastien Le Digabel, */ 20 | /* Christophe Tribes and Viviane Rochon Montplaisir and was funded by AFOSR */ 21 | /* and Exxon Mobil. */ 22 | /* */ 23 | /* NOMAD v1 and v2 were created and developed by Mark Abramson, Charles Audet, */ 24 | /* Gilles Couture, and John E. Dennis Jr., and were funded by AFOSR and */ 25 | /* Exxon Mobil. */ 26 | /* */ 27 | /* Contact information: */ 28 | /* Polytechnique Montreal - GERAD */ 29 | /* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ 30 | /* e-mail: nomad@gerad.ca */ 31 | /* */ 32 | /* This program is free software: you can redistribute it and/or modify it */ 33 | /* under the terms of the GNU Lesser General Public License as published by */ 34 | /* the Free Software Foundation, either version 3 of the License, or (at your */ 35 | /* option) any later version. */ 36 | /* */ 37 | /* This program is distributed in the hope that it will be useful, but WITHOUT */ 38 | /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 39 | /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ 40 | /* for more details. */ 41 | /* */ 42 | /* You should have received a copy of the GNU Lesser General Public License */ 43 | /* along with this program. If not, see . */ 44 | /* */ 45 | /* You can find information on the NOMAD software at www.gerad.ca/nomad */ 46 | /*---------------------------------------------------------------------------------*/ 47 | --------------------------------------------------------------------------------