5 Logical and Integer Modeling

One of the unique feature of LPL is its capability to use logical operators to model constraints. A small example is given as follows (see also logic4 for further explanation) :

model Logic4; 
  variable x [0..10]; y [0..20]; 
  constraint Grey: (x<=5 and y<=2) or (y<=x and y<=6-x); 
  maximize obj: x+y; 
  Write('Optimum is: (%d,%d)' n' ,x,y); 

Two variables x and y with lower bounds 0 and upper bound 10 and 20 are declared. The constraint contains arithmetic and Boolean operators defining a concave set. Besides and and or, LPL also defines additions Boolean and logical indexed operators, such as not, nand, implication, and indexed and, or atleast. For more information, see the paper [3], and the reference manual [5].