# [AMPL 24442] The Graphic Palette Case Problem

MODEL FILE

#let xij be the quantity of poster transversing from i to j machine

#set variables
set machine;

#LHS
param cost {machine};
param m1_total {machine};
param m2_total {machine};
param m3_total {machine};
param m4_total {machine};
param m5_total {machine};
param m6_total {machine};
param m7_total {machine};
param m8_total {machine};
param m9_total {machine};
param m4_input_s2 {machine};
param m5_input_s2 {machine};
param m6_input_s2 {machine};
param m7_input_s2 {machine};

#RHS
param m1_capacity;
param m2_capacity;
param m3_capacity;
param m4_capacity;
param m5_capacity;
param m6_capacity;
param m7_capacity;
param m8_capacity;
param m9_capacity;
param m4_output {machine};
param m5_output {machine};
param m6_output {machine};
param m7_output {machine};

#Declaration of variables
var num_of_posters {i in machine} >= 0;

#Objective Function
minimize z: sum {i in machine} cost [i] * num_of_posters [i];

#Constraints
s.t. con1: sum {i in machine} m1_total [i] * num_of_posters [i] <= m1_capacity;
s.t. con2: sum {i in machine} m2_total [i] * num_of_posters [i] <= m2_capacity;
s.t. con3: sum {i in machine} m3_total [i] * num_of_posters [i] <= m3_capacity;
s.t. con4: sum {i in machine} m4_total [i] * num_of_posters [i] <= m4_capacity;
s.t. con5: sum {i in machine} m5_total [i] * num_of_posters [i] <= m5_capacity;
s.t. con6: sum {i in machine} m6_total [i] * num_of_posters [i] <= m6_capacity;
s.t. con7: sum {i in machine} m7_total [i] * num_of_posters [i] <= m7_capacity;
s.t. con8: sum {i in machine} m8_total [i] * num_of_posters [i] = m8_capacity;
s.t. con9: sum {i in machine} m9_total [i] * num_of_posters [i] = m9_capacity;
s.t. con10: sum {i in machine} m4_input_s2 [i] * num_of_posters [i] = sum {i in machine} m4_output [i] * num_of_posters [i];
s.t. con11: sum {i in machine} m5_input_s2 [i] * num_of_posters [i] = sum {i in machine} m5_output [i] * num_of_posters [i];
s.t. con12: sum {i in machine} m6_input_s2 [i] * num_of_posters [i] = sum {i in machine} m6_output [i] * num_of_posters [i];
s.t. con13: sum {i in machine} m7_input_s2 [i] * num_of_posters [i] = sum {i in machine} m7_output [i] * num_of_posters [i];

DATA FILE

data;

set machine:= x14 x15 x16 x17 x24 x25 x26 x27 x34 x35 x36 x37 x48 x49 x58 x59 x68 x69 x78 x79;

#LHS
param cost:=
x14 18
x15 23
x16 25
x17 21
x24 20
x25 26
x26 24
x27 19
x34 24
x35 24
x36 22
x37 23
x48 36
x49 41
x58 40
x59 52
x68 42
x69 46
x78 33
x79 49;

param m1_total:=
x14 1
x15 1
x16 1
x17 1
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

param m2_total:=
x14 0
x15 0
x16 0
x17 0
x24 1
x25 1
x26 1
x27 1
x34 0
x35 0
x36 0
x37 0
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

param m3_total:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 1
x35 1
x36 1
x37 1
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

param m4_total:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 1
x49 1
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

param m5_total:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 0
x49 0
x58 1
x59 1
x68 0
x69 0
x78 0
x79 0;

param m6_total:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 0
x49 0
x58 0
x59 0
x68 1
x69 1
x78 0
x79 0;

param m7_total:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 1
x79 1;

param m8_total:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 1
x49 0
x58 1
x59 0
x68 1
x69 0
x78 1
x79 0;

param m9_total:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 0
x49 1
x58 0
x59 1
x68 0
x69 1
x78 0
x79 1;

param m4_input_s2:=
x14 1
x15 0
x16 0
x17 0
x24 1
x25 0
x26 0
x27 0
x34 1
x35 0
x36 0
x37 0
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

param m5_input_s2:=
x14 0
x15 1
x16 0
x17 0
x24 0
x25 1
x26 0
x27 0
x34 0
x35 1
x36 0
x37 0
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

param m6_input_s2:=
x14 0
x15 0
x16 1
x17 0
x24 0
x25 0
x26 1
x27 0
x34 0
x35 0
x36 1
x37 0
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

param m7_input_s2:=
x14 0
x15 0
x16 0
x17 1
x24 0
x25 0
x26 0
x27 1
x34 0
x35 0
x36 0
x37 1
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

#RHS Constraint
param m1_capacity:= 750;
param m2_capacity:= 900;
param m3_capacity:= 670;
param m4_capacity:= 530;
param m5_capacity:= 320;
param m6_capacity:= 450;
param m7_capacity:= 250;
param m8_capacity:= 620;
param m9_capacity:= 750;

param m4_output:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 1
x49 1
x58 0
x59 0
x68 0
x69 0
x78 0
x79 0;

param m5_output:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 0
x49 0
x58 1
x59 1
x68 0
x69 0
x78 0
x79 0;

param m6_output:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 0
x49 0
x58 0
x59 0
x68 1
x69 1
x78 0
x79 0;

param m7_output:=
x14 0
x15 0
x16 0
x17 0
x24 0
x25 0
x26 0
x27 0
x34 0
x35 0
x36 0
x37 0
x48 0
x49 0
x58 0
x59 0
x68 0
x69 0
x78 1
x79 1;

This transmittal is a privileged communication between the sender and the recipient. If you are not the intended recipient, you are hereby notified that you have received this transmittal in error; any review, dissemination, distribution or copying of this transmittal is strictly prohibited. If you have received this transmittal and/or attachments in error, please notify the sender immediately and delete this message and all its attachments.

You can send this example to almost any solver. I tried it with Gurobi, which indicated that an optimal solution had been found:

``````ampl: option solver gurobi;
ampl: solve;
Gurobi 10.0.0: optimal solution; objective 82540
8 simplex iterations
``````

The values of the variables in the optimal solution were reported as follows:

``````ampl: display num_of_posters;
num_of_posters [*] :=
x14  530
x15  220
x16    0
x17    0
x24    0
x25    0
x26    0
x27  250
x34    0
x35    0
x36  370
x37    0
x48  150
x49  380
x58  220
x59    0
x68    0
x69  370
x78  250
x79    0
;
``````

Hi

Ср, 4 янв. 2023 г. в 19:08, Jirehshelle Faith Alarde <20103171@usc.edu.ph>:

This appears to be the same model as you previously posted. I get the same answer as I showed in my previous reply.