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
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
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
The text was updated successfully, but these errors were encountered: