scipopt / scip

SCIP - Solving Constraint Integer Programs
Other
366 stars 63 forks source link

SCIP v8.0.3 not accepting initial feasible solution #92

Closed stumarcus314 closed 3 weeks ago

stumarcus314 commented 3 weeks ago

I construct two equivalent nonlinear models in Julia's JuMP using the legacy and non-legacy interfaces, providing the same initial solution, and save the models to .nl files, which are contained in the attached zip file. SCIP v8.0.3 is able to solve both .nl files correctly to optimality. SCIP accepts the initial solution provided in the legacy model .nl file, but does not accept the initial solution provided in the non-legacy model .nl file, as per the SCIP output below. The objective function value at the initial solution is 10204.25. It seems like SCIP is off by a constant offset when SCIP checks the feasibility of the initial solution provided for the non-legacy model: "violation: right hand side is violated by 10204.25 all 1 solutions given by solution candidate storage are infeasible"

SCIP accepts legacy model initial solution:

==> Solving problem 'model_legacy_wis.nl' on 'leibniz121'
==> Solving started: 2024-06-10 20:17:34

SCIP version 8.0.3 [precision: 8 byte] [memory: block] [mode: optimized] [LP solver: Soplex 6.0.3] [GitHash: 62fab8a2e3]
Copyright (C) 2002-2022 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin (ZIB)

External libraries: 
  Readline 8.0         GNU library for command line editing (gnu.org/s/readline)
  Soplex 6.0.3         Linear Programming Solver developed at Zuse Institute Berlin (soplex.zib.de) [GitHash: f900e3d0]
  CppAD 20180000.0     Algorithmic Differentiation of C++ algorithms developed by B. Bell (github.com/coin-or/CppAD)
  ZLIB 1.2.11          General purpose compression library by J. Gailly and M. Adler (zlib.net)
  GMP 6.2.0            GNU Multiple Precision Arithmetic Library developed by T. Granlund (gmplib.org)
  ZIMPL 3.5.3          Zuse Institute Mathematical Programming Language developed by T. Koch (zimpl.zib.de)
  AMPL/MP 4e2d45c4     AMPL .nl file reader library (github.com/ampl/mp)
  bliss 0.77           Computing Graph Automorphism Groups by T. Junttila and P. Kaski (www.tcs.hut.fi/Software/bliss/)

reading user parameter file <scip.set>
===========================

limits/time = 36000

read problem <model_legacy_wis.nl>
============

original problem has 17 variables (0 bin, 16 int, 0 impl, 1 cont) and 1 constraints

solve problem
=============

1/1 feasible solution given by solution candidate storage, new primal bound 1.020425e+04

SCIP does not accept non-legacy model initial solution:

==> Solving problem 'model_non_legacy_wis.nl' on 'leibniz121'
==> Solving started: 2024-06-10 20:18:00

SCIP version 8.0.3 [precision: 8 byte] [memory: block] [mode: optimized] [LP solver: Soplex 6.0.3] [GitHash: 62fab8a2e3]
Copyright (C) 2002-2022 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin (ZIB)

External libraries: 
  Readline 8.0         GNU library for command line editing (gnu.org/s/readline)
  Soplex 6.0.3         Linear Programming Solver developed at Zuse Institute Berlin (soplex.zib.de) [GitHash: f900e3d0]
  CppAD 20180000.0     Algorithmic Differentiation of C++ algorithms developed by B. Bell (github.com/coin-or/CppAD)
  ZLIB 1.2.11          General purpose compression library by J. Gailly and M. Adler (zlib.net)
  GMP 6.2.0            GNU Multiple Precision Arithmetic Library developed by T. Granlund (gmplib.org)
  ZIMPL 3.5.3          Zuse Institute Mathematical Programming Language developed by T. Koch (zimpl.zib.de)
  AMPL/MP 4e2d45c4     AMPL .nl file reader library (github.com/ampl/mp)
  bliss 0.77           Computing Graph Automorphism Groups by T. Junttila and P. Kaski (www.tcs.hut.fi/Software/bliss/)

reading user parameter file <scip.set>
===========================

limits/time = 36000

