I am minimizing my objective function.
I have a parameter > param Preq{i in 1..n:=Uniform(0.002,Pmax/n) Where Pmax is .0095 and n is 12.
How can I introduce Monte Carlo Simulation in my model file using this Uniform parameter?
I am minimizing my objective function.
I have a parameter > param Preq{i in 1..n:=Uniform(0.002,Pmax/n) Where Pmax is .0095 and n is 12.
How can I introduce Monte Carlo Simulation in my model file using this Uniform parameter?
The AMPL language has loops. The next example should work for any solver:
param n := 3;
set I := 1..n;
#
# random numbers
#
param p{i in I} := Uniform(0,1);
display p;
#
# minimal model
# uses a scalar q
#
param q;
var x;
minimize z:x;
e: x = 2*q;
#
# solve in loop
# assign q before solving
#
param results{I};
for {i in I} {
let q := p[i];
solve;
let results[i] := z;
}
display results;
end;
The AMPL web site has more information: e.g. https://ampl.com/NEW/loop1.html