help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Sets of arbitrary length sets in MathProg


From: Andrew Makhorin
Subject: Re: [Help-glpk] Sets of arbitrary length sets in MathProg
Date: Tue, 21 Feb 2012 21:00:06 +0300

> In my MathProg model I need to be able to specify sets of groups of 
> workers that need to work with each other on a particular shift.  It 
> doesn't matter what shift they work on, just that they work together.  I 
> know how to model this but I don't know how to represent it with 
> MathProg since it requires having a set of sets in which the children 
> sets can be of 1..n length (but may not be all the same length). For 
> additional context, I have the following declared:
> 
>    set WORKERS;
>    set TASKS;
>    param number_of_shifts integer > 0;
>    param num_tasks_in_each_shift := (card(TASKS) / number_of_shifts) 
> integer > 0;
> 
> In my case I want to be able to, in my data section, declare sets of 
> workers that must work with each other which I call WORKER_CLIQUES.  
> Ideally it would look something like this in my data section:
> 
>    set WORKERS := Jack Kate Sawyer Sun Juliet Richard Desmond Hugo;
>    param number_of_shifts := 2;
> 
>    set WORKER_CLIQUES := (Sawyer, Juliet) (Jack,Kate,Hugo); # I want this!
> 
> Is it possible to have a set like WORKER_CLIQUES?  I don't know how I 
> would declare the set, but it would be something like:
> 
>    set WORKER_CLIQUES within {i in WORKERS} dimen 
> num_tasks_in_each_shift; # I know this is wrong..
> 
> I need to be able to limit the cardinality of each WORKER_CLIQUE to be 
> equal to or less than num_tasks_in_each_shift.
> 
> This this possible to do in MathProg?
> 

In the model section:

set WORKERS;
param number_of_shifts, integer, >= 1;
set WORKER_CLIQUE{1..number_of_shifts}, within WORKERS;
. . .

In the data section:

set WORKERS := Jack Kate Sawyer Sun Juliet Richard Desmond Hugo;
param number_of_shifts := 2;
set WORKER_CLIQUE[1] := Sawyer, Juliet;
set WORKER_CLIQUE[2] := Jack, Kate, Hugo;
. . .

For more details please see the language reference included in the glpk
distribution and also some example models in subdirectory 'examples'.





reply via email to

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