Search code examples
c++linear-programmingscip

How to get the values of the coefficients in the constraint matrix of an MILP in SCIP C++ interface


I am trying to get the coefficients of a variable in the constraint matrix of an MILP in SCIP. What I had been thinking was to loop through all the constraints that the variables appear in and somehow get the coefficients ( I am not sure how to). But is there a way to get all the coefficients in an std::vector by using any inbuilt functions.


Solution

  • What type of constraints do you have? If all your constraints are linear, you can include cons_linear.h, loop through all constraints and call SCIPconsGetVars and SCIPconsGetVals. This gives you all the variables that appear in your current constraint, as well as the coefficients.

    What is it exactly that you want to do with these coefficients?