1 #ifndef LPINTERFACE_LPHANDLE_GUROBI_H
2 #define LPINTERFACE_LPHANDLE_GUROBI_H
11 #include "lpinterface/badge.hpp"
12 #include "lpinterface/gurobi/lputil_gurobi.hpp"
22 std::shared_ptr<GRBmodel> grbmodel,
23 std::shared_ptr<GRBenv> grbenv)
24 : grb_env_(grbenv), grb_model_(grbmodel) {}
26 std::size_t
num_vars()
const override;
34 std::vector<Variable>
variables()
const override;
36 void add_variables(
const std::vector<Variable>& vars)
override;
53 std::vector<Constraint<double>>
constraints()
const override;
66 std::shared_ptr<GRBenv> grb_env_;
67 std::shared_ptr<GRBmodel> grb_model_;
69 std::vector<double> upper_bounds;
70 std::vector<double> lower_bounds;
72 std::size_t num_vars_ = 0;
73 std::size_t num_constraints_ = 0;
78 #endif // LPINTERFACE_LPHANDLE_GUROBI_H
Struct to represent right-hand side of LP constraints. In linear programming, we have constraints of ...
Definition: data_objects.hpp:192
std::vector< Constraint< double > > constraints() const override
Retrieve the constraints of the internal LP. This method requests the constraints from the internal L...
void set_objective(const Objective< double > &objective) override
Set the objective function to be used. This method must be called before calling add_constraints().
OptimizationType
Objective sense for an LP.
Definition: lp.hpp:17
Interface representing linear program formulation. This interface represents linear programs of the f...
Definition: lp.hpp:53
std::size_t num_vars() const override
Get the number of variables in the LP.
std::vector< Variable > variables() const override
Retrieve the variables from the internal LP solver.
void set_objective_sense(const OptimizationType objsense) override
Set the objective sense of this ILinearProgramHandle. The Optimization type can be either Optimizatio...
Objective< double > objective() const override
Retrieve the objective function of the internal LP. This method requests the objective function value...
OptimizationType optimization_type() const override
Retrieve the objective sense of this ILinearProgramHandle. The Optimization type can be either Optimi...
virtual Constraint< double > constraint(std::size_t i) const override
Retrieve constraint i of the internal LP. This method requests a constraint from the internal LP solv...
Class representing a variable in the LP.
Definition: data_objects.hpp:253
Struct representing the objective vector. A linear program has the canonical form This structure rep...
Definition: data_objects.hpp:223
Definition: lphandle_gurobi.hpp:19
void add_variables(const std::vector< Variable > &vars) override
Add variables to the LP.
Variable variable(std::size_t i) const override
Retrieve variable i from the internal LP solver.
void remove_constraint(std::size_t i) override
Remove a constraint from the LP.
std::size_t num_constraints() const override
Get the number of cosntraints in the LP.
void add_constraints(const std::vector< Constraint< double >> &constraints) override
Add a set of constraints to the LP formulation. This can only be called after calling set_objective()...
void remove_variable(const std::size_t i) override
Remove a variable from the LP.