11 #include <eigen3/Eigen/Dense>
81 template<
class SystemType,
int N,
int min_steps_on,
int min_steps_off,
int max_steps_on,
int num_steps_solver_delay, INTEGRATION_SCHEME
integration_scheme> requires
82 std::derived_from<SystemType, System<SystemType::NUM_STATES, SystemType::NUM_CONT_INPUTS, SystemType::NUM_BIN_INPUTS>>
85 using SYSTEM_TYPE = SystemType;
86 static constexpr
auto PRED_STEPS = N;
87 static constexpr
auto MIN_STEPS_ON = min_steps_on;
88 static constexpr
auto MIN_STEPS_OFF = min_steps_off;
89 static constexpr
auto MAX_STEPS_ON = max_steps_on;
90 static constexpr
auto NUM_STEPS_SOLVER_DELAY = num_steps_solver_delay;
97 {0, max_steps_on - num_steps_solver_delay, min_steps_off - num_steps_solver_delay,
98 min_steps_on - num_steps_solver_delay});
99 virtual ~
Solver() =
default;
173 virtual void setSetPoint(
const SystemType::StateVec &set_point) = 0;
180 virtual void setState(
const SystemType::StateVec &state) = 0;
189 const Eigen::Matrix<double, SystemType::NUM_INPUTS, history_depth> &bin_input_hist) = 0;
197 setNextInputs(
const Eigen::Matrix<double, SystemType::NUM_INPUTS, num_steps_solver_delay> &next_inputs) = 0;
222 solve(
const Eigen::Matrix<double, SystemType::NUM_INPUTS, N, Eigen::RowMajor> &last_open_loop_input,
223 const Eigen::Matrix<double, SystemType::NUM_STATES, N + 1, Eigen::RowMajor> &last_open_loop_state,
224 Eigen::Matrix<double, SystemType::NUM_INPUTS, N, Eigen::RowMajor> &open_loop_input,
225 Eigen::Matrix<double, SystemType::NUM_STATES, N + 1, Eigen::RowMajor> &open_loop_state)
const = 0;
INTEGRATION_SCHEME
Definition: Solver.hpp:54
@ BACKWARD_EULER
Definition: Solver.hpp:62
@ FORWARD_EULER
Definition: Solver.hpp:58
SOLVER_RETURN
Definition: Solver.hpp:18
@ TIME_LIMIT_WITH_SOLUTION
Definition: Solver.hpp:30
@ NO_SOLUTION
Definition: Solver.hpp:26
@ USER_INTERRUPT
Definition: Solver.hpp:34
@ OPTIMAL
Definition: Solver.hpp:22
COST_TYPE
Definition: Solver.hpp:40
@ L2Quadratic
Definition: Solver.hpp:48
@ L1Linear
Definition: Solver.hpp:44
Abstract class to represent system dynamics.
Definition: Solver.hpp:83
virtual void addInputConstraintOnIndex(int index, double lb, double ub)=0
virtual void addInputConstraintOnStep(int step, const SystemType::InputVec &lb, const SystemType::InputVec &ub)=0
static constexpr int history_depth
Definition: Solver.hpp:96
virtual void addStateConstraintOnStep(int step, const SystemType::StateVec &lb, const SystemType::StateVec &ub)=0
virtual void setState(const SystemType::StateVec &state)=0
virtual unsigned int getStepsToCompensateControllerDelay()=0
virtual void setInputWeights(const SystemType::InputVec &state_weights)=0
virtual void setStateWeights(const SystemType::StateVec &state_weights)=0
virtual void setFinalWeights(const SystemType::StateVec &final_weights)=0
virtual void addStateConstraintOnIndex(int index, double lb, double ub)=0
virtual void setCost(COST_TYPE cost_type)=0
virtual SOLVER_RETURN solve(const Eigen::Matrix< double, SystemType::NUM_INPUTS, N, Eigen::RowMajor > &last_open_loop_input, const Eigen::Matrix< double, SystemType::NUM_STATES, N+1, Eigen::RowMajor > &last_open_loop_state, Eigen::Matrix< double, SystemType::NUM_INPUTS, N, Eigen::RowMajor > &open_loop_input, Eigen::Matrix< double, SystemType::NUM_STATES, N+1, Eigen::RowMajor > &open_loop_state) const =0
virtual void setSolverTimeLimit(double max_seconds)=0
virtual void setNextInputs(const Eigen::Matrix< double, SystemType::NUM_INPUTS, num_steps_solver_delay > &next_inputs)=0
virtual void setSetPoint(const SystemType::StateVec &set_point)=0
virtual void setInputHistory(const Eigen::Matrix< double, SystemType::NUM_INPUTS, history_depth > &bin_input_hist)=0