user7520581
user7520581

Reputation: 31

AMPL Variable Definition

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?

Upvotes: 3

Views: 401

Answers (1)

vitaut
vitaut

Reputation: 55564

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

var x in {0} union interval[40, 100];

Upvotes: 3

Related Questions