parserLinearInequality.pl - Implement linear inequalities.
This is a Parser class that implements implicit open or closed half planes as a subclass of the Formula class. This is built on the implicit plane MathObject. The first intended use case is for linear programming problems whose domains are closed convex sets so only closed half planes are defined at present.
Use LinearInequality(formula), Formula(formula), or Compute(formula) to create a LinearInequality object.
Usage examples:
$LI = LinearInequality("4x1 -3x2 <= 5");
$LI = LinearInequality("3x2 >= 2x1");
$LI = LinearInequality("3x2 => 2x1"); # Sloppy inequalities are allowed
$LI = LinearInequality("3x1 + 4x2 < x3");
$LI = LinearInequality("x1 - 2x2 = 5"); # equality is also supported
$LI = Compute("x1 + 4x2 - 2x3 <= 3"); # Compute() returns a LinearInequality
Then use
ANS($LI->cmp);
to get the answer checker for $LI.
Notice that sloppy inequality signs (i.e. => and =< ) are allowed.