read problem <model_non_legacy_wis.nl>
============

original problem has 51 variables (16 bin, 0 int, 0 impl, 35 cont) and 35 constraints

solve problem
=============

  [nonlinear] <objcons>: ((1*(<x0>*<x0>)+1*(<x17>*<x17>)+(-0.5)))^2+((1*(<x1>*<x1>)+1*(<x18>*<x18>)+(-0.5)))^2+((1*(<x2>*<x2>)+1*(<x19>*<x19>)+(-0.5)))^2+((1*(<x3>*<x3>)+1*(<x20>*<x20>)+(-0.5)))^2+((1*(<x4>*<x4>)+1*(<x21>*<x21>)+(-0.5)))^2+((1*(<x5>*<x5>)+1*(<x22>*<x22>)+(-0.5)))^2+((1*(<x6>*<x6>)+1*(<x23>*<x23>)+(-0.5)))^2+((1*(<x7>*<x7>)+1*(<x24>*<x24>)+(-0.5)))^2+((1*(<x8>*<x8>)+1*(<x25>*<x25>)+(-0.5)))^2+((1*(<x9>*<x9>)+1*(<x26>*<x26>)+(-0.5)))^2+((1*(<x10>*<x10>)+1*(<x27>*<x27>)+(-0.5)))^2+((1*(<x11>*<x11>)+1*(<x28>*<x28>)+(-0.5)))^2+((1*(<x12>*<x12>)+1*(<x29>*<x29>)+(-0.5)))^2+((1*(<x13>*<x13>)+1*(<x30>*<x30>)+(-0.5)))^2+((1*(<x14>*<x14>)+1*(<x31>*<x31>)+(-0.5)))^2+((1*(<x15>*<x15>)+1*(<x32>*<x32>)+(-0.5)))^2+((1*(<x16>*<x16>)+1*(<x33>*<x33>)+(-0.5)))^2-<nlobjvar> <= 0;
violation: right hand side is violated by 10204.25
all 1 solutions given by solution candidate storage are infeasible

simple_models_wis_4_Oscar.zip

svigerske commented 3 weeks ago

@matbesancon You know what this legacy vs non-legacy interfaces is about?

matbesancon commented 3 weeks ago

there was a change in the nonlinear API of JuMP. But it shouldn't change anything here if the user is just interacting with the CLI version of SCIP

stumarcus314 commented 3 weeks ago

I provided the two .nl files in the original post. Have you confirmed the behavior that I observed in your versions of SCIP? I run SCIP by submitting the .nl files to COAP. https://www.coap.online/ When I submit the non-legacy .nl file to NEOS Knitro, Knitro seems to recognize the initial solution, as per the output below: "The initial point provided for the root node relaxation is feasible for the MIP and has obective value 1.020425e+04."

Artelys Knitro 14.0.0

concurrent_evals: 0 datacheck: 0 hessian_no_f: 1 numthreads: 4 Knitro changing mip_method from AUTO to 1. Knitro changing mip_rootalg from AUTO to 1. Knitro changing mip_lpalg from AUTO to 3. Knitro changing mip_branchrule from AUTO to 2. Knitro changing mip_selectrule from AUTO to 2. Knitro changing mip_mir from AUTO to 2. Knitro changing mip_clique from AUTO to 0. Knitro changing mip_zerohalf from AUTO to 0. Knitro changing mip_liftproject from AUTO to 0. Knitro changing mip_knapsack from AUTO to 2. Knitro changing mip_gomory from AUTO to 0. Knitro changing mip_cut_flowcover from AUTO to 2. Knitro changing mip_cut_probing from AUTO to 1. Knitro changing mip_rounding from AUTO to 3. Knitro changing mip_heuristic_strategy from AUTO to 1. Knitro changing mip_heuristic_feaspump from AUTO to 1. Knitro changing mip_heuristic_misqp from AUTO to 0. Knitro changing mip_heuristic_mpec from AUTO to 1. Knitro changing mip_heuristic_diving from AUTO to 0. Knitro changing mip_heuristic_lns from AUTO to 0. Knitro changing mip_heuristic_localsearch from AUTO to 1. Knitro changing mip_pseudoinit from AUTO to 1.

