# \[AMPL 24442\] The Graphic Palette Case Problem

**URL:** <https://discuss.ampl.com/t/ampl-24442-the-graphic-palette-case-problem/299>\
**Category:** Google Group Mirror\
**Created:** [January 4, 2023, 11:13am UTC](https://discuss.ampl.com/t/ampl-24442-the-graphic-palette-case-problem/299 "2023-01-04T11:13:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jirehshelle\_Faith\_Al](https://avatars.discourse-cdn.com/v4/letter/j/cab0a1/32.png) [@Jirehshelle\_Faith\_Al](https://discuss.ampl.com/u/Jirehshelle_Faith_Al)\
**Post date:** [January 4, 2023, 11:13am UTC](https://discuss.ampl.com/t/ampl-24442-the-graphic-palette-case-problem/299/1 "2023-01-04T11:13:09Z")

</div>

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._

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [January 5, 2023, 9:08pm UTC](https://discuss.ampl.com/t/ampl-24442-the-graphic-palette-case-problem/299/2 "2023-01-05T21:08:21Z")

</div>

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

```auto
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:

```auto
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
;

```

---

<div class="post-metadata">

**Author:** ![Dmitry\_MARTYNOV](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@Dmitry\_MARTYNOV](https://discuss.ampl.com/u/Dmitry_MARTYNOV)\
**Post date:** [January 11, 2023, 6:09am UTC](https://discuss.ampl.com/t/ampl-24442-the-graphic-palette-case-problem/299/3 "2023-01-11T06:09:36Z")

</div>

Hi

Ср, 4 янв. 2023 г. в 19:08, Jirehshelle Faith Alarde \<[20103171@usc.edu.ph](mailto:20103171@usc.edu.ph)\>:

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [January 12, 2023, 7:20pm UTC](https://discuss.ampl.com/t/ampl-24442-the-graphic-palette-case-problem/299/4 "2023-01-12T19:20:00Z")

</div>

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