Hi,
let me take the question https://www.ibm.com/developerworks/community/forums/html/topic?id=dac107d0-54fd-4500-9591-b51fd1abbce5&ps=25#repliesPg=0
in order to show you an example:
int N = 3;
int NbPeriods = 2;
range Periods = 1..NbPeriods;
// Parameters
float p[i in 1..N] = i;
float s[i in 1..N+1] = i;
float Demand [p in Periods] = rand(p);
// Decision Variables
dvar int x2 [Periods]; //Variable Price Quantity
// Objective function
dexpr float TotalCost [t in Periods] =
piecewise ( i in 1..N){
s[i] -> p[i];
s[N+1]
} (1, 1) x2[t];
minimize max(p in Periods)TotalCost[p] ;
subject to {
forall ( t in Periods)
Demand [t] == x2[t];
forall ( t in Periods) {
x2[t] >= 0;
}
}
regards
#CPLEXOptimizers#DecisionOptimization