|
| Model (const std::string &name, SCIP *scip=nullptr, bool includeDefaultPlugins=true) |
| Creates an empty problem and sets the optimization goal to Sense::MINIMIZE.
|
|
| ~Model () |
| Releases the variables and constraints.
|
|
void | addConstr (const LinIneq &ineq, const std::string &name) |
| Adds a constraint to the model.
|
|
Var & | addVar (const std::string &name, SCIP_Real coeff=0.0, VarType varType=VarType::CONTINUOUS, std::optional< SCIP_Real > lb=0.0, std::optional< SCIP_Real > ub=1.0) |
| Adds a variable to the model.
|
|
template<size_t NumVars, typename CoeffType = ConstantCoefficient> |
std::array< Var, NumVars > | addVars (const std::string &prefix, const CoeffType &coeffs=COEFF_ZERO, VarType varType=VarType::CONTINUOUS, std::optional< SCIP_Real > lb=0.0, std::optional< SCIP_Real > ub=1.0) |
| Adds multiple variables to the model.
|
|
template<typename CoeffType = ConstantCoefficient> |
std::vector< Var > | addVars (const std::string &prefix, size_t numVars, const CoeffType &coeffs=COEFF_ZERO, VarType varType=VarType::CONTINUOUS, std::optional< SCIP_Real > lb=0.0, std::optional< SCIP_Real > ub=1.0) |
| Adds multiple variables to the model.
|
|
SCIP_Real | epsilon () const |
| Value treated as zero.
|
|
Solution | getBestSol () const |
| Returns the best feasible primal solution found so far or best solution candidate.
|
|
SCIP_Retcode | getLastReturnCode () const |
| Gets the return code of the last call to SCIP's C API when the default call wrapper is used.
|
|
int | getNSols () const |
| Returns the number of feasible primal solutions stored in the solution storage.
|
|
double | getPrimalbound () const |
| Returns the objective value of best solution.
|
|
template<typename T > |
T | getSolvingStatistic (const statistics::Statistic< T > &statistic) const |
| Query statistics about the solving process.
|
|
SCIP_Status | getStatus () const |
| Returns the solution status.
|
|
SCIP_Real | infinity () const |
| Infinity according the SCIP config.
|
|
bool | isZero (SCIP_Real value) const |
| Checks, if value is in range epsilon of 0.0.
|
|
SCIP_Real | round (SCIP_Real value) const |
| Rounds value to the nearest integer with epsilon tolerance.
|
|
Scip * | scip () const |
| Returns a pointer to the underlying SCIP object.
|
|
void | setObjsense (Sense objsense) |
| Set objective goal.
|
|
template<typename T , typename PT > |
void | setParam (params::Param< PT > parameter, T value) |
| Sets a parameter.
|
|
void | setScipCallWrapper (std::function< void(SCIP_Retcode)> wrapper) |
| Replace the current wrapper for every call to SCIP's C API.
|
|
void | solve () |
| Solve the model.
|
|
void | writeOrigProblem (const std::filesystem::directory_entry &filename, bool genericNames=false) const |
| Writes original problem to file.
|
|
void | writeOrigProblem (const std::string &extension, bool genericNames=false) const |
| Writes original problem to standard output.
|
|
A SCIP optimization model.
Variables and constraints are automatically released when the model is destructed.
- Since
- 1.0.0
Definition at line 39 of file model.hpp.
template<size_t NumVars, typename CoeffType = ConstantCoefficient>
std::array< Var, NumVars > scippp::Model::addVars |
( |
const std::string & | prefix, |
|
|
const CoeffType & | coeffs = COEFF_ZERO, |
|
|
VarType | varType = VarType::CONTINUOUS, |
|
|
std::optional< SCIP_Real > | lb = 0.0, |
|
|
std::optional< SCIP_Real > | ub = 1.0 ) |
|
inline |
Adds multiple variables to the model.
This method can be used when the number of variables to add is known at compile time. The result can be used in a structured binding.
- Since
- 1.0.0
- Template Parameters
-
NumVars | Number of variables to add. |
CoeffType | Type of the object holding the coefficients. They are accessed via [i] where i goes from 0 to NumVars - 1. |
- Parameters
-
prefix | to construct variable names from: prefix + index. |
coeffs | Object holding the coefficients for the objective function. |
varType | variable type. |
lb | lower bound. |
ub | upper bound. |
- Returns
- Array of variables.
Definition at line 151 of file model.hpp.
References addVars().