Problem Characteristics ( Presolved)

Objective goal: Minimize Objective type: general Number of variables: 50 ( 50) bounded below only: 0 ( 0) bounded above only: 0 ( 0) bounded below and above: 16 ( 16) fixed: 0 ( 0) free: 34 ( 34) Number of binary variables: 16 ( 16) Number of integer variables: 0 ( 0) Number of constraints: 34 ( 34) linear equalities: 34 ( 34) quadratic equalities: 0 ( 0) gen. nonlinear equalities: 0 ( 0) linear one-sided inequalities: 0 ( 0) quadratic one-sided inequalities: 0 ( 0) gen. nonlinear one-sided inequalities: 0 ( 0) linear two-sided inequalities: 0 ( 0) quadratic two-sided inequalities: 0 ( 0) gen. nonlinear two-sided inequalities: 0 ( 0) Number of nonzeros in Jacobian: 578 ( 578) Number of nonzeros in Hessian: 51 ( 51)

Knitro using Branch and Bound method with 4 threads.

Initial points

The initial point provided for the root node relaxation is feasible for the MIP and has obective value 1.020425e+04. No primal point provided for the MIP.

svigerske commented 3 weeks ago

The .nl reader of SCIP needs to reformulate a nonlinear objective function into a constraint, since SCIP does not support nonlinear objective functions. For that, it introduces a new variable, nlobjvar. Unfortunately, it does not calculate a value for this variable for the initial solution. I will take a look whether that is possible.

The legacy and non-legacy model seem to be very different - different variables and different constraints. I suppose they only equivalent after aggregating the continuous variables. In the legacy model, the objective function is already reformulated as constraints, and I suppose a corresponding initial value has been set for the continuous variable that has been introduced for that purpose.

odow commented 3 weeks ago

Yes, ignore the "legacy" stuff. It has nothing to do with this issue. (See discussion https://discourse.julialang.org/t/legacy-vs-non-legacy-jump-nonlinear-model-nl-files-with-initial-solution/115442)

since SCIP does not support nonlinear objective functions. For that, it introduces a new variable, nlobjvar. Unfortunately, it does not calculate a value for this variable for the initial solution

This sounds right and matches up with the error message:

 [nonlinear] <objcons>: ((1*(<x0>*<x0>)+1*(<x17>*<x17>)+(-0.5)))^2+((1*(<x1>*<x1>)+1*(<x18>*<x18>)+(-0.5)))^2+((1*(<x2>*<x2>)+1*(<x19>*<x19>)+(-0.5)))^2+((1*(<x3>*<x3>)+1*(<x20>*<x20>)+(-0.5)))^2+((1*(<x4>*<x4>)+1*(<x21>*<x21>)+(-0.5)))^2+((1*(<x5>*<x5>)+1*(<x22>*<x22>)+(-0.5)))^2+((1*(<x6>*<x6>)+1*(<x23>*<x23>)+(-0.5)))^2+((1*(<x7>*<x7>)+1*(<x24>*<x24>)+(-0.5)))^2+((1*(<x8>*<x8>)+1*(<x25>*<x25>)+(-0.5)))^2+((1*(<x9>*<x9>)+1*(<x26>*<x26>)+(-0.5)))^2+((1*(<x10>*<x10>)+1*(<x27>*<x27>)+(-0.5)))^2+((1*(<x11>*<x11>)+1*(<x28>*<x28>)+(-0.5)))^2+((1*(<x12>*<x12>)+1*(<x29>*<x29>)+(-0.5)))^2+((1*(<x13>*<x13>)+1*(<x30>*<x30>)+(-0.5)))^2+((1*(<x14>*<x14>)+1*(<x31>*<x31>)+(-0.5)))^2+((1*(<x15>*<x15>)+1*(<x32>*<x32>)+(-0.5)))^2+((1*(<x16>*<x16>)+1*(<x33>*<x33>)+(-0.5)))^2-<nlobjvar> <= 0;
violation: right hand side is violated by 10204.25
all 1 solutions given by solution candidate storage are infeasible