help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bpp plus type constrain


From: Leonardo Corato
Subject: bpp plus type constrain
Date: Sat, 30 Sep 2023 17:11:51 +0200

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]