help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Formulating MCKP with GNU Mathprog


From: Andrew Makhorin
Subject: Re: [Help-glpk] Formulating MCKP with GNU Mathprog
Date: Tue, 22 Nov 2005 01:12:42 +0300

> I am trying to formulate a multiple choice knapsack problem. I
> am stuck 
> at the point where I need to formulate subsets of a given set.
> 
>  From the archives of this list I have got the idea that you can
> it like 
> this:
> 
> set FOO;
> set BAR{FOO};
> 
> Am I correct here?

This depends on whether you specify the subsets or search for them.

> 
> For my multiple choice KP I need to state the s.t. so that at
> most 1 
> element of each subset FOO is chosen. How can I do that?

var x{...} binary;
s.t. sum{j in ...} x[j] <= 1;

> 
> Third, how do I assign data to a parameter weight[i from BAR]?
> I assumed that weight[0] := a 1 b 2 ... etc would do it but
> glpsol 
> complains about weight[0] already been assigned.

Please provide the diagnostic message. Not seeing your model it is
difficult to clarify the error.





reply via email to

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