Hi,
I am trying to write a set of AMPL commands to modify the definition of a problem.
The
following problem describes a robust optimization problem, in which the
constraint c1 must hold for any value of u (uncertain variable) within
the range [-eps, eps].
We chose to declare u with a suffix "uncertain", while x are standard decision variables.
suffix uncertain binary IN;
param true := 1;
param false := 0;
model;
param eps{1..2};
var x{1..4} >= 0;
var u{1..2} suffix uncertain true;
minimize f: 100*x[1] + 199.9*x[2] - 5500*x[3] - 6100*x[4];
subject to
c1: (-0.01 + u[1])*x[1] + (-0.02 + u[2])*x[2] + 0.5*x[3] + 0.6*x[4] <= 0;
c_u {i in 1..2}: -eps[i] <= u[i] <= eps[i];
data;
param eps :=
1 0.00005
2 0.0004;
I
would like to process this problem before solving it. A basic idea
would be to remove u, c1 and c_u (I read about the "drop" command) and
to add
instantiations of c1 with n different (random) values for u.
The reformulated problem would look like this, with n = 2:
model;
var x{1..4} >= 0;
minimize f: 100*x[1] + 199.9*x[2] - 5500*x[3] - 6100*x[4];
subject to
c1_1: (-0.01 + -0.0000432)*x[1] + (-0.02 + 0.000017)*x[2] + 0.5*x[3] + 0.6*x[4] <= 0;
c1_2: (-0.01 + 0.0000216)*x[1] + (-0.02 + 0.000381)*x[2] + 0.5*x[3] + 0.6*x[4] <= 0;
So far, what I can do is:
- find out which are the uncertain variables: display {i in 1.._nvars: _var[i].uncertain = 1} _var[i] ;
- generate random values ;
- determine which constraints depend on x, u, or both (using xref).
But these commands merely display information, and I can't figure out how to define the new optimization problem.
Note: would declaring u as a param instead of a variable help?
Thanks for your help,
Charlie