1234567891011121314151617181920212223242526272829303132 |
- #ifndef OPTIMIZERBASE_H
- #define OPTIMIZERBASE_H
- #include "IOptimizer.h"
- #include "exprtk.hpp"
- namespace mdd {
- class OptimizerBase : public IOptimizer {
- protected:
- std::shared_ptr<IModule> _module;
- std::vector<std::shared_ptr<IInput>> _inputs;
- std::vector<json> _input_limits;
- std::vector<std::shared_ptr<IOutput>> _outputs;
- std::vector<double> _output_vals;
- exprtk::expression<double> _func_expr;
- struct opt_state {
- state module_state;
- double opt_value = 0;
- };
- opt_state updateReader();
- public:
- bool addModifier(std::string input_id, const json& limit) override;
- bool addReader(std::string output_id) override;
- bool changeModifier(std::string input_id, const json& limit) override;
- void removeModifier(std::string input_id) override;
- void removeReader(std::string output_id) override;
- bool setEvaluation(std::string func) override;
- //state update() override;
- };
- }
- #endif
|