[Top][All Lists]

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

[Help-glpk] MathProg error

From: Duilio Foschi
Subject: [Help-glpk] MathProg error
Date: Thu, 05 Feb 2004 02:06:30 +0100

the aim of the following code should be clear

      WorkedHrs[n]= sum {s in Slots: Assignments[s]=n} Hours[s];

The relative declarations are enclosed below.

Unfortunately, the compiler gives a weird error message

Reading model section from bernardi.mod...
bernardi.mod:44: operand preceding = has invalid type
Context: ...} : WorkedHrs [ n ] = sum { s in Slots : Assignments [ s ] =
Model processing error

The message disappears if I write

      WorkedHrs[n]= sum {s in Slots} Hours[s];

but naturally this is not what I want.

I tried with every possible combination of

      WorkedHrs[n]= sum {s in Slots} 0+ (if Assignments[s]=n then Hours[s] );

but the compiler won't like it (or I was not lucky enough to find the right
one) :)

Any suggestion re how get the desidered result ?

Thank you

Duilio Foschi

param LastDay > 0 integer; # Number of days in schedule
param LastNurse > 0 integer; # Number of avaiable nurses
param LastSlot > 0 integer; # Number of slots to fill

set Nurses := 1..LastNurse;
set Days := 1..LastDay;   # days of assignment
set Slots := 1..LastSlot;   

param ExpectedWorkedHrs {Nurses} >= 0;

var Assignments {Slots} integer >=1;

param Hours {Slots} > 0; 
param Shifts {Slots} > 0; 

var WorkedHrs {n in Nurses} >=0;

reply via email to

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