3

I would like to define a variable in AMPL that can either be 0 or a range of values from 40 to 100.

Using var x >=40, <=100 || == 0; is not valid syntax unfortunately. Should I define one of these constraints as a parameter?

1 Answers1

3

This is called a semicontinuous variable and it can be defined as follows in AMPL:

var x in {0} union interval[40, 100];
vitaut
  • 49,672
  • 25
  • 199
  • 336