writing AMPL constraint that can give 2 values

53 Views Asked by At

I want to write a constraint that goes variable[i] is equal to 0 or parameter[i] does anyone know how to do that?

I'm using AMPL

1

There are 1 best solutions below

0
On

Something like this should do it:

set S; # your index set
param p{S};
var x{S};
var x_indicator{S} binary;
s.t. c1{i in S}: x[i]=p[i]*x_indicator[i];