MIMPC++
A fast typesafe Mixed Integer MPC C++ library
Public Types | Public Member Functions | List of all members
mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme > Class Template Reference

#include <SCIPSolver.hpp>

Inheritance diagram for mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >:
Inheritance graph
[legend]
Collaboration diagram for mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >:
Collaboration graph
[legend]

Public Types

using SolverBase = Solver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >
 
- Public Types inherited from mimpc::Solver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >
using SYSTEM_TYPE = SystemType
 

Public Member Functions

 SCIPSolver (const typename SystemType::StateVec &state_weights, const typename SystemType::StateVec &final_weights, const typename SystemType::InputVec &input_weights, const typename SystemType::StateVec &set_point, COST_TYPE cost_type, const SystemType &system, double system_dt)
 
void addInputConstraintOnIndex (int index, double lb, double ub) override
 
void addStateConstraintOnIndex (int index, double lb, double ub) override
 
void addInputConstraintOnStep (int step, const typename SystemType::InputVec &lb, const typename SystemType::InputVec &ub) override
 
void addStateConstraintOnStep (int step, const typename SystemType::StateVec &lb, const typename SystemType::StateVec &ub) override
 
void setFinalWeights (const typename SystemType::StateVec &final_weights) override
 
void setStateWeights (const typename SystemType::StateVec &state_weights) override
 
void setInputWeights (const typename SystemType::InputVec &state_weights) override
 
void setSetPoint (const typename SystemType::StateVec &set_point) override
 
void setState (const typename SystemType::StateVec &state) override
 
void setInputHistory (const typename Eigen::Matrix< double, SystemType::NUM_INPUTS, SolverBase::history_depth > &bin_input_hist) override
 
void setNextInputs (const typename Eigen::Matrix< double, SystemType::NUM_INPUTS, num_steps_solver_delay > &next_inputs) override
 
void setSolverTimeLimit (double max_seconds) override
 
SOLVER_RETURN solve (const typename Eigen::Matrix< double, SystemType::NUM_INPUTS, N, Eigen::RowMajor > &last_open_loop_input, const typename Eigen::Matrix< double, SystemType::NUM_STATES, N+1, Eigen::RowMajor > &last_open_loop_state, typename Eigen::Matrix< double, SystemType::NUM_INPUTS, N, Eigen::RowMajor > &open_loop_input, typename Eigen::Matrix< double, SystemType::NUM_STATES, N+1, Eigen::RowMajor > &open_loop_state) const override
 
unsigned int getStepsToCompensateControllerDelay () override
 
void writeProblemToFile (const std::string &file_path)
 
- Public Member Functions inherited from mimpc::Solver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >
virtual void addInputConstraintOnStep (int step, const SystemType::InputVec &lb, const SystemType::InputVec &ub)=0
 
virtual void addStateConstraintOnStep (int step, const SystemType::StateVec &lb, const SystemType::StateVec &ub)=0
 
virtual void setFinalWeights (const SystemType::StateVec &final_weights)=0
 
virtual void setStateWeights (const SystemType::StateVec &state_weights)=0
 
virtual void setInputWeights (const SystemType::InputVec &state_weights)=0
 
virtual void setSetPoint (const SystemType::StateVec &set_point)=0
 
virtual void setState (const SystemType::StateVec &state)=0
 
virtual void setInputHistory (const Eigen::Matrix< double, SystemType::NUM_INPUTS, history_depth > &bin_input_hist)=0
 
virtual void setNextInputs (const Eigen::Matrix< double, SystemType::NUM_INPUTS, num_steps_solver_delay > &next_inputs)=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
 

Additional Inherited Members

- Static Public Attributes inherited from mimpc::Solver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >
static constexpr auto PRED_STEPS = N
 
static constexpr auto MIN_STEPS_ON = min_steps_on
 
static constexpr auto MIN_STEPS_OFF = min_steps_off
 
static constexpr auto MAX_STEPS_ON = max_steps_on
 
static constexpr auto NUM_STEPS_SOLVER_DELAY = num_steps_solver_delay
 
static constexpr auto INTEGRATION_SCHEME = integration_scheme
 
static constexpr int history_depth
 

Detailed Description

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>
class mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >

Provides a solver based on the open source SCIP Solver (https://scipopt.org/)

Constructor & Destructor Documentation

◆ SCIPSolver()

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>
mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >::SCIPSolver ( const typename SystemType::StateVec &  state_weights,
const typename SystemType::StateVec &  final_weights,
const typename SystemType::InputVec &  input_weights,
const typename SystemType::StateVec &  set_point,
COST_TYPE  cost_type,
const SystemType &  system,
double  system_dt 
)

Initializes a new SCIP Solver

Parameters
state_weightsvector that contains the weights for each state error
final_weightsvector that contains the final weights for each state error
input_weightsvector that contains the input weights
set_pointthe target state
cost_typethe type of the cost function
systemthe concrete system
system_dtthe timestep with which the system dynamics are discretized

Member Function Documentation

◆ addInputConstraintOnIndex()

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>
void mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >::addInputConstraintOnIndex ( int  index,
double  lb,
double  ub 
)
overridevirtual

Adds or replaces the bounding box constraint to the input variable with given index to all discrete time steps.

Parameters
indexindex of the respective input variable in the input vector
lblower bound
ubupper bound

Implements mimpc::Solver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >.

◆ addStateConstraintOnIndex()

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>
void mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >::addStateConstraintOnIndex ( int  index,
double  lb,
double  ub 
)
overridevirtual

Adds or replaces the bounding box constraint to the state variable with given index to all discrete time steps.

Parameters
indexindex of the respective state variable in the state vector
lblower bound
ubupper bound

Implements mimpc::Solver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >.

◆ getStepsToCompensateControllerDelay()

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>
unsigned int mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >::getStepsToCompensateControllerDelay ( )
overridevirtual

Returns the index at which the next input calculated by solve() has to be taken, in order to correct respect the solver delay compensation. Most of the times this value should refer to #num_steps_solver_delay

Returns
num_steps_solver_delay

Implements mimpc::Solver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >.

◆ setSolverTimeLimit()

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>
void mimpc::SCIPSolver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >::setSolverTimeLimit ( double  max_seconds)
overridevirtual

Sets the maximum time that the solver will try to find the optimal solution when solve is called. If the maximum time is reached, the best solution found so far will be returned.

Parameters
max_seconds

Implements mimpc::Solver< SystemType, N, min_steps_on, min_steps_off, max_steps_on, num_steps_solver_delay, integration_scheme >.


The documentation for this class was generated from the following file: