-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df56d5c
commit bf97950
Showing
1 changed file
with
43 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,64 @@ | ||
predicate units(var int:amount, | ||
var int:unit_size, | ||
var bool: round_up, | ||
var int:units ) = | ||
% Use this editor as a MiniZinc scratch book | ||
predicate units(var int:amount, | ||
var int:unit_size, | ||
var bool: round_up, | ||
var int:units ) = | ||
let { | ||
constraint units = amount div unit_size + if round_up then amount mod unit_size > 0 else 0 endif; | ||
} in true; | ||
|
||
|
||
|
||
predicate act_conveyance_duty(var bool: non_commercial, | ||
var bool: eligible_owner_occupier, | ||
var int:price, | ||
var float:duty) = | ||
predicate act_conveyance_duty(var bool: non_commercial, | ||
var bool: eligible_owner_occupier, | ||
var int:price, | ||
var float:duty) = | ||
let { | ||
constraint eligible_owner_occupier -> non_commercial; | ||
constraint price >= 0; | ||
constraint duty >= 0; | ||
var int: num_units; | ||
int: unit = 100; | ||
constraint duty = | ||
constraint duty = | ||
if non_commercial then | ||
if eligible_owner_occupier then | ||
if price > 0 /\ price <=260000 | ||
/\ units(price, unit, true, num_units) then num_units * 60 else | ||
if price > 260000 /\ price <=300000 | ||
/\ units(price-260000, unit, true, num_units) then 1560.00 + num_units * 2.20 else | ||
if price > 300000 /\ price <=500000 | ||
/\ units(price-300000, unit, true, num_units) then 2440.00 + num_units * 3.40 else | ||
if price > 500000 /\ price <=750000 | ||
/\ units(price-500000, unit, true, num_units) then 9240.00 + num_units * 4.32 else | ||
if price > 750000 /\ price <=1000000 | ||
/\ units(price-750000, unit, true, num_units) then 20040.00 + num_units * 5.90 else | ||
if price > 1000000 /\ price <=1455000 | ||
/\ units(price-1000000, unit, true, num_units) then 34790.00 + num_units * 6.40 else | ||
if price > 1445000 | ||
/\ units(price, unit, true, num_units) then num_units * 4.54 | ||
else -1 endif endif endif endif endif endif endif | ||
if price > 0 /\ price <=260000 | ||
/\ units(price, unit, true, num_units) then num_units * 60 | ||
elseif price > 260000 /\ price <=300000 | ||
/\ units(price-260000, unit, true, num_units) then 1560.00 + num_units * 2.20 | ||
elseif price > 300000 /\ price <=500000 | ||
/\ units(price-300000, unit, true, num_units) then 2440.00 + num_units * 3.40 | ||
elseif price > 500000 /\ price <=750000 | ||
/\ units(price-500000, unit, true, num_units) then 9240.00 + num_units * 4.32 | ||
elseif price > 750000 /\ price <=1000000 | ||
/\ units(price-750000, unit, true, num_units) then 20040.00 + num_units * 5.90 | ||
elseif price > 1000000 /\ price <=1455000 | ||
/\ units(price-1000000, unit, true, num_units) then 34790.00 + num_units * 6.40 | ||
elseif price > 1445000 | ||
/\ units(price, unit, true, num_units) then num_units * 4.54 | ||
else -1 endif | ||
else % not eligible_owner_occupier | ||
if price > 0 /\ price <=200000 | ||
/\ units(price, unit, true, num_units) then num_units * 120 else | ||
if price > 200000 /\ price <=300000 | ||
/\ units(price-200000, unit, true, num_units) then 2400.00 + num_units * 2.20 else | ||
if price > 300000 /\ price <=500000 | ||
/\ units(price-300000, unit, true, num_units) then 4600.00 + num_units * 3.40 else | ||
if price > 500000 /\ price <=750000 | ||
/\ units(price-500000, unit, true, num_units) then 11400.00 + num_units * 4.32 else | ||
if price > 750000 /\ price <=1000000 | ||
/\ units(price-750000, unit, true, num_units) then 22200.00 + num_units * 5.90 else | ||
if price > 1000000 /\ price <=1455000 | ||
/\ units(price-1000000, unit, true, num_units) then 36950.00 + num_units * 6.40 else | ||
if price > 1445000 | ||
if price > 0 /\ price <=200000 | ||
/\ units(price, unit, true, num_units) then num_units * 120 | ||
elseif price > 200000 /\ price <=300000 | ||
/\ units(price-200000, unit, true, num_units) then 2400.00 + num_units * 2.20 | ||
elseif price > 300000 /\ price <=500000 | ||
/\ units(price-300000, unit, true, num_units) then 4600.00 + num_units * 3.40 | ||
elseif price > 500000 /\ price <=750000 | ||
/\ units(price-500000, unit, true, num_units) then 11400.00 + num_units * 4.32 | ||
elseif price > 750000 /\ price <=1000000 | ||
/\ units(price-750000, unit, true, num_units) then 22200.00 + num_units * 5.90 | ||
elseif price > 1000000 /\ price <=1455000 | ||
/\ units(price-1000000, unit, true, num_units) then 36950.00 + num_units * 6.40 | ||
elseif price > 1445000 | ||
/\ units(price, unit, true, num_units) then num_units * 4.54 | ||
else -1 endif endif endif endif endif endif endif | ||
else -1 endif | ||
endif | ||
else % commercial | ||
if price > 0 /\ price <= 1700000 then 0 else | ||
if price > 1700000 | ||
/\ units(price, unit, true, num_units) then num_units * 5.00 else -1 endif endif | ||
if price > 0 /\ price <= 1700000 then 0 | ||
elseif price > 1700000 | ||
/\ units(price, unit, true, num_units) then num_units * 5.00 | ||
else -1 endif | ||
endif | ||
} | ||
in true; |