Take the problem defined by all the constraints that have been set up so far, and solve it for the given objective function. If successful, instantiate all problem variables to their solution values.
This is a convenience predicate that combines solver setup, invocation and result retrieval. It is essentially defined as:
optimize(OptExpr, Cost) :- eplex_solver_setup(OptExpr), eplex_solve(Cost), eplex_get(vars, VArr), eplex_get(typed_solution, SolutionVector), VArr = SolutionVector. % do the bindings
:- lib(eplex). main(Cost, Supply) :- data(PlantCapacities, ClientDemands, TranspCosts), dim(TranspCosts, [NClients,NPlants]), % get dimensions dim(Supply, [NClients,NPlants]), % make variables Supply :: 0.0..inf, % initial bounds ( for(J,1,NClients), param(ClientDemands,Supply) do sum(Supply[J,*]) $= ClientDemands[J] ), ( for(I,1,NPlants), param(PlantCapacities,Supply) do sum(Supply[*,I]) $=< PlantCapacities[I] ), Objective = sum(concat(TranspCosts)*concat(Supply)), optimize(min(Objective), Cost). % solve data( [](500, 300, 400), % PlantCapacities [](200, 400, 300, 100), % ClientDemands []([](10, 7, 11), % TranspCosts []( 8, 5, 10), []( 5, 5, 8), []( 9, 3, 7)) ).