> OK thanx for this information.
> Did you have time to look at my "corrected" constraints? I'm really sorry for
> having written an error ...
> The correct conditions are now written:
>------------------------------------------
> if s=1 then t > b
> if s=-1 then t < -b
> if s=0 then -b <= t <= b
> where:
> variables: t real in [-1,1] b real in [0,1]
> parameter: s integer in {-1,0,1}
> ------------------------------------------
>I just can't see how to write these conditions as linear constraints in AMPL ...
>Thanx again for your help or any advice which could guide me towards the solution ...
param s = 1;
var t >= -1, <= 1;
var b >= 0, <= 1;
minimize obj: b; subject to
e1{1..1:s=1}: t >= b;
e2{1..1:s=-1}: t <= -b;
e3{1..1:s=0}: -b <= t;
e4{1..1:s=0}: t <= b;
Conditional generation of equations is an important feature in formulating real-world models. You may want to consider hiring a consultant with experience in AMPL modeling. That would speed up the implementation considerably.
No comments:
Post a Comment