A declarative interface to LP/MIP packages

B-Prolog provides a declarative and easy-to-use interface to LP/MIP packages through which LP/MIP problems can be described declaratively. The following gives an example program that uses the interface.
       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(Vars,max(Profit)), % call the LP solver
           format("sol(~w,~f)~n",[Vars,Profit]).
Three new operators are introduced: $=, $>=, and $=< for expressing equality and disequality constraints.13.4 The call lp_solve(Vars,max(Profit)) calls the LP solver to find a valuation for Vars that maximizes Profit and satisfies all the constraints on the variables. A MIP problem is similar to a LP problem except that some variables are required to be integers. The built-in lp_integers(Vars) is provided to declare integer variables. For MIP problems, the same built-in lp_solve/2 is used to call the MIP solver. The interface decides which solver to call based on whether or not there are integer variables. More examples can be found in the directory examples/lp.

The following built-ins are provided to communicate with LP/MIP packages:

Neng-Fa Zhou 2012-01-03