coin-or / MibS

A solver for mixed integer bilevel programs
Eclipse Public License 1.0
50 stars 20 forks source link

All linking variables should be discrete #103

Closed MajidSKhoshghalb closed 1 year ago

MajidSKhoshghalb commented 2 years ago

Hey Guys,

I am receiving the following error All linking variables should be discrete for a bi-level problem with this structure:

min x_0 + x_1
x_0, x1 in Z+
2 <= x_0, x_1 <= 5
y in argmin cy
s.t. x_0 + A_1y <= b_1
x_1 + A_2y <= b_2
A_3y <= b3
x, y in Z
+^2 * R_+^n Presumably, x_0, x_1 are linking and they are discrete. What is missing here? Thanks in advance.

tkralphs commented 1 year ago

Hmm, I don't know how I missed this when you originally submitted it. I don't think you're missing anything if that instance is indeed what you passed to MibS. It seems more likely to be an issue with the instance file or auxiliary file itself. If you could post the files themselves here, we can take a look.

xuluze commented 1 year ago

I have the same issue. Here is an input file mibs.mps

* Source:     Pyomo MPS Writer
* Format:     Free MPS
*
NAME unknown
OBJSENSE
 MIN
ROWS
 N  x3
 L  c_u_x4_
 L  c_u_x5_
 L  c_u_x6_
 L  c_u_x7_
COLUMNS
     x1 x3 1
     x1 c_u_x4_ -1
     x1 c_u_x5_ -2
     x1 c_u_x6_ 2
     x1 c_u_x7_ 3
     x2 x3 -4
     x2 c_u_x4_ -1
     x2 c_u_x5_ 1
     x2 c_u_x6_ 1
     x2 c_u_x7_ -2
RHS
     RHS c_u_x4_ -3
     RHS c_u_x5_ 0
     RHS c_u_x6_ 12
     RHS c_u_x7_ 4
BOUNDS
 LO BOUND  x1 0
 LO BOUND  x2 0
ENDATA

and mibs.aux

N 1
M 4
LC 1
LR 0
LR 1
LR 2
LR 3
LO 1.0
OS 1

The error obtained by running mibs -Alps_instance mibs.mps is

Branching strategy is to branch on all variables with fractional values.
Hypercube intersection cut generator is on.
Fractional cuts will be generated.
solveSecondLevelWhenXYVarsInt is set.
solveSecondLevelWhenLVarsFixed is set.
computeBestUBWhenLVarsFixed is set.
Linking solution pool will be used.
ERROR:All linking variables should be integer
 from function instanceStructure
 from class MibSModel

If we change LO BOUND x1 0 to LI BOUND x1 0, then it solves the problem and obtains the solution (4,4).

Here is the information about the version of mibs I am using:

Welcome to MibS (Mixed Integer Bilevel Solver)
Copyright (C) 2007-2023 Lehigh University, Scott DeNegre, Ted Ralphs
and Sahar Tahernejad.
All Rights Reserved.
This software is licensed under the Eclipse Public License. Please see
accompanying file for terms.
Version: 1.2.0
Build Date: Oct  4 2023
==  Alps Version: 1.5.11
==  Bcps Version: 0.94.8
==  Blis Version: 0.94.12
tkralphs commented 1 year ago

MibS requires all linking variables to be integer and that is not the case in your original model, hence the error. By changing LO to LI, you changed the variable x1 from to continuous to integer, which does fix the issue, as it should. So I don't think there is anything wrong here.

xuluze commented 1 year ago

Got it. Thank you very much!

tkralphs commented 1 year ago

No problem, I'm going to close this, since there was response from the creator to my query and there doesn't seem to be an issue that I can discern.