1 % Taken from https://www.minizinc.org/doc-2.7.3/en/modelling.html
3 var float: R; % quarterly repayment
4 var float: P; % principal initially borrowed
5 var 0.0 .. 10.0: I; % interest rate (per quarter)
7 % intermediate variables
8 var float: B1; % balance after one quarter
9 var float: B2; % balance after two quarters
10 var float: B3; % balance after three quarters
11 var float: B4; % balance owing at end
13 constraint B1 = P * (1.0 + I) - R;
14 constraint B2 = B1 * (1.0 + I) - R;
15 constraint B3 = B2 * (1.0 + I) - R;
16 constraint B4 = B3 * (1.0 + I) - R;
21 "Borrowing ", show_float(0, 2, P), " at ", show(I*100.0),
22 "% interest, and repaying ", show_float(0, 2, R),
23 "\nper quarter for 1 year leaves ", show_float(0, 2, B4), " owing\n"