Re: bpp plus type constrain

Michael Hennebry <[email protected]> Wed, 4 Oct 2023 13:08:58 -0500 (CDT)
Newsgroups gmane.comp.gnu.glpk
Message-ID <[email protected]>
On Sat, 30 Sep 2023, Leonardo Corato wrote:

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

If you want the types to have names, they will have to be a set.
You could just give them indices.
You will need a 2D boolean array indexed by item and type.
Once you have that, the rest should be obvious.

-- 
Michael   [email protected]
"Occasionally irrational explanations are required"  --  Luke Roman