• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/usr/eclipseclp/documents/tutorial/

Lines Matching defs:to

4 % The contents of this file are subject to the Cisco-style Mozilla Public
29 The eplex library allows an external Mathematical Programming solver to be
30 used by {\eclipse}. It is designed to allow the external solver to be seen
33 not specific to a given external solver, with the differences between
37 The exact types of problems that can be solved (and methods to solve them)
60 objective function that is to be minimised or maximised, subject to a set of
69 variables are constrained to take on only integer values.
71 It is beyond the scope of this chapter to cover MP in
86 all variables restricted to taking integral values.
91 \subsection{Why interface to Mathematical Programming solvers?}
94 Much research effort has been devoted to developing efficient ways of
97 techniques. The eplex library allows the user to model an MP problem in
100 In addition, the eplex library allows for the user to write programs that
117 be transported to various clients (A-D), each requiring various amounts of
118 the product. The per-unit cost of transporting the product to
119 the clients also varies. The problem is to minimise the transportation
123 a plant $N$ to a client $p$ as the variable $Np$, e.g.\ $A1$
124 represents the cost of transporting to plant $A$ from client $1$. There are
128 \item The amount of product delivered from all the plants to a client must be equal to the
134 capacity, e.g. for plant 1, which can send products to plants A-D:
139 The objective is to minimise the transportation cost, thus the objective
140 function is to minimise the combined costs of transporting the product to
166 \section{How to load the library}
171 XPRESS-MP or CPLEX. Your {\eclipse} should be configured to load in a
175 manual's Eplex chapter for details for how to install the solver.}
186 You probably need a valid license in order to use an external commercial solver.
193 The simplest way to model an eplex problem is through an {\it eplex
195 dedicated to one MP problem. MP constraints can be posted to the instance
196 and the problem solved with respect to an objective function by the
203 an eplex instance do not necessarily have to be consistent with those in
209 module. Constraints for the problem are posted to the module. The
210 problem is solved with respect to an objective function.
230 % c. post the constraints for the problem to the eplex instance
257 declared, an eplex instance can be referred to using its name like a module
261 variables and set their range to be non-negative, as is conventional in MP.
262 Note that the bounds are posted to our eplex instance, using \verb'$::/2'.
263 \Note{The default bounds for variables is -1.0Inf..1.0Inf. Bounds posted to
264 an eplex instance are specific to that eplex instance.}
267 problem by posting them to the eplex instance.
272 sides. The restriction to linear
281 We need to setup the external solver with the eplex instance, so
293 constraints posted to that instance, the current variable bounds for the
324 previous section can be modified to return the solution values:
329 .... % same as previous example up to line e
332 % f. set the problem variables to their solution values
338 In line \verb'f', \verb'eplex_var_get/3' is used to obtain the solution
339 value for a problem variable. The second argument, set to \verb'typed_solution',
340 specifies that we want the solution value for the variable to be returned.
341 Here, we instantiate the problem variable itself to the solution value
362 In general, a problem variable is not restricted to taking integer
366 products can be transported; also variables may often be used to model
367 booleans by allowing them to take on the values of 0 or 1 only).
428 Now, to impose the constraints that only whole units of the products can be
443 the external solver will only assign integer solution values to the
466 \Note{Posting an integers/1 constraint to an eplex instance only
467 inform the external solver to treat those variables as integers (in fact
469 will only assign intergral solution values to them), but does
470 not constrain the variable itself to be of type integer.}
478 \$::/2}) for the problem to the eplex instance.
487 Part of the power of using the eplex library comes from being able to solve
492 need to use a new variable for each call:
507 Note that posted constraints behave logically: they are added to an eplex
544 to integer variables. The objective value of this LP is a lower bound on
546 The task of the search is to find integer assignments
555 \geq 5$: these are the two nearest integer values to 4.2. In each branch,
575 The program then proceeds to further labelling of the variables. The
576 alternative branch is left to be tried on backtracking.
580 variables will be `labelled' with integer values, resulting in a solution to the
582 needs to backtrack into the tree to search for a better solution by trying
590 need to write your own code when you can use what is
607 For our example, we add a bound constraint at each node to exclude a
608 fractional solution value for a variable. The criterion we want to use is
609 to invoke the solver only if this old solution value is excluded by the new
628 % c. post the constraints for the problem to the eplex instance
651 % l. Use the branch_and_bound library to do the branch and bound
677 % float value to be considered integer (1e-5 on either side)
687 \verb'deviating_bounds' trigger mode. There are no explicit calls to trigger the
688 solver -- it is triggered automatically. In addition, the first call to
703 to the optimal value, reflecting the range the objective value can take,
704 from suboptimal to the `best' value at optimal. The variable is therefore
706 \verb'j'. This informs the external solver needs to be informed
713 simple heuristic to decide which of the two branches to try first: the
714 branch with the integer range closer to the relaxed solution value.
717 closer to 4 than 5.
720 there is no need to explicitly write our own branch-and-bound routine. However,
721 this predicate requires the cost variable to be instantiated, so we call
722 \verb'eplex_get(cost, Cost)' to instantiate \verb'Cost' at the end of
733 Instance:eplex_solver_setup(+Obj,-ObjVal,+Opts,+Trigs)} to
735 list of trigger conditions to automatically trigger the external solver.
736 \item {\bf Instance:eplex_var_get(+Var,+What,-Value)} can be used to obtain
738 \item {\bf Instance:eplex_get(+Item, -Value)} can be used to retrieve
746 solvers are highly optimised and tightly coupled to their own LP solvers.
754 following resources to produce each unit of the product:
780 \item Write a program to maximise the profit for the company, using eplex
784 \item What program change is required to answer this question:
799 \item round the solution for T1 to the nearest integer and instantiate it
802 \item round the solution for T2 to the nearest integer and instantiate it
809 triggering of the solver instead of explicit calls to eplex_solve/1.