Line data Source code
1 : #pragma once 2 : 3 : #include "Opt/GeneticSolver.hpp" 4 : #include "Opt/UnivariateSolver.hpp" 5 : 6 : namespace Opt { 7 7 : class GeneticIntervalSolver: public UnivariateSolver { 8 : GeneticSolver solver; 9 : 10 : Var left, right; 11 : 12 : size_t initialPopulationSize; 13 : 14 : public: 15 : // clang-format off 16 : GeneticIntervalSolver( 17 : size_t populationSize = 8, 18 : size_t newPopulationSize = 8, 19 : Var variabilityCoeff = 0.1, 20 : size_t maxNumberGenerations = 1000, 21 : int parallelism = 8, 22 : std::shared_ptr<std::mt19937> gen = std::make_shared<std::mt19937>(0) 23 : ); 24 : // clang-format on 25 : 26 : void setInterval(Var l, Var r); 27 : virtual void setStopCriteria(Var e); 28 : 29 : virtual Var solve(Problem p); 30 : }; 31 : } // namespace Opt