bpp plus type constrain

Leonardo Corato <[email protected]> Sat, 30 Sep 2023 17:11:51 +0200
Newsgroups gmane.comp.gnu.glpk
Message-ID <CAPXOyi61HYf7CtaNZtjFGQJ+0zFFe6NYke0qnvt7rJPrEQfAzA@mail.gmail.com>
--000000000000abd445060694f6c0
Content-Type: text/plain; charset="UTF-8"

I've got a BPP problem plus a constraint in the type of  items. Using the
bpp.mod example by Andrew Makhorin
I have to add a type for every item (A,B,C...), so I can think of a param
t, of course accordingly changing w, so that the same type has the same
weight.

data;

param m := 6;
param w :=     1 50, 2 60, 3 30, 4 40, 5 40, 6 40;
--> param t := 1 A,  2 B , 3 B, 4 C, 5 C, 6 C;
param c := 100;

end;

I have to add a constraint so that the number of types for every bin is
limited to maximum 2.

Each bin can contain a number of the same type of items (i.e. A) or max 2
different types (i.e. A and C).
it is not regarding the number of items, of course, I can have multiple
items.
It is kind of a cardinality of distinct items.
Of course each bin must also keep respecting the weight constraint.
How could I get this result?

I really appreciate everyone who could help me.
Leonardo Corato

--000000000000abd445060694f6c0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I&#39;ve got a BPP problem plus a constraint in the type o=
f=C2=A0 items. Using the bpp.mod example=C2=A0by Andrew Makhorin<div>I have=
 to add a type for every item (A,B,C...), so I can think of a param t, of c=
ourse accordingly changing w, so that the same type has the same weight.=C2=
=A0</div><div><div><br></div><div>data;</div><div><br></div><div>param m :=
=3D 6;<br>param w :=3D=C2=A0 =C2=A0 =C2=A01 50, 2 60, 3 30, 4 40, 5 40, 6 4=
0;=C2=A0<br>--&gt; param t :=3D 1 A,=C2=A0 2 B , 3 B, 4 C, 5 C, 6 C;<br>par=
am c :=3D 100;</div><div><font face=3D"monospace">=C2=A0 =C2=A0 <br>end;</f=
ont><br></div></div><div><font face=3D"monospace"><br></font></div><div>I h=
ave to add a constraint so that the number of types for every bin is limite=
d to maximum 2.=C2=A0</div><div><br>Each bin can contain a number of the sa=
me type of items (i.e. A) or max 2 different types (i.e. A and C).=C2=A0 =
=C2=A0</div><div>it is not regarding=C2=A0the number of items, of course, I=
 can have multiple items.=C2=A0<br>It is kind of a cardinality of distinct =
items.=C2=A0</div><div>Of course each bin must also keep respecting the=C2=
=A0weight constraint.<br></div><div>How could I get=C2=A0this result?=C2=A0=
</div><div><br></div><div>I really appreciate everyone who could help me.<b=
r></div><div>Leonardo Corato</div></div>

--000000000000abd445060694f6c0--