This is the way to do it:
var x;
var sp >= 0;
var sm >= 0;
s.t.
cons1:
(x - 5) = (sp - sm);
FYI, the AMPL book can be downloaded for free.
Domanda
I'm using AMPL and need to input my model that has nonnegative deviation variables (s+ - s-).
An example constraint is: (x - 5) = (s+ - s-)
Soluzione
This is the way to do it:
var x;
var sp >= 0;
var sm >= 0;
s.t.
cons1:
(x - 5) = (sp - sm);
FYI, the AMPL book can be downloaded for free.