Skip to content
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

BUG? sometimes unsatisfiable #1

Open
manythanks opened this issue Sep 6, 2016 · 2 comments
Open

BUG? sometimes unsatisfiable #1

manythanks opened this issue Sep 6, 2016 · 2 comments

Comments

@manythanks
Copy link

image
posting your code:
% variables
var float: R; % quarterly repayment
var float: P; % principal initially borrowed
var 0.0 .. 10.0: I; % interest rate

P = 1000;
R = 260;
I = 0.04;
% 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"
];

gives me
Compiling LOAN_TUPOS_KATEBASA.mzn
Running LOAN_TUPOS_KATEBASA.mzn
=====UNSATISFIABLE=====
Finished in 1s 728msec

Running very similar commands
var float: p = 907.47; var float: r=200; % var 0.0..2.0:i;
var float: i = 0.04;
var float: b1;
var float: b2;
var float: b3;
var float: b4;
%intermiate variables
constraint b1 = p * (1 + i) - r;
constraint b2 = b1 * (1 + i) - r;
constraint b3 = b2 * (1 + i) - r;
constraint b4 = b3 * (1 + i) - r;
solve satisfy;
output ["P=(p) R=(r) I=(i) b1=(b1) b2=(b2) b3=(b3) B4=(b4)"];
I get the same result,

BUT if I run, some different numbers: (r=20 instead of 200)
I get the solution
Compiling simpleLoan1.mzn
Running simpleLoan1.mzn

P=907.47 R=20.0 I=0.04 b1=923.7688000000001 b2=940.719552 b3=958.34833408 B4=976.6822674432

Finished in 566msec

@manythanks
Copy link
Author

what i have is
image

@manythanks
Copy link
Author

Everything works fine, if I initially manually change to G12 MIP solver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant