
From:  Philippe Jugla 
Subject:  Scheduling problem  cost function 
Date:  Thu, 1 Apr 2021 15:07:25 +0000 
Hello everyone,
I have some difficulties to add a cost parameter that depends on 2 variables to a scheduling model in GLPK.
The problem is as follows :
If the unit has started up and been active for less than k hours than the cost follows a certain cost function, if it has been more than k hours then the cost follows another function.
I have tried the following example but doesn’t seem to work :
#binary variables (already defined and working)
var start_up {TIME} binary;
var unit_on {TIME} binary;
#parameters param T:=10; param price {TIME}; param k:=2;
#this is what I’ve tried
param cost {t in TIME} :=
if sum { s in TIME : s = t  k and s >= 0 } start_up[s] + unit_on[s] < k+1 then 2.5*price[t] + 5 else 3.0*price[t] + 10;
The following error is thrown : « operand preceding < has invalid type ». I guess it is because of the variables ? I tried to define cost as a variable but with no success as well..
Does anyone know what is the issue ? How could I work things out ?
Any help or advice would be greatly appreciated !
Best regards
Philippe 
[Prev in Thread]  Current Thread  [Next in Thread] 