You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Official example "Real Number Solving" should be solved by gecode, just like other MIP solvers do.
Reality
When I execute command minizinc.exe --solver gecode loan.mzn loan1.dzn, it shows =====UNSATISFIABLE=====.
But when I switch to MIP solver by minizinc.exe --solver cbc loan.mzn loan1.dzn, it correctly shows result Borrowing 1000.00 at 4.0% interest, and repaying 260.00 per quarter for 1 year leaves 65.78 owing ---------- .
Model & Data
loan.mzn
% variables
var float: R; % quarterly repayment
var float: P; % principal initially borrowed
var 0.0 .. 10.0: I; % interest rate (per quarter)
% intermediate variables
var float: B1; % balance after one quarter
var float: B2; % balance after two quarters
var float: B3; % balance after three quarters
var float: B4; % balance owing at end
constraint B1 = P * (1.0 + I) - R;
constraint B2 = B1 * (1.0 + I) - R;
constraint B3 = B2 * (1.0 + I) - R;
constraint B4 = B3 * (1.0 + I) - R;
solve satisfy;
output [
"Borrowing ", show_float(0, 2, P), " at ", show(I*100.0),
"% interest, and repaying ", show_float(0, 2, R),
"\nper quarter for 1 year leaves ", show_float(0, 2, B4), " owing\n"
];
% inputs to allow us to enter values from playground/IDE
opt float: R_IN; % quarterly repayment
opt float: P_IN; % principal initially borrowed
opt float: I_IN; % interest rate (per quarter)
opt float: B4_IN; % balance owing at end
constraint R ~= R_IN;
constraint P ~= P_IN;
constraint I ~= I_IN;
constraint B4 ~= B4_IN;
Minizinc IDE Version: 2.8.5
OS: Windows11
Expectation
Official example "Real Number Solving" should be solved by gecode, just like other MIP solvers do.
When I execute command
minizinc.exe --solver gecode loan.mzn loan1.dzn
, it shows=====UNSATISFIABLE=====
.But when I switch to MIP solver by
minizinc.exe --solver cbc loan.mzn loan1.dzn
, it correctly shows resultBorrowing 1000.00 at 4.0% interest, and repaying 260.00 per quarter for 1 year leaves 65.78 owing ----------
.loan.mzn
loan1.dzn
Compiled fzn file is
, which are doing following calculations:
Do these calculations and left-hand-side terms are:
Even though precision of floating-point numbers after compilation seems acceptable, but gecode doesn't think it's feasible.
Maybe precision of floating-point numbers in gecode differ from precision of floating-point numbers in MiniZinc compiler?
The text was updated successfully, but these errors were encountered: