-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couenne in Minizinc is unable to find an optimal solution #53
Comments
Hi Indrajit,
The model is linear binary, so Couenne can solve it to global optimality although it is "overqualified" for this---Cbc would also find the optimum. I don't know the reason why Minizinc does not find the optimum. Does Minizinc interface with Couenne, and if so, how (I was unaware of any such interface)? Is there a way to debug the Minizinc/Couenne interface so that we get a .nl, .mps, or .lp file of the Minizinc model?
Pietro
Sent: Tuesday, January 12, 2021 at 3:49 AM
From: "Indrajit Sen Gupta" <[email protected]>
To: "coin-or/Couenne" <[email protected]>
Cc: "Subscribed" <[email protected]>
Subject: [coin-or/Couenne] Couenne in Minizinc is unable finds a sub-optimal solution (#53)
Hi All,
I downloaded the latest version of Couenne available from the AMPL website and was testing on a very small problem which I am posting here. If I run the solver using AMPL, it gives the correct optimal solution. However if I run the same model through Minizinc, the solution that I get is sub-optimal.
Minizinc Model: model.mzn
int: nMOVES;
set of int: MOVES = 1..nMOVES;
int: timeBound;
array[MOVES] of int: power;
array[MOVES] of int: duration;
array[MOVES] of var 0..1: occur;
var int: totalPower = sum(i in MOVES) (power[i] * occur[i]);
constraint (sum(i in MOVES) (duration[i] * occur[i])) <= timeBound;
solve maximize totalPower;
output ["Moves to train: \(occur)\n" ++ "Power: \(totalPower)"];
Minizinc Data: data.dzn
nMOVES = 5;
timeBound = 10;
power = [6, 8, 5, 3, 4];
duration = [4, 5, 3, 2, 3];
AMPL Model: model.mod
set MOVES;
param timeBound > 0;
param power {MOVES} > 0;
param duration {MOVES} > 0;
var occur{i in MOVES} binary;
maximize totalPower: sum{i in MOVES} power[i] * occur[i];
subject to constTime: sum{i in MOVES} duration[i] * occur[i] <= timeBound;
AMPL Data: data.dat
data;
set MOVES := M1 M2 M3 M4 M5;
param timeBound:= 10;
param: power duration :=
M1 6 4
M2 8 5
M3 5 3
M4 3 2
M5 4 3;
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hi @merraksh , yes you are correct. Couenne is an overkill for such a simple problem. The way we interface Minizinc with any of the solvers available from AMPL website is to specify in the configuration to use NL format. So Minizinc must be first converting it to NL format and then solving. Now I have tested the same model with many of the solvers including CBC, Bonmin, CPLEX, Gurobi and Baron. All of them are giving correct results. Hence the model translation is not an issue in my view. The configuration file (couenne.msc) for Couenne (or any other solver from AMPL) needs to be placed in the directory: \MiniZinc\share\minizinc\solvers. The config file should have the following information:
Regards, |
I believe the next step is to compare the .nl files produced by AMPL and by Minizinc. Maybe run Couenne by adding the option "problem_print_level 4" in the option file couenne.opt. If there are substantial differences in the .nl files this should expose them.
Sent: Thursday, January 14, 2021 at 5:56 PM
From: "Indrajit Sen Gupta" <[email protected]>
To: "coin-or/Couenne" <[email protected]>
Cc: "Pietro Belotti" <[email protected]>, "Mention" <[email protected]>
Subject: Re: [coin-or/Couenne] Couenne in Minizinc is unable to find an optimal solution (#53)
Hi @merraksh , yes you are correct. Couenne is an overkill for such a simple problem. The way we interface Minizinc with any of the solvers available from AMPL website is to specify in the configuration to use NL format. So Minizinc must be first converting it to NL format and then solving. Now I have tested the same model with many of the solvers including CBC, Bonmin, CPLEX, Gurobi and Baron. All of them are giving correct results. Hence the model translation is not an issue in my view.
The configuration file (couenne.msc) for Couenne (or any other solver from AMPL) needs to be placed in the directory: \MiniZinc\share\minizinc\solvers. The config file should have the following information:
{
"id": "org.coin-or.couenne",
"name": "Couenne",
"description": "Couenne executable",
"version": "0.5.7",
"executable": "../../../bin/couenne-win64/couenne",
"supportsFzn": false,
"supportsNL": true
}
Regards,
Indrajit
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hi, 3 The value of the 5 decision variables are in lines -6 .. -2, and the second one is 0.99999. So, my guess is that the number 0.999999 rounded to 0, which is a problem. |
Hi Tamás,
indeed Couenne doesn't refine the solution to round off binary variables (I'm not sure if Cbc, the underlying branch-and-bound, does). so rather than floor() one should use a rounding function.
Regards,
Pietro
Sent: Thursday, January 21, 2021 at 1:12 PM
From: "Tamas Kis" <[email protected]>
To: "coin-or/Couenne" <[email protected]>
Cc: "Pietro Belotti" <[email protected]>, "Mention" <[email protected]>
Subject: Re: [coin-or/Couenne] Couenne in Minizinc is unable to find an optimal solution (#53)
Hi,
I have checked in detail this example, and it seems that the problem is with the interpretation of the solution by the interface between minizinc and couenne.
The solution file is
3
1
1
0
2
0
6
6
0
0.9999999999999999
1
1
0
16
objno 0 3
The value of the 5 decision variables are in lines -6 .. -2, and the second one is 0.99999. So, my guess is that the number 0.999999 rounded to 0, which is a problem.
Regards,
Tamas
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hi @merraksh , I have placed the couenne.opt file in the same location as couenne.exe. But I don't think it is being used by couenne. What should I do? This is when I am running through Minizinc. |
I think the couenne.opt file should be placed in the same folder where the main command is run from, i.e. not necessarily where the Couenne executable is but rather the current working directory.
Sent: Thursday, January 21, 2021 at 2:30 PM
From: "Indrajit Sen Gupta" <[email protected]>
To: "coin-or/Couenne" <[email protected]>
Cc: "Pietro Belotti" <[email protected]>, "Mention" <[email protected]>
Subject: Re: [coin-or/Couenne] Couenne in Minizinc is unable to find an optimal solution (#53)
Hi @merraksh , I have placed the couenne.opt file in the same location as couenne.exe. But I don't think it is being used by couenne. What should I do?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@merraksh - thanks it is working now. |
Hi All,
I downloaded the latest version of Couenne available from the AMPL website and was testing on a very small problem which I am posting here. If I run the solver using AMPL, it gives the correct optimal solution. However if I run the same model through Minizinc, the solution that I get is sub-optimal.
Minizinc Model: model.mzn
Minizinc Data: data.dzn
AMPL Model: model.mod
AMPL Data: data.dat
The text was updated successfully, but these errors were encountered: