A simple LP example

Here is a simple LP example:
       go:-
           Vars=[X1,X2,X3],
           lp_domain(X1,0,40),           % 0 =< X1 =< 40
           -X1+X2+X3 $=< 20,             % constraints
           X1-3*X2+X3 $=< 30,
           Profit=X1+2*X2+3*X3,          % objective function
           lp_solve([max(Profit)],Vars), % call the LP solver
           format("sol(~w,~f)~n",[Vars,Profit]).
Note that proper disequality constraints ($< or $>) cannot be used if a model contains real variables.



Neng-Fa Zhou 2013-01-25