OptimizerBase.h 916 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef OPTIMIZERBASE_H
  2. #define OPTIMIZERBASE_H
  3. #include "IOptimizer.h"
  4. #include "exprtk.hpp"
  5. namespace mdd {
  6. class OptimizerBase : public IOptimizer {
  7. protected:
  8. std::shared_ptr<IModule> _module;
  9. std::vector<std::shared_ptr<IInput>> _inputs;
  10. std::vector<json> _input_limits;
  11. std::vector<std::shared_ptr<IOutput>> _outputs;
  12. std::vector<double> _output_vals;
  13. exprtk::expression<double> _func_expr;
  14. struct opt_state {
  15. state module_state;
  16. double opt_value = 0;
  17. };
  18. opt_state updateReader();
  19. public:
  20. bool addModifier(std::string input_id, const json& limit) override;
  21. bool addReader(std::string output_id) override;
  22. bool changeModifier(std::string input_id, const json& limit) override;
  23. void removeModifier(std::string input_id) override;
  24. void removeReader(std::string output_id) override;
  25. bool setEvaluation(std::string func) override;
  26. //state update() override;
  27. };
  28. }
  29. #endif