Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int: pizza_types = 4;
- int: slices_limit = 17;
- array[1..pizza_types] of var int: pizza_slices_per_type;
- array[1..pizza_types] of var int: pizzas_ordered_by_type;
- var int: slice_count = sum(i in 1..pizza_types) (pizza_slices_per_type[i]*pizzas_ordered_by_type[i]);
- solve maximize slice_count ;
- % solve satisfy;
- constraint
- % what is index_set?
- forall(i in 1..pizza_types) (pizzas_ordered_by_type[i] >= 0)
- /\ forall(i in 1..pizza_types) (pizzas_ordered_by_type[i] <= 1)
- /\ slice_count <= slices_limit;
- % data
- pizza_slices_per_type = [ 2, 5, 6, 8];
- output
- [
- "pizzas by type: " ++ show(pizzas_ordered_by_type) ++ "\n"
- ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement