Search code examples
linear-programmingscip

Creating several variables/constraints in one shot in SCIP


I have a C++ application that can use indistinctly (vía polymorphism and virtual methods) CPLEX, GUROBI or COIN to solve an LP, and now I'm adding support for SCIP.

In the first three solvers I can add several constraints/variables at once, using the calls:

  • Constraints
CPLEX  = CPXXaddrows
GUROBI = GRBXaddconstrs
COIN   = OsiSolverInterface::addRows
  • Variables
CPLEX  = CPXXaddcols
GUROBI = GRBXaddvars
COIN   = OsiSolverInterface::addCols

But for SCIP, I've only figured out how to do it one by one:

  • Constraints
SCIPcreateConsBasicLinear -> SCIPaddCoefLinear-> SCIPaddCons -> SCIPreleaseCons
  • Variables
SCIPcreateVarBasic -> SCIPaddVar -> SCIPreleaseVar

My question is: Is there a way in SCIP to create several variables/constraints in one instruction? I ask because, at least for the other solvers, doing it that way is a lot faster than doing it one by one.

Thanks a lot in advance.


Solution

  • In SCIP you have to create variables and constraints one by one.