Search code examples
scippyscipopt

How to Specify the Programming Type in SCIP


I am solving an optimization problem using PYSCIPOPT in Python. I know that I don't need to specify the problem type, that it will automatically detect for me. But I have a special situation where it may be useful.

My original problem is MINLP, but PYSCIPOPT is having trouble solving it. So I am using an external code to suggest guesses for the integer variables, after which I fix the integer variables thereby making the problem effectively NLP. For coding convenience, and because I may sometimes not fix all the integer variables, I am using the same MINLP formulation, but specifying the values of the integer variables using the .fixVar() method. After pre-solve, it says 0 integer variables, so I assume it's treating the problem as NLP. But because the initial model contains integer variables, I wonder if it's still trying to solve it like a MINLP; e.g. using heuristics that were fine-tuned for MINLP rather than NLP. In that case, explicitly telling SCIP to solve it like a NLP might have benefits.

I looked through the SCIP and PYSCIPOPT documentations, but couldn't find a parameter to specify the problem type, like what GAMS has. I also didn't see any relevant question on StackOverflow.

If anyone knows,

  1. How to force the problem type
  2. A better way to ensure it solves like an NLP rather than just using .fixVar() to fix the integer variables
  3. Or a sign to know what type of problem it's treating it as (after pre-solve)

that would be great. Or if this doesn't matter because,

  1. SCIP uses the same heuristics for both
  2. After fixing the integer variables the MINLP solution algorithm is equivalent to the NLP algorithm
  3. Or SCIP automatically switches to the NLP algorithm after seeing no integer variables

that would also be good to know.


Solution

  • There is no need to force a problem type. SCIP will realize when there are no integer variables left after applying all variable fixings.

    The algorithm SCIP uses for NLPs is not much different than for MINLPs. It just skips a number of techniques to deal with integer variables if there aren't any. But there is very little where SCIP says that now that the problem is only a NLP, it would do something special. The multistart heuristic would be something that only runs in case of a NLP.

    To answer the points directly:

    1. SCIP doesn't know about "problem types"
    2. .fixVar() is fine
    3. From the log, you can see if there are binary/integer variables left and what types of constraints are left in the problem.
    4. Yes, some heuristics run for both NLPs and MINLPs. A number of MIP and MINLP heuristics won't run if there are no integer variables. Some heuristics like subnlp will run for both MINLP and NLP. The multistart heuristic runs only for NLPs.
    5. Yes.
    6. Yes, kind of. The NLP algorithm is the MINLP algorithm with the treatment for integer variables removed.