16 lines
429 B
MiniZinc
16 lines
429 B
MiniZinc
% Problem parameters
|
|
enum TOYS = {football, tennisball, stuffed_lama, stuffed_elephant};
|
|
array[TOYS] of int: toy_joy = [63, 12, 50, 100];
|
|
array[TOYS] of int: toy_space = [32, 8, 16, 40];
|
|
int: space_left = 64;
|
|
|
|
% Decision variables
|
|
var set of TOYS: selection;
|
|
var int: total_joy = sum(toy in selection)(toy_joy[toy]);
|
|
|
|
% Constraints
|
|
constraint sum(toy in selection)(toy_space[toy]) < space_left;
|
|
|
|
% Goal
|
|
solve maximize total_joy;
|