Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2. int: pizza_types = 4;
  3. int: slices_limit = 17;
  4. array[1..pizza_types] of var int: pizza_slices_per_type;
  5. array[1..pizza_types] of var int: pizzas_ordered_by_type;
  6.  
  7. var int: slice_count = sum(i in 1..pizza_types) (pizza_slices_per_type[i]*pizzas_ordered_by_type[i]);
  8.  
  9. solve maximize slice_count ;
  10. % solve satisfy;
  11.  
  12. constraint
  13. % what is index_set?
  14. forall(i in 1..pizza_types) (pizzas_ordered_by_type[i] >= 0)
  15. /\ forall(i in 1..pizza_types) (pizzas_ordered_by_type[i] <= 1)
  16. /\ slice_count <= slices_limit;
  17.  
  18. % data
  19. pizza_slices_per_type = [ 2, 5, 6, 8];
  20.  
  21. output
  22. [
  23. "pizzas by type: " ++ show(pizzas_ordered_by_type) ++ "\n"
  24. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement