Hi,
you have a very nice example in python at
https://dataplatform.ibm.com/analytics/notebooks/fbd32016-7d11-4ecf-8945-7d5e7f714896/view?access_token=38d63d50b379997fd3a008c59e610dfea801af9b42bca85ab25c39c64cbbc54b
Let me quote:
The general idea is that you have to fulfill some initially unknown demand of goods (whatever). You can buy these goods early and cheap, or more expensive later, after you know the demand.
And this can be written in OPL:
range scenarii=1..4;
float DEMANDS[scenarii] = [10, 12, 14, 20];
float PROBABILITIES[scenarii] = [1./4, 1./4, 1./4, 1./4];
assert sum(s in scenarii) PROBABILITIES[s]==1;
float C1=1;
float C2=2;
dvar int+ x;
dvar int+ y[scenarii];
dvar float obj;
minimize obj; // cost
subject to
{
// supply more than demand
forall(s in scenarii) x+y[s]>=DEMANDS[s];
// cost formula
obj==C1*x+C2*sum(s in scenarii) PROBABILITIES[s]*y[s];
}
which gives
obj = 17;
x = 12;
y = [0 0 2 8];
regards
https://www.linkedin.com/pulse/what-optimization-how-can-help-you-do-more-less-zoo-buses-fleischer/
#DecisionOptimization#OPLusingCPLEXOptimizer