1 | /* $Id: CbcModel.hpp 2404 2018-10-28 15:57:03Z forrest $ */ |
---|
2 | // Copyright (C) 2002, International Business Machines |
---|
3 | // Corporation and others. All Rights Reserved. |
---|
4 | // This code is licensed under the terms of the Eclipse Public License (EPL). |
---|
5 | |
---|
6 | #ifndef CbcModel_H |
---|
7 | #define CbcModel_H |
---|
8 | #include <string> |
---|
9 | #include <vector> |
---|
10 | #include "CoinMessageHandler.hpp" |
---|
11 | #include "OsiSolverInterface.hpp" |
---|
12 | #include "OsiBranchingObject.hpp" |
---|
13 | #include "OsiCuts.hpp" |
---|
14 | #include "CoinWarmStartBasis.hpp" |
---|
15 | #include "CbcCompareBase.hpp" |
---|
16 | #include "CbcCountRowCut.hpp" |
---|
17 | #include "CbcMessage.hpp" |
---|
18 | #include "CbcEventHandler.hpp" |
---|
19 | #include "ClpDualRowPivot.hpp" |
---|
20 | |
---|
21 | |
---|
22 | class CbcCutGenerator; |
---|
23 | class CbcBaseModel; |
---|
24 | class OsiRowCut; |
---|
25 | class OsiBabSolver; |
---|
26 | class OsiRowCutDebugger; |
---|
27 | class CglCutGenerator; |
---|
28 | class CglStored; |
---|
29 | class CbcCutModifier; |
---|
30 | class CglTreeProbingInfo; |
---|
31 | class CbcHeuristic; |
---|
32 | class OsiObject; |
---|
33 | class CbcThread; |
---|
34 | class CbcTree; |
---|
35 | class CbcStrategy; |
---|
36 | class CbcSymmetry; |
---|
37 | class CbcFeasibilityBase; |
---|
38 | class CbcStatistics; |
---|
39 | class CbcFullNodeInfo; |
---|
40 | class CbcEventHandler ; |
---|
41 | class CglPreProcess; |
---|
42 | class OsiClpSolverInterface; |
---|
43 | class ClpNodeStuff; |
---|
44 | |
---|
45 | // #define CBC_CHECK_BASIS 1 |
---|
46 | |
---|
47 | //############################################################################# |
---|
48 | |
---|
49 | /** Simple Branch and bound class |
---|
50 | |
---|
51 | The initialSolve() method solves the initial LP relaxation of the MIP |
---|
52 | problem. The branchAndBound() method can then be called to finish using |
---|
53 | a branch and cut algorithm. |
---|
54 | |
---|
55 | <h3>Search Tree Traversal</h3> |
---|
56 | |
---|
57 | Subproblems (aka nodes) requiring additional evaluation are stored using |
---|
58 | the CbcNode and CbcNodeInfo objects. Ancestry linkage is maintained in the |
---|
59 | CbcNodeInfo object. Evaluation of a subproblem within branchAndBound() |
---|
60 | proceeds as follows: |
---|
61 | <ul> |
---|
62 | <li> The node representing the most promising parent subproblem is popped |
---|
63 | from the heap which holds the set of subproblems requiring further |
---|
64 | evaluation. |
---|
65 | <li> Using branching instructions stored in the node, and information in |
---|
66 | its ancestors, the model and solver are adjusted to create the |
---|
67 | active subproblem. |
---|
68 | <li> If the parent subproblem will require further evaluation |
---|
69 | (<i>i.e.</i>, there are branches remaining) its node is pushed back |
---|
70 | on the heap. Otherwise, the node is deleted. This may trigger |
---|
71 | recursive deletion of ancestors. |
---|
72 | <li> The newly created subproblem is evaluated. |
---|
73 | <li> If the subproblem requires further evaluation, a node is created. |
---|
74 | All information needed to recreate the subproblem (branching |
---|
75 | information, row and column cuts) is placed in the node and the node |
---|
76 | is added to the set of subproblems awaiting further evaluation. |
---|
77 | </ul> |
---|
78 | Note that there is never a node representing the active subproblem; the model |
---|
79 | and solver represent the active subproblem. |
---|
80 | |
---|
81 | <h3>Row (Constraint) Cut Handling</h3> |
---|
82 | |
---|
83 | For a typical subproblem, the sequence of events is as follows: |
---|
84 | <ul> |
---|
85 | <li> The subproblem is rebuilt for further evaluation: One result of a |
---|
86 | call to addCuts() is a traversal of ancestors, leaving a list of all |
---|
87 | cuts used in the ancestors in #addedCuts_. This list is then scanned |
---|
88 | to construct a basis that includes only tight cuts. Entries for |
---|
89 | loose cuts are set to NULL. |
---|
90 | <li> The subproblem is evaluated: One result of a call to solveWithCuts() |
---|
91 | is the return of a set of newly generated cuts for the subproblem. |
---|
92 | #addedCuts_ is also kept up-to-date as old cuts become loose. |
---|
93 | <li> The subproblem is stored for further processing: A call to |
---|
94 | CbcNodeInfo::addCuts() adds the newly generated cuts to the |
---|
95 | CbcNodeInfo object associated with this node. |
---|
96 | </ul> |
---|
97 | See CbcCountRowCut for details of the bookkeeping associated with cut |
---|
98 | management. |
---|
99 | */ |
---|
100 | |
---|
101 | class CbcModel { |
---|
102 | |
---|
103 | public: |
---|
104 | |
---|
105 | enum CbcIntParam { |
---|
106 | /** The maximum number of nodes before terminating */ |
---|
107 | CbcMaxNumNode = 0, |
---|
108 | /** The maximum number of solutions before terminating */ |
---|
109 | CbcMaxNumSol, |
---|
110 | /** Fathoming discipline |
---|
111 | |
---|
112 | Controls objective function comparisons for purposes of fathoming by bound |
---|
113 | or determining monotonic variables. |
---|
114 | |
---|
115 | If 1, action is taken only when the current objective is strictly worse |
---|
116 | than the target. Implementation is handled by adding a small tolerance to |
---|
117 | the target. |
---|
118 | */ |
---|
119 | CbcFathomDiscipline, |
---|
120 | /** Adjusts printout |
---|
121 | 1 does different node message with number unsatisfied on last branch |
---|
122 | */ |
---|
123 | CbcPrinting, |
---|
124 | /** Number of branches (may be more than number of nodes as may |
---|
125 | include strong branching) */ |
---|
126 | CbcNumberBranches, |
---|
127 | /** Just a marker, so that a static sized array can store parameters. */ |
---|
128 | CbcLastIntParam |
---|
129 | }; |
---|
130 | |
---|
131 | enum CbcDblParam { |
---|
132 | /** The maximum amount the value of an integer variable can vary from |
---|
133 | integer and still be considered feasible. */ |
---|
134 | CbcIntegerTolerance = 0, |
---|
135 | /** The objective is assumed to worsen by this amount for each |
---|
136 | integer infeasibility. */ |
---|
137 | CbcInfeasibilityWeight, |
---|
138 | /** The amount by which to tighten the objective function cutoff when |
---|
139 | a new solution is discovered. */ |
---|
140 | CbcCutoffIncrement, |
---|
141 | /** Stop when the gap between the objective value of the best known solution |
---|
142 | and the best bound on the objective of any solution is less than this. |
---|
143 | |
---|
144 | This is an absolute value. Conversion from a percentage is left to the |
---|
145 | client. |
---|
146 | */ |
---|
147 | CbcAllowableGap, |
---|
148 | /** Stop when the gap between the objective value of the best known solution |
---|
149 | and the best bound on the objective of any solution is less than this |
---|
150 | fraction of of the absolute value of best known solution. |
---|
151 | |
---|
152 | Code stops if either this test or CbcAllowableGap test succeeds |
---|
153 | */ |
---|
154 | CbcAllowableFractionGap, |
---|
155 | /** \brief The maximum number of seconds before terminating. |
---|
156 | A double should be adequate! */ |
---|
157 | CbcMaximumSeconds, |
---|
158 | /// Cutoff - stored for speed |
---|
159 | CbcCurrentCutoff, |
---|
160 | /// Optimization direction - stored for speed |
---|
161 | CbcOptimizationDirection, |
---|
162 | /// Current objective value |
---|
163 | CbcCurrentObjectiveValue, |
---|
164 | /// Current minimization objective value |
---|
165 | CbcCurrentMinimizationObjectiveValue, |
---|
166 | /** \brief The time at start of model. |
---|
167 | So that other pieces of code can access */ |
---|
168 | CbcStartSeconds, |
---|
169 | /** Stop doing heuristics when the gap between the objective value of the |
---|
170 | best known solution and the best bound on the objective of any solution |
---|
171 | is less than this. |
---|
172 | |
---|
173 | This is an absolute value. Conversion from a percentage is left to the |
---|
174 | client. |
---|
175 | */ |
---|
176 | CbcHeuristicGap, |
---|
177 | /** Stop doing heuristics when the gap between the objective value of the |
---|
178 | best known solution and the best bound on the objective of any solution |
---|
179 | is less than this fraction of of the absolute value of best known |
---|
180 | solution. |
---|
181 | |
---|
182 | Code stops if either this test or CbcAllowableGap test succeeds |
---|
183 | */ |
---|
184 | CbcHeuristicFractionGap, |
---|
185 | /// Smallest non-zero change on a branch |
---|
186 | CbcSmallestChange, |
---|
187 | /// Sum of non-zero changes on a branch |
---|
188 | CbcSumChange, |
---|
189 | /// Largest non-zero change on a branch |
---|
190 | CbcLargestChange, |
---|
191 | /// Small non-zero change on a branch to be used as guess |
---|
192 | CbcSmallChange, |
---|
193 | /** Just a marker, so that a static sized array can store parameters. */ |
---|
194 | CbcLastDblParam |
---|
195 | }; |
---|
196 | |
---|
197 | //--------------------------------------------------------------------------- |
---|
198 | |
---|
199 | public: |
---|
200 | ///@name Solve methods |
---|
201 | //@{ |
---|
202 | /** \brief Solve the initial LP relaxation |
---|
203 | |
---|
204 | Invoke the solver's %initialSolve() method. |
---|
205 | */ |
---|
206 | void initialSolve(); |
---|
207 | |
---|
208 | /** \brief Invoke the branch \& cut algorithm |
---|
209 | |
---|
210 | The method assumes that initialSolve() has been called to solve the |
---|
211 | LP relaxation. It processes the root node, then proceeds to explore the |
---|
212 | branch & cut search tree. The search ends when the tree is exhausted or |
---|
213 | one of several execution limits is reached. |
---|
214 | If doStatistics is 1 summary statistics are printed |
---|
215 | if 2 then also the path to best solution (if found by branching) |
---|
216 | if 3 then also one line per node |
---|
217 | */ |
---|
218 | void branchAndBound(int doStatistics = 0); |
---|
219 | private: |
---|
220 | |
---|
221 | /** \brief Evaluate a subproblem using cutting planes and heuristics |
---|
222 | |
---|
223 | The method invokes a main loop which generates cuts, applies heuristics, |
---|
224 | and reoptimises using the solver's native %resolve() method. |
---|
225 | It returns true if the subproblem remains feasible at the end of the |
---|
226 | evaluation. |
---|
227 | */ |
---|
228 | bool solveWithCuts(OsiCuts & cuts, int numberTries, CbcNode * node); |
---|
229 | /** Generate one round of cuts - serial mode |
---|
230 | returns - |
---|
231 | 0 - normal |
---|
232 | 1 - must keep going |
---|
233 | 2 - set numberTries to zero |
---|
234 | -1 - infeasible |
---|
235 | */ |
---|
236 | int serialCuts(OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts); |
---|
237 | /** Generate one round of cuts - parallel mode |
---|
238 | returns - |
---|
239 | 0 - normal |
---|
240 | 1 - must keep going |
---|
241 | 2 - set numberTries to zero |
---|
242 | -1 - infeasible |
---|
243 | */ |
---|
244 | int parallelCuts(CbcBaseModel * master, OsiCuts & cuts, CbcNode * node, OsiCuts & slackCuts, int lastNumberCuts); |
---|
245 | /** Input one node output N nodes to put on tree and optional solution update |
---|
246 | This should be able to operate in parallel so is given a solver and is const(ish) |
---|
247 | However we will need to keep an array of solver_ and bases and more |
---|
248 | status is 0 for normal, 1 if solution |
---|
249 | Calling code should always push nodes back on tree |
---|
250 | */ |
---|
251 | CbcNode ** solveOneNode(int whichSolver, CbcNode * node, |
---|
252 | int & numberNodesOutput, int & status) ; |
---|
253 | /// Update size of whichGenerator |
---|
254 | void resizeWhichGenerator(int numberNow, int numberAfter); |
---|
255 | public: |
---|
256 | #ifdef CBC_KEEP_DEPRECATED |
---|
257 | // See if anyone is using these any more!! |
---|
258 | /** \brief create a clean model from partially fixed problem |
---|
259 | |
---|
260 | The method creates a new model with given bounds and with no tree. |
---|
261 | */ |
---|
262 | CbcModel * cleanModel(const double * lower, const double * upper); |
---|
263 | /** \brief Invoke the branch \& cut algorithm on partially fixed problem |
---|
264 | |
---|
265 | The method presolves the given model and does branch and cut. The search |
---|
266 | ends when the tree is exhausted or maximum nodes is reached. |
---|
267 | |
---|
268 | If better solution found then it is saved. |
---|
269 | |
---|
270 | Returns 0 if search completed and solution, 1 if not completed and solution, |
---|
271 | 2 if completed and no solution, 3 if not completed and no solution. |
---|
272 | |
---|
273 | Normally okay to do cleanModel immediately followed by subBranchandBound |
---|
274 | (== other form of subBranchAndBound) |
---|
275 | but may need to get at model for advanced features. |
---|
276 | |
---|
277 | Deletes model2 |
---|
278 | */ |
---|
279 | int subBranchAndBound(CbcModel * model2, |
---|
280 | CbcModel * presolvedModel, |
---|
281 | int maximumNodes); |
---|
282 | /** \brief Invoke the branch \& cut algorithm on partially fixed problem |
---|
283 | |
---|
284 | The method creates a new model with given bounds, presolves it |
---|
285 | then proceeds to explore the branch & cut search tree. The search |
---|
286 | ends when the tree is exhausted or maximum nodes is reached. |
---|
287 | |
---|
288 | If better solution found then it is saved. |
---|
289 | |
---|
290 | Returns 0 if search completed and solution, 1 if not completed and solution, |
---|
291 | 2 if completed and no solution, 3 if not completed and no solution. |
---|
292 | |
---|
293 | This is just subModel immediately followed by other version of |
---|
294 | subBranchandBound. |
---|
295 | |
---|
296 | */ |
---|
297 | int subBranchAndBound(const double * lower, const double * upper, |
---|
298 | int maximumNodes); |
---|
299 | |
---|
300 | /** \brief Process root node and return a strengthened model |
---|
301 | |
---|
302 | The method assumes that initialSolve() has been called to solve the |
---|
303 | LP relaxation. It processes the root node and then returns a pointer |
---|
304 | to the strengthened model (or NULL if infeasible) |
---|
305 | */ |
---|
306 | OsiSolverInterface * strengthenedModel(); |
---|
307 | /** preProcess problem - replacing solver |
---|
308 | If makeEquality true then <= cliques converted to ==. |
---|
309 | Presolve will be done numberPasses times. |
---|
310 | |
---|
311 | Returns NULL if infeasible |
---|
312 | |
---|
313 | If makeEquality is 1 add slacks to get cliques, |
---|
314 | if 2 add slacks to get sos (but only if looks plausible) and keep sos info |
---|
315 | */ |
---|
316 | CglPreProcess * preProcess( int makeEquality = 0, int numberPasses = 5, |
---|
317 | int tuning = 5); |
---|
318 | /** Does postprocessing - original solver back. |
---|
319 | User has to delete process */ |
---|
320 | void postProcess(CglPreProcess * process); |
---|
321 | #endif |
---|
322 | /// Returns CglPreProcess used before branch and bound |
---|
323 | inline CglPreProcess * preProcess( ) const |
---|
324 | { return preProcess_;} |
---|
325 | /// Set CglPreProcess used before branch and bound |
---|
326 | inline void setPreProcess(CglPreProcess * preProcess) |
---|
327 | { preProcess_ = preProcess;} |
---|
328 | /// Adds an update information object |
---|
329 | void addUpdateInformation(const CbcObjectUpdateData & data); |
---|
330 | /** Do one node - broken out for clarity? |
---|
331 | also for parallel (when baseModel!=this) |
---|
332 | Returns 1 if solution found |
---|
333 | node NULL on return if no branches left |
---|
334 | newNode NULL if no new node created |
---|
335 | */ |
---|
336 | int doOneNode(CbcModel * baseModel, CbcNode * & node, CbcNode * & newNode); |
---|
337 | |
---|
338 | public: |
---|
339 | /** \brief Reoptimise an LP relaxation |
---|
340 | |
---|
341 | Invoke the solver's %resolve() method. |
---|
342 | whereFrom - |
---|
343 | 0 - initial continuous |
---|
344 | 1 - resolve on branch (before new cuts) |
---|
345 | 2 - after new cuts |
---|
346 | 3 - obsolete code or something modified problem in unexpected way |
---|
347 | 10 - after strong branching has fixed variables at root |
---|
348 | 11 - after strong branching has fixed variables in tree |
---|
349 | |
---|
350 | returns 1 feasible, 0 infeasible, -1 feasible but skip cuts |
---|
351 | */ |
---|
352 | int resolve(CbcNodeInfo * parent, int whereFrom, |
---|
353 | double * saveSolution = NULL, |
---|
354 | double * saveLower = NULL, |
---|
355 | double * saveUpper = NULL); |
---|
356 | /// Make given rows (L or G) into global cuts and remove from lp |
---|
357 | void makeGlobalCuts(int numberRows, const int * which); |
---|
358 | /// Make given cut into a global cut |
---|
359 | int makeGlobalCut(const OsiRowCut * cut); |
---|
360 | /// Make given cut into a global cut |
---|
361 | int makeGlobalCut(const OsiRowCut & cut); |
---|
362 | /// Make given column cut into a global cut |
---|
363 | void makeGlobalCut(const OsiColCut * cut); |
---|
364 | /// Make given column cut into a global cut |
---|
365 | void makeGlobalCut(const OsiColCut & cut); |
---|
366 | /// Make partial cut into a global cut and save |
---|
367 | void makePartialCut(const OsiRowCut * cut, const OsiSolverInterface * solver=NULL); |
---|
368 | /// Make partial cuts into global cuts |
---|
369 | void makeGlobalCuts(); |
---|
370 | /// Which cut generator generated this cut |
---|
371 | inline const int * whichGenerator() const |
---|
372 | { return whichGenerator_;} |
---|
373 | //@} |
---|
374 | |
---|
375 | /** \name Presolve methods */ |
---|
376 | //@{ |
---|
377 | |
---|
378 | /** Identify cliques and construct corresponding objects. |
---|
379 | |
---|
380 | Find cliques with size in the range |
---|
381 | [\p atLeastThisMany, \p lessThanThis] and construct corresponding |
---|
382 | CbcClique objects. |
---|
383 | If \p makeEquality is true then a new model may be returned if |
---|
384 | modifications had to be made, otherwise \c this is returned. |
---|
385 | If the problem is infeasible #numberObjects_ is set to -1. |
---|
386 | A client must use deleteObjects() before a second call to findCliques(). |
---|
387 | If priorities exist, clique priority is set to the default. |
---|
388 | */ |
---|
389 | CbcModel * findCliques(bool makeEquality, int atLeastThisMany, |
---|
390 | int lessThanThis, int defaultValue = 1000); |
---|
391 | |
---|
392 | /** Do integer presolve, creating a new (presolved) model. |
---|
393 | |
---|
394 | Returns the new model, or NULL if feasibility is lost. |
---|
395 | If weak is true then just does a normal presolve |
---|
396 | |
---|
397 | \todo It remains to work out the cleanest way of getting a solution to |
---|
398 | the original problem at the end. So this is very preliminary. |
---|
399 | */ |
---|
400 | CbcModel * integerPresolve(bool weak = false); |
---|
401 | |
---|
402 | /** Do integer presolve, modifying the current model. |
---|
403 | |
---|
404 | Returns true if the model remains feasible after presolve. |
---|
405 | */ |
---|
406 | bool integerPresolveThisModel(OsiSolverInterface * originalSolver, bool weak = false); |
---|
407 | |
---|
408 | |
---|
409 | /// Put back information into the original model after integer presolve. |
---|
410 | void originalModel(CbcModel * presolvedModel, bool weak); |
---|
411 | |
---|
412 | /** \brief For variables involved in VUB constraints, see if we can tighten |
---|
413 | bounds by solving lp's |
---|
414 | |
---|
415 | Returns false if feasibility is lost. |
---|
416 | If CglProbing is available, it will be tried as well to see if it can |
---|
417 | tighten bounds. |
---|
418 | This routine is just a front end for tightenVubs(int,const int*,double). |
---|
419 | |
---|
420 | If <tt>type = -1</tt> all variables are processed (could be very slow). |
---|
421 | If <tt>type = 0</tt> only variables involved in VUBs are processed. |
---|
422 | If <tt>type = n > 0</tt>, only the n most expensive VUB variables |
---|
423 | are processed, where it is assumed that x is at its maximum so delta |
---|
424 | would have to go to 1 (if x not at bound). |
---|
425 | |
---|
426 | If \p allowMultipleBinary is true, then a VUB constraint is a row with |
---|
427 | one continuous variable and any number of binary variables. |
---|
428 | |
---|
429 | If <tt>useCutoff < 1.0e30</tt>, the original objective is installed as a |
---|
430 | constraint with \p useCutoff as a bound. |
---|
431 | */ |
---|
432 | bool tightenVubs(int type, bool allowMultipleBinary = false, |
---|
433 | double useCutoff = 1.0e50); |
---|
434 | |
---|
435 | /** \brief For variables involved in VUB constraints, see if we can tighten |
---|
436 | bounds by solving lp's |
---|
437 | |
---|
438 | This version is just handed a list of variables to be processed. |
---|
439 | */ |
---|
440 | bool tightenVubs(int numberVubs, const int * which, |
---|
441 | double useCutoff = 1.0e50); |
---|
442 | /** |
---|
443 | Analyze problem to find a minimum change in the objective function. |
---|
444 | */ |
---|
445 | void analyzeObjective(); |
---|
446 | /** Returns postProcessed solution in solver(called from event handler) |
---|
447 | Normally used for integer solution (not really tested otherwise) |
---|
448 | solutionType 1 is best integer so far, 0 is current solution |
---|
449 | (may not be integer) */ |
---|
450 | const OsiSolverInterface * postProcessedSolver(int solutionType=1); |
---|
451 | |
---|
452 | /** |
---|
453 | Add additional integers. |
---|
454 | */ |
---|
455 | void AddIntegers(); |
---|
456 | /** |
---|
457 | Save copy of the model. |
---|
458 | */ |
---|
459 | void saveModel(OsiSolverInterface * saveSolver, double * checkCutoffForRestart, bool * feasible); |
---|
460 | /** |
---|
461 | Flip direction of optimization on all models |
---|
462 | */ |
---|
463 | void flipModel(); |
---|
464 | /** |
---|
465 | Clean model i.e. make SOS/integer variables exactly at bound if needed. |
---|
466 | Only if moreSpecialOptions2_ 15 bit set (32768) as there is a small |
---|
467 | overhead (more2 in standalone cbc). |
---|
468 | Fine tuning can be done in configure with -DCLEAN_INTEGER_VARIABLES |
---|
469 | and -DZERO_ODD_TOLERANCE=1.0e-nn |
---|
470 | If CLEAN_INTEGER_VARIABLES not defined then cleaning is only done for |
---|
471 | SOS variables. |
---|
472 | If ZERO_ODD_TOLERANCE not defined then 1.0e-14 used. You can define as |
---|
473 | 0.0 if you are paranoid. |
---|
474 | Returns number of variables forced out |
---|
475 | cleanVariables array will be used if exists |
---|
476 | */ |
---|
477 | int cleanBounds(OsiSolverInterface * solver, char * cleanVariables); |
---|
478 | /// Sets up cleanVariables array (i.e. ones to be careful about) |
---|
479 | char * setupCleanVariables(); |
---|
480 | //@} |
---|
481 | |
---|
482 | /** \name Object manipulation routines |
---|
483 | |
---|
484 | See OsiObject for an explanation of `object' in the context of CbcModel. |
---|
485 | */ |
---|
486 | //@{ |
---|
487 | |
---|
488 | /// Get the number of objects |
---|
489 | inline int numberObjects() const { |
---|
490 | return numberObjects_; |
---|
491 | } |
---|
492 | /// Set the number of objects |
---|
493 | inline void setNumberObjects(int number) { |
---|
494 | numberObjects_ = number; |
---|
495 | } |
---|
496 | |
---|
497 | /// Get the array of objects |
---|
498 | inline OsiObject ** objects() const { |
---|
499 | return object_; |
---|
500 | } |
---|
501 | |
---|
502 | /// Get the specified object |
---|
503 | const inline OsiObject * object(int which) const { |
---|
504 | return object_[which]; |
---|
505 | } |
---|
506 | /// Get the specified object |
---|
507 | inline OsiObject * modifiableObject(int which) const { |
---|
508 | return object_[which]; |
---|
509 | } |
---|
510 | |
---|
511 | void setOptionalInteger(int index); |
---|
512 | |
---|
513 | /// Delete all object information (and just back to integers if true) |
---|
514 | void deleteObjects(bool findIntegers = true); |
---|
515 | |
---|
516 | /** Add in object information. |
---|
517 | |
---|
518 | Objects are cloned; the owner can delete the originals. |
---|
519 | */ |
---|
520 | void addObjects(int numberObjects, OsiObject ** objects); |
---|
521 | |
---|
522 | /** Add in object information. |
---|
523 | |
---|
524 | Objects are cloned; the owner can delete the originals. |
---|
525 | */ |
---|
526 | void addObjects(int numberObjects, CbcObject ** objects); |
---|
527 | |
---|
528 | /// Ensure attached objects point to this model. |
---|
529 | void synchronizeModel() ; |
---|
530 | |
---|
531 | /** \brief Identify integer variables and create corresponding objects. |
---|
532 | |
---|
533 | Record integer variables and create an CbcSimpleInteger object for each |
---|
534 | one. |
---|
535 | If \p startAgain is true, a new scan is forced, overwriting any existing |
---|
536 | integer variable information. |
---|
537 | If type > 0 then 1==PseudoCost, 2 new ones low priority |
---|
538 | */ |
---|
539 | |
---|
540 | void findIntegers(bool startAgain, int type = 0); |
---|
541 | /** Add SOS info to solver - |
---|
542 | Overwrites SOS information in solver with information |
---|
543 | in CbcModel. Has no effect with some solvers. |
---|
544 | Also updates integer info. */ |
---|
545 | void addSOSEtcToSolver(); |
---|
546 | |
---|
547 | #ifdef SWITCH_VARIABLES |
---|
548 | /// Convert Dynamic to Switching |
---|
549 | int findSwitching(); |
---|
550 | /// Fix associated variables |
---|
551 | int fixAssociated(OsiSolverInterface * solver,int cleanBasis); |
---|
552 | /// Debug associated variables |
---|
553 | int checkAssociated(const OsiSolverInterface * solver, |
---|
554 | const double * solution, int printLevel); |
---|
555 | #endif |
---|
556 | //@} |
---|
557 | |
---|
558 | //--------------------------------------------------------------------------- |
---|
559 | |
---|
560 | /**@name Parameter set/get methods |
---|
561 | |
---|
562 | The set methods return true if the parameter was set to the given value, |
---|
563 | false if the value of the parameter is out of range. |
---|
564 | |
---|
565 | The get methods return the value of the parameter. |
---|
566 | |
---|
567 | */ |
---|
568 | //@{ |
---|
569 | /// Set an integer parameter |
---|
570 | inline bool setIntParam(CbcIntParam key, int value) { |
---|
571 | intParam_[key] = value; |
---|
572 | return true; |
---|
573 | } |
---|
574 | /// Set a double parameter |
---|
575 | inline bool setDblParam(CbcDblParam key, double value) { |
---|
576 | dblParam_[key] = value; |
---|
577 | return true; |
---|
578 | } |
---|
579 | /// Get an integer parameter |
---|
580 | inline int getIntParam(CbcIntParam key) const { |
---|
581 | return intParam_[key]; |
---|
582 | } |
---|
583 | /// Get a double parameter |
---|
584 | inline double getDblParam(CbcDblParam key) const { |
---|
585 | return dblParam_[key]; |
---|
586 | } |
---|
587 | /*! \brief Set cutoff bound on the objective function. |
---|
588 | |
---|
589 | When using strict comparison, the bound is adjusted by a tolerance to |
---|
590 | avoid accidentally cutting off the optimal solution. |
---|
591 | */ |
---|
592 | void setCutoff(double value) ; |
---|
593 | |
---|
594 | /// Get the cutoff bound on the objective function - always as minimize |
---|
595 | inline double getCutoff() const { //double value ; |
---|
596 | //solver_->getDblParam(OsiDualObjectiveLimit,value) ; |
---|
597 | //assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense()); |
---|
598 | return dblParam_[CbcCurrentCutoff]; |
---|
599 | } |
---|
600 | |
---|
601 | /// Set the \link CbcModel::CbcMaxNumNode maximum node limit \endlink |
---|
602 | inline bool setMaximumNodes( int value) { |
---|
603 | return setIntParam(CbcMaxNumNode, value); |
---|
604 | } |
---|
605 | |
---|
606 | /// Get the \link CbcModel::CbcMaxNumNode maximum node limit \endlink |
---|
607 | inline int getMaximumNodes() const { |
---|
608 | return getIntParam(CbcMaxNumNode); |
---|
609 | } |
---|
610 | |
---|
611 | /** Set the |
---|
612 | \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink |
---|
613 | desired. |
---|
614 | */ |
---|
615 | inline bool setMaximumSolutions( int value) { |
---|
616 | return setIntParam(CbcMaxNumSol, value); |
---|
617 | } |
---|
618 | /** Get the |
---|
619 | \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink |
---|
620 | desired. |
---|
621 | */ |
---|
622 | inline int getMaximumSolutions() const { |
---|
623 | return getIntParam(CbcMaxNumSol); |
---|
624 | } |
---|
625 | /// Set the printing mode |
---|
626 | inline bool setPrintingMode( int value) { |
---|
627 | return setIntParam(CbcPrinting, value); |
---|
628 | } |
---|
629 | |
---|
630 | /// Get the printing mode |
---|
631 | inline int getPrintingMode() const { |
---|
632 | return getIntParam(CbcPrinting); |
---|
633 | } |
---|
634 | |
---|
635 | /** Set the |
---|
636 | \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink |
---|
637 | desired. |
---|
638 | */ |
---|
639 | inline bool setMaximumSeconds( double value) { |
---|
640 | return setDblParam(CbcMaximumSeconds, value); |
---|
641 | } |
---|
642 | /** Get the |
---|
643 | \link CbcModel::CbcMaximumSeconds maximum number of seconds \endlink |
---|
644 | desired. |
---|
645 | */ |
---|
646 | inline double getMaximumSeconds() const { |
---|
647 | return getDblParam(CbcMaximumSeconds); |
---|
648 | } |
---|
649 | /// Current time since start of branchAndbound |
---|
650 | double getCurrentSeconds() const ; |
---|
651 | |
---|
652 | /// Return true if maximum time reached |
---|
653 | bool maximumSecondsReached() const ; |
---|
654 | |
---|
655 | /** Set the |
---|
656 | \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink |
---|
657 | */ |
---|
658 | inline bool setIntegerTolerance( double value) { |
---|
659 | return setDblParam(CbcIntegerTolerance, value); |
---|
660 | } |
---|
661 | /** Get the |
---|
662 | \link CbcModel::CbcIntegerTolerance integrality tolerance \endlink |
---|
663 | */ |
---|
664 | inline double getIntegerTolerance() const { |
---|
665 | return getDblParam(CbcIntegerTolerance); |
---|
666 | } |
---|
667 | |
---|
668 | /** Set the |
---|
669 | \link CbcModel::CbcInfeasibilityWeight |
---|
670 | weight per integer infeasibility \endlink |
---|
671 | */ |
---|
672 | inline bool setInfeasibilityWeight( double value) { |
---|
673 | return setDblParam(CbcInfeasibilityWeight, value); |
---|
674 | } |
---|
675 | /** Get the |
---|
676 | \link CbcModel::CbcInfeasibilityWeight |
---|
677 | weight per integer infeasibility \endlink |
---|
678 | */ |
---|
679 | inline double getInfeasibilityWeight() const { |
---|
680 | return getDblParam(CbcInfeasibilityWeight); |
---|
681 | } |
---|
682 | |
---|
683 | /** Set the \link CbcModel::CbcAllowableGap allowable gap \endlink |
---|
684 | between the best known solution and the best possible solution. |
---|
685 | */ |
---|
686 | inline bool setAllowableGap( double value) { |
---|
687 | return setDblParam(CbcAllowableGap, value); |
---|
688 | } |
---|
689 | /** Get the \link CbcModel::CbcAllowableGap allowable gap \endlink |
---|
690 | between the best known solution and the best possible solution. |
---|
691 | */ |
---|
692 | inline double getAllowableGap() const { |
---|
693 | return getDblParam(CbcAllowableGap); |
---|
694 | } |
---|
695 | |
---|
696 | /** Set the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink |
---|
697 | between the best known solution and the best possible solution. |
---|
698 | */ |
---|
699 | inline bool setAllowableFractionGap( double value) { |
---|
700 | return setDblParam(CbcAllowableFractionGap, value); |
---|
701 | } |
---|
702 | /** Get the \link CbcModel::CbcAllowableFractionGap fraction allowable gap \endlink |
---|
703 | between the best known solution and the best possible solution. |
---|
704 | */ |
---|
705 | inline double getAllowableFractionGap() const { |
---|
706 | return getDblParam(CbcAllowableFractionGap); |
---|
707 | } |
---|
708 | /** Set the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink |
---|
709 | between the best known solution and the best possible solution. |
---|
710 | */ |
---|
711 | inline bool setAllowablePercentageGap( double value) { |
---|
712 | return setDblParam(CbcAllowableFractionGap, value*0.01); |
---|
713 | } |
---|
714 | /** Get the \link CbcModel::CbcAllowableFractionGap percentage allowable gap \endlink |
---|
715 | between the best known solution and the best possible solution. |
---|
716 | */ |
---|
717 | inline double getAllowablePercentageGap() const { |
---|
718 | return 100.0*getDblParam(CbcAllowableFractionGap); |
---|
719 | } |
---|
720 | /** Set the \link CbcModel::CbcHeuristicGap heuristic gap \endlink |
---|
721 | between the best known solution and the best possible solution. |
---|
722 | */ |
---|
723 | inline bool setHeuristicGap( double value) { |
---|
724 | return setDblParam(CbcHeuristicGap, value); |
---|
725 | } |
---|
726 | /** Get the \link CbcModel::CbcHeuristicGap heuristic gap \endlink |
---|
727 | between the best known solution and the best possible solution. |
---|
728 | */ |
---|
729 | inline double getHeuristicGap() const { |
---|
730 | return getDblParam(CbcHeuristicGap); |
---|
731 | } |
---|
732 | |
---|
733 | /** Set the \link CbcModel::CbcHeuristicFractionGap fraction heuristic gap \endlink |
---|
734 | between the best known solution and the best possible solution. |
---|
735 | */ |
---|
736 | inline bool setHeuristicFractionGap( double value) { |
---|
737 | return setDblParam(CbcHeuristicFractionGap, value); |
---|
738 | } |
---|
739 | /** Get the \link CbcModel::CbcHeuristicFractionGap fraction heuristic gap \endlink |
---|
740 | between the best known solution and the best possible solution. |
---|
741 | */ |
---|
742 | inline double getHeuristicFractionGap() const { |
---|
743 | return getDblParam(CbcHeuristicFractionGap); |
---|
744 | } |
---|
745 | /** Set the |
---|
746 | \link CbcModel::CbcCutoffIncrement \endlink |
---|
747 | desired. |
---|
748 | */ |
---|
749 | inline bool setCutoffIncrement( double value) { |
---|
750 | return setDblParam(CbcCutoffIncrement, value); |
---|
751 | } |
---|
752 | /** Get the |
---|
753 | \link CbcModel::CbcCutoffIncrement \endlink |
---|
754 | desired. |
---|
755 | */ |
---|
756 | inline double getCutoffIncrement() const { |
---|
757 | return getDblParam(CbcCutoffIncrement); |
---|
758 | } |
---|
759 | /// See if can stop on gap |
---|
760 | bool canStopOnGap() const; |
---|
761 | |
---|
762 | /** Pass in target solution and optional priorities. |
---|
763 | If priorities then >0 means only branch if incorrect |
---|
764 | while <0 means branch even if correct. +1 or -1 are |
---|
765 | highest priority */ |
---|
766 | void setHotstartSolution(const double * solution, const int * priorities = NULL) ; |
---|
767 | |
---|
768 | /// Set the minimum drop to continue cuts |
---|
769 | inline void setMinimumDrop(double value) { |
---|
770 | minimumDrop_ = value; |
---|
771 | } |
---|
772 | /// Get the minimum drop to continue cuts |
---|
773 | inline double getMinimumDrop() const { |
---|
774 | return minimumDrop_; |
---|
775 | } |
---|
776 | |
---|
777 | /** Set the maximum number of cut passes at root node (default 20) |
---|
778 | Minimum drop can also be used for fine tuning */ |
---|
779 | inline void setMaximumCutPassesAtRoot(int value) { |
---|
780 | maximumCutPassesAtRoot_ = value; |
---|
781 | } |
---|
782 | /** Get the maximum number of cut passes at root node */ |
---|
783 | inline int getMaximumCutPassesAtRoot() const { |
---|
784 | return maximumCutPassesAtRoot_; |
---|
785 | } |
---|
786 | |
---|
787 | /** Set the maximum number of cut passes at other nodes (default 10) |
---|
788 | Minimum drop can also be used for fine tuning */ |
---|
789 | inline void setMaximumCutPasses(int value) { |
---|
790 | maximumCutPasses_ = value; |
---|
791 | } |
---|
792 | /** Get the maximum number of cut passes at other nodes (default 10) */ |
---|
793 | inline int getMaximumCutPasses() const { |
---|
794 | return maximumCutPasses_; |
---|
795 | } |
---|
796 | /** Get current cut pass number in this round of cuts. |
---|
797 | (1 is first pass) */ |
---|
798 | inline int getCurrentPassNumber() const { |
---|
799 | return currentPassNumber_; |
---|
800 | } |
---|
801 | /** Set current cut pass number in this round of cuts. |
---|
802 | (1 is first pass) */ |
---|
803 | inline void setCurrentPassNumber(int value) { |
---|
804 | currentPassNumber_ = value; |
---|
805 | } |
---|
806 | |
---|
807 | /** Set the maximum number of candidates to be evaluated for strong |
---|
808 | branching. |
---|
809 | |
---|
810 | A value of 0 disables strong branching. |
---|
811 | */ |
---|
812 | void setNumberStrong(int number); |
---|
813 | /** Get the maximum number of candidates to be evaluated for strong |
---|
814 | branching. |
---|
815 | */ |
---|
816 | inline int numberStrong() const { |
---|
817 | return numberStrong_; |
---|
818 | } |
---|
819 | /** Set global preferred way to branch |
---|
820 | -1 down, +1 up, 0 no preference */ |
---|
821 | inline void setPreferredWay(int value) { |
---|
822 | preferredWay_ = value; |
---|
823 | } |
---|
824 | /** Get the preferred way to branch (default 0) */ |
---|
825 | inline int getPreferredWay() const { |
---|
826 | return preferredWay_; |
---|
827 | } |
---|
828 | /// Get at which depths to do cuts |
---|
829 | inline int whenCuts() const { |
---|
830 | return whenCuts_; |
---|
831 | } |
---|
832 | /// Set at which depths to do cuts |
---|
833 | inline void setWhenCuts(int value) { |
---|
834 | whenCuts_ = value; |
---|
835 | } |
---|
836 | /** Return true if we want to do cuts |
---|
837 | If allowForTopOfTree zero then just does on multiples of depth |
---|
838 | if 1 then allows for doing at top of tree |
---|
839 | if 2 then says if cuts allowed anywhere apart from root |
---|
840 | */ |
---|
841 | bool doCutsNow(int allowForTopOfTree) const; |
---|
842 | |
---|
843 | /** Set the number of branches before pseudo costs believed |
---|
844 | in dynamic strong branching. |
---|
845 | |
---|
846 | A value of 0 disables dynamic strong branching. |
---|
847 | */ |
---|
848 | void setNumberBeforeTrust(int number); |
---|
849 | /** get the number of branches before pseudo costs believed |
---|
850 | in dynamic strong branching. */ |
---|
851 | inline int numberBeforeTrust() const { |
---|
852 | return numberBeforeTrust_; |
---|
853 | } |
---|
854 | /** Set the number of variables for which to compute penalties |
---|
855 | in dynamic strong branching. |
---|
856 | |
---|
857 | A value of 0 disables penalties. |
---|
858 | */ |
---|
859 | void setNumberPenalties(int number); |
---|
860 | /** get the number of variables for which to compute penalties |
---|
861 | in dynamic strong branching. */ |
---|
862 | inline int numberPenalties() const { |
---|
863 | return numberPenalties_; |
---|
864 | } |
---|
865 | /// Pointer to top of tree |
---|
866 | inline const CbcFullNodeInfo * topOfTree() const |
---|
867 | { return topOfTree_;} |
---|
868 | /// Number of analyze iterations to do |
---|
869 | inline void setNumberAnalyzeIterations(int number) { |
---|
870 | numberAnalyzeIterations_ = number; |
---|
871 | } |
---|
872 | inline int numberAnalyzeIterations() const { |
---|
873 | return numberAnalyzeIterations_; |
---|
874 | } |
---|
875 | /** Get scale factor to make penalties match strong. |
---|
876 | Should/will be computed */ |
---|
877 | inline double penaltyScaleFactor() const { |
---|
878 | return penaltyScaleFactor_; |
---|
879 | } |
---|
880 | /** Set scale factor to make penalties match strong. |
---|
881 | Should/will be computed */ |
---|
882 | void setPenaltyScaleFactor(double value); |
---|
883 | /** Problem type as set by user or found by analysis. This will be extended |
---|
884 | 0 - not known |
---|
885 | 1 - Set partitioning <= |
---|
886 | 2 - Set partitioning == |
---|
887 | 3 - Set covering |
---|
888 | 4 - all +- 1 or all +1 and odd |
---|
889 | */ |
---|
890 | void inline setProblemType(int number) { |
---|
891 | problemType_ = number; |
---|
892 | } |
---|
893 | inline int problemType() const { |
---|
894 | return problemType_; |
---|
895 | } |
---|
896 | /// Current depth |
---|
897 | inline int currentDepth() const { |
---|
898 | return currentDepth_; |
---|
899 | } |
---|
900 | |
---|
901 | /// Set how often to scan global cuts |
---|
902 | void setHowOftenGlobalScan(int number); |
---|
903 | /// Get how often to scan global cuts |
---|
904 | inline int howOftenGlobalScan() const { |
---|
905 | return howOftenGlobalScan_; |
---|
906 | } |
---|
907 | /// Original columns as created by integerPresolve or preprocessing |
---|
908 | inline int * originalColumns() const { |
---|
909 | return originalColumns_; |
---|
910 | } |
---|
911 | /// Set original columns as created by preprocessing |
---|
912 | void setOriginalColumns(const int * originalColumns, |
---|
913 | int numberGood=COIN_INT_MAX) ; |
---|
914 | /// Create conflict cut (well - most of) |
---|
915 | OsiRowCut * conflictCut(const OsiSolverInterface * solver, bool & localCuts); |
---|
916 | |
---|
917 | /** Set the print frequency. |
---|
918 | |
---|
919 | Controls the number of nodes evaluated between status prints. |
---|
920 | If <tt>number <=0</tt> the print frequency is set to 100 nodes for large |
---|
921 | problems, 1000 for small problems. |
---|
922 | Print frequency has very slight overhead if small. |
---|
923 | */ |
---|
924 | inline void setPrintFrequency(int number) { |
---|
925 | printFrequency_ = number; |
---|
926 | } |
---|
927 | /// Get the print frequency |
---|
928 | inline int printFrequency() const { |
---|
929 | return printFrequency_; |
---|
930 | } |
---|
931 | //@} |
---|
932 | |
---|
933 | //--------------------------------------------------------------------------- |
---|
934 | ///@name Methods returning info on how the solution process terminated |
---|
935 | //@{ |
---|
936 | /// Are there a numerical difficulties? |
---|
937 | bool isAbandoned() const; |
---|
938 | /// Is optimality proven? |
---|
939 | bool isProvenOptimal() const; |
---|
940 | /// Is infeasiblity proven (or none better than cutoff)? |
---|
941 | bool isProvenInfeasible() const; |
---|
942 | /// Was continuous solution unbounded |
---|
943 | bool isContinuousUnbounded() const; |
---|
944 | /// Was continuous solution unbounded |
---|
945 | bool isProvenDualInfeasible() const; |
---|
946 | /// Node limit reached? |
---|
947 | bool isNodeLimitReached() const; |
---|
948 | /// Time limit reached? |
---|
949 | bool isSecondsLimitReached() const; |
---|
950 | /// Solution limit reached? |
---|
951 | bool isSolutionLimitReached() const; |
---|
952 | /// Get how many iterations it took to solve the problem. |
---|
953 | inline int getIterationCount() const { |
---|
954 | return numberIterations_; |
---|
955 | } |
---|
956 | /// Increment how many iterations it took to solve the problem. |
---|
957 | inline void incrementIterationCount(int value) { |
---|
958 | numberIterations_ += value; |
---|
959 | } |
---|
960 | /// Get how many Nodes it took to solve the problem (including those in complete fathoming B&B inside CLP). |
---|
961 | inline int getNodeCount() const { |
---|
962 | return numberNodes_; |
---|
963 | } |
---|
964 | /// Increment how many nodes it took to solve the problem. |
---|
965 | inline void incrementNodeCount(int value) { |
---|
966 | numberNodes_ += value; |
---|
967 | } |
---|
968 | /// Get how many Nodes were enumerated in complete fathoming B&B inside CLP |
---|
969 | inline int getExtraNodeCount() const { |
---|
970 | return numberExtraNodes_; |
---|
971 | } |
---|
972 | /// Get how many times complete fathoming B&B was done |
---|
973 | inline int getFathomCount() const { |
---|
974 | return numberFathoms_; |
---|
975 | } |
---|
976 | /** Final status of problem |
---|
977 | Some of these can be found out by is...... functions |
---|
978 | -1 before branchAndBound |
---|
979 | 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found |
---|
980 | (or check value of best solution) |
---|
981 | 1 stopped - on maxnodes, maxsols, maxtime |
---|
982 | 2 difficulties so run was abandoned |
---|
983 | (5 event user programmed event occurred) |
---|
984 | */ |
---|
985 | inline int status() const { |
---|
986 | return status_; |
---|
987 | } |
---|
988 | inline void setProblemStatus(int value) { |
---|
989 | status_ = value; |
---|
990 | } |
---|
991 | /** Secondary status of problem |
---|
992 | -1 unset (status_ will also be -1) |
---|
993 | 0 search completed with solution |
---|
994 | 1 linear relaxation not feasible (or worse than cutoff) |
---|
995 | 2 stopped on gap |
---|
996 | 3 stopped on nodes |
---|
997 | 4 stopped on time |
---|
998 | 5 stopped on user event |
---|
999 | 6 stopped on solutions |
---|
1000 | 7 linear relaxation unbounded |
---|
1001 | 8 stopped on iteration limit |
---|
1002 | */ |
---|
1003 | inline int secondaryStatus() const { |
---|
1004 | return secondaryStatus_; |
---|
1005 | } |
---|
1006 | inline void setSecondaryStatus(int value) { |
---|
1007 | secondaryStatus_ = value; |
---|
1008 | } |
---|
1009 | /// Are there numerical difficulties (for initialSolve) ? |
---|
1010 | bool isInitialSolveAbandoned() const ; |
---|
1011 | /// Is optimality proven (for initialSolve) ? |
---|
1012 | bool isInitialSolveProvenOptimal() const ; |
---|
1013 | /// Is primal infeasiblity proven (for initialSolve) ? |
---|
1014 | bool isInitialSolveProvenPrimalInfeasible() const ; |
---|
1015 | /// Is dual infeasiblity proven (for initialSolve) ? |
---|
1016 | bool isInitialSolveProvenDualInfeasible() const ; |
---|
1017 | |
---|
1018 | //@} |
---|
1019 | |
---|
1020 | //--------------------------------------------------------------------------- |
---|
1021 | /**@name Problem information methods |
---|
1022 | |
---|
1023 | These methods call the solver's query routines to return |
---|
1024 | information about the problem referred to by the current object. |
---|
1025 | Querying a problem that has no data associated with it result in |
---|
1026 | zeros for the number of rows and columns, and NULL pointers from |
---|
1027 | the methods that return vectors. |
---|
1028 | |
---|
1029 | Const pointers returned from any data-query method are valid as |
---|
1030 | long as the data is unchanged and the solver is not called. |
---|
1031 | */ |
---|
1032 | //@{ |
---|
1033 | /// Number of rows in continuous (root) problem. |
---|
1034 | inline int numberRowsAtContinuous() const { |
---|
1035 | return numberRowsAtContinuous_; |
---|
1036 | } |
---|
1037 | |
---|
1038 | /// Get number of columns |
---|
1039 | inline int getNumCols() const { |
---|
1040 | return solver_->getNumCols(); |
---|
1041 | } |
---|
1042 | |
---|
1043 | /// Get number of rows |
---|
1044 | inline int getNumRows() const { |
---|
1045 | return solver_->getNumRows(); |
---|
1046 | } |
---|
1047 | |
---|
1048 | /// Get number of nonzero elements |
---|
1049 | inline CoinBigIndex getNumElements() const { |
---|
1050 | return solver_->getNumElements(); |
---|
1051 | } |
---|
1052 | |
---|
1053 | /// Number of integers in problem |
---|
1054 | inline int numberIntegers() const { |
---|
1055 | return numberIntegers_; |
---|
1056 | } |
---|
1057 | // Integer variables |
---|
1058 | inline const int * integerVariable() const { |
---|
1059 | return integerVariable_; |
---|
1060 | } |
---|
1061 | /// Whether or not integer |
---|
1062 | inline char integerType(int i) const { |
---|
1063 | assert (integerInfo_); |
---|
1064 | assert (integerInfo_[i] == 0 || integerInfo_[i] == 1); |
---|
1065 | return integerInfo_[i]; |
---|
1066 | } |
---|
1067 | /// Whether or not integer |
---|
1068 | inline const char * integerType() const { |
---|
1069 | return integerInfo_; |
---|
1070 | } |
---|
1071 | |
---|
1072 | /// Get pointer to array[getNumCols()] of column lower bounds |
---|
1073 | inline const double * getColLower() const { |
---|
1074 | return solver_->getColLower(); |
---|
1075 | } |
---|
1076 | |
---|
1077 | /// Get pointer to array[getNumCols()] of column upper bounds |
---|
1078 | inline const double * getColUpper() const { |
---|
1079 | return solver_->getColUpper(); |
---|
1080 | } |
---|
1081 | |
---|
1082 | /** Get pointer to array[getNumRows()] of row constraint senses. |
---|
1083 | <ul> |
---|
1084 | <li>'L': <= constraint |
---|
1085 | <li>'E': = constraint |
---|
1086 | <li>'G': >= constraint |
---|
1087 | <li>'R': ranged constraint |
---|
1088 | <li>'N': free constraint |
---|
1089 | </ul> |
---|
1090 | */ |
---|
1091 | inline const char * getRowSense() const { |
---|
1092 | return solver_->getRowSense(); |
---|
1093 | } |
---|
1094 | |
---|
1095 | /** Get pointer to array[getNumRows()] of rows right-hand sides |
---|
1096 | <ul> |
---|
1097 | <li> if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i] |
---|
1098 | <li> if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i] |
---|
1099 | <li> if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i] |
---|
1100 | <li> if rowsense()[i] == 'N' then rhs()[i] == 0.0 |
---|
1101 | </ul> |
---|
1102 | */ |
---|
1103 | inline const double * getRightHandSide() const { |
---|
1104 | return solver_->getRightHandSide(); |
---|
1105 | } |
---|
1106 | |
---|
1107 | /** Get pointer to array[getNumRows()] of row ranges. |
---|
1108 | <ul> |
---|
1109 | <li> if rowsense()[i] == 'R' then |
---|
1110 | rowrange()[i] == rowupper()[i] - rowlower()[i] |
---|
1111 | <li> if rowsense()[i] != 'R' then |
---|
1112 | rowrange()[i] is 0.0 |
---|
1113 | </ul> |
---|
1114 | */ |
---|
1115 | inline const double * getRowRange() const { |
---|
1116 | return solver_->getRowRange(); |
---|
1117 | } |
---|
1118 | |
---|
1119 | /// Get pointer to array[getNumRows()] of row lower bounds |
---|
1120 | inline const double * getRowLower() const { |
---|
1121 | return solver_->getRowLower(); |
---|
1122 | } |
---|
1123 | |
---|
1124 | /// Get pointer to array[getNumRows()] of row upper bounds |
---|
1125 | inline const double * getRowUpper() const { |
---|
1126 | return solver_->getRowUpper(); |
---|
1127 | } |
---|
1128 | |
---|
1129 | /// Get pointer to array[getNumCols()] of objective function coefficients |
---|
1130 | inline const double * getObjCoefficients() const { |
---|
1131 | return solver_->getObjCoefficients(); |
---|
1132 | } |
---|
1133 | |
---|
1134 | /// Get objective function sense (1 for min (default), -1 for max) |
---|
1135 | inline double getObjSense() const { |
---|
1136 | //assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense()); |
---|
1137 | return dblParam_[CbcOptimizationDirection]; |
---|
1138 | } |
---|
1139 | |
---|
1140 | /// Return true if variable is continuous |
---|
1141 | inline bool isContinuous(int colIndex) const { |
---|
1142 | return solver_->isContinuous(colIndex); |
---|
1143 | } |
---|
1144 | |
---|
1145 | /// Return true if variable is binary |
---|
1146 | inline bool isBinary(int colIndex) const { |
---|
1147 | return solver_->isBinary(colIndex); |
---|
1148 | } |
---|
1149 | |
---|
1150 | /** Return true if column is integer. |
---|
1151 | Note: This function returns true if the the column |
---|
1152 | is binary or a general integer. |
---|
1153 | */ |
---|
1154 | inline bool isInteger(int colIndex) const { |
---|
1155 | return solver_->isInteger(colIndex); |
---|
1156 | } |
---|
1157 | |
---|
1158 | /// Return true if variable is general integer |
---|
1159 | inline bool isIntegerNonBinary(int colIndex) const { |
---|
1160 | return solver_->isIntegerNonBinary(colIndex); |
---|
1161 | } |
---|
1162 | |
---|
1163 | /// Return true if variable is binary and not fixed at either bound |
---|
1164 | inline bool isFreeBinary(int colIndex) const { |
---|
1165 | return solver_->isFreeBinary(colIndex) ; |
---|
1166 | } |
---|
1167 | |
---|
1168 | /// Get pointer to row-wise copy of matrix |
---|
1169 | inline const CoinPackedMatrix * getMatrixByRow() const { |
---|
1170 | return solver_->getMatrixByRow(); |
---|
1171 | } |
---|
1172 | |
---|
1173 | /// Get pointer to column-wise copy of matrix |
---|
1174 | inline const CoinPackedMatrix * getMatrixByCol() const { |
---|
1175 | return solver_->getMatrixByCol(); |
---|
1176 | } |
---|
1177 | |
---|
1178 | /// Get solver's value for infinity |
---|
1179 | inline double getInfinity() const { |
---|
1180 | return solver_->getInfinity(); |
---|
1181 | } |
---|
1182 | /// Get pointer to array[getNumCols()] (for speed) of column lower bounds |
---|
1183 | inline const double * getCbcColLower() const { |
---|
1184 | return cbcColLower_; |
---|
1185 | } |
---|
1186 | /// Get pointer to array[getNumCols()] (for speed) of column upper bounds |
---|
1187 | inline const double * getCbcColUpper() const { |
---|
1188 | return cbcColUpper_; |
---|
1189 | } |
---|
1190 | /// Get pointer to array[getNumRows()] (for speed) of row lower bounds |
---|
1191 | inline const double * getCbcRowLower() const { |
---|
1192 | return cbcRowLower_; |
---|
1193 | } |
---|
1194 | /// Get pointer to array[getNumRows()] (for speed) of row upper bounds |
---|
1195 | inline const double * getCbcRowUpper() const { |
---|
1196 | return cbcRowUpper_; |
---|
1197 | } |
---|
1198 | /// Get pointer to array[getNumCols()] (for speed) of primal solution vector |
---|
1199 | inline const double * getCbcColSolution() const { |
---|
1200 | return cbcColSolution_; |
---|
1201 | } |
---|
1202 | /// Get pointer to array[getNumRows()] (for speed) of dual prices |
---|
1203 | inline const double * getCbcRowPrice() const { |
---|
1204 | return cbcRowPrice_; |
---|
1205 | } |
---|
1206 | /// Get a pointer to array[getNumCols()] (for speed) of reduced costs |
---|
1207 | inline const double * getCbcReducedCost() const { |
---|
1208 | return cbcReducedCost_; |
---|
1209 | } |
---|
1210 | /// Get pointer to array[getNumRows()] (for speed) of row activity levels. |
---|
1211 | inline const double * getCbcRowActivity() const { |
---|
1212 | return cbcRowActivity_; |
---|
1213 | } |
---|
1214 | //@} |
---|
1215 | |
---|
1216 | |
---|
1217 | /**@name Methods related to querying the solution */ |
---|
1218 | //@{ |
---|
1219 | /// Holds solution at continuous (after cuts if branchAndBound called) |
---|
1220 | inline double * continuousSolution() const { |
---|
1221 | return continuousSolution_; |
---|
1222 | } |
---|
1223 | /** Array marked whenever a solution is found if non-zero. |
---|
1224 | Code marks if heuristic returns better so heuristic |
---|
1225 | need only mark if it wants to on solutions which |
---|
1226 | are worse than current */ |
---|
1227 | inline int * usedInSolution() const { |
---|
1228 | return usedInSolution_; |
---|
1229 | } |
---|
1230 | /// Increases usedInSolution for nonzeros |
---|
1231 | void incrementUsed(const double * solution); |
---|
1232 | /// Record a new incumbent solution and update objectiveValue |
---|
1233 | void setBestSolution(CBC_Message how, |
---|
1234 | double & objectiveValue, const double *solution, |
---|
1235 | int fixVariables = 0); |
---|
1236 | /// Just update objectiveValue |
---|
1237 | void setBestObjectiveValue( double objectiveValue); |
---|
1238 | /// Deals with event handler and solution |
---|
1239 | CbcEventHandler::CbcAction dealWithEventHandler(CbcEventHandler::CbcEvent event, |
---|
1240 | double objValue, |
---|
1241 | const double * solution); |
---|
1242 | |
---|
1243 | /** Call this to really test if a valid solution can be feasible |
---|
1244 | Solution is number columns in size. |
---|
1245 | If fixVariables true then bounds of continuous solver updated. |
---|
1246 | Returns objective value (worse than cutoff if not feasible) |
---|
1247 | Previously computed objective value is now passed in (in case user does not do solve) |
---|
1248 | virtual so user can override |
---|
1249 | */ |
---|
1250 | virtual double checkSolution(double cutoff, double * solution, |
---|
1251 | int fixVariables, double originalObjValue); |
---|
1252 | /** Test the current solution for feasiblility. |
---|
1253 | |
---|
1254 | Scan all objects for indications of infeasibility. This is broken down |
---|
1255 | into simple integer infeasibility (\p numberIntegerInfeasibilities) |
---|
1256 | and all other reports of infeasibility (\p numberObjectInfeasibilities). |
---|
1257 | */ |
---|
1258 | bool feasibleSolution(int & numberIntegerInfeasibilities, |
---|
1259 | int & numberObjectInfeasibilities) const; |
---|
1260 | |
---|
1261 | /** Solution to the most recent lp relaxation. |
---|
1262 | |
---|
1263 | The solver's solution to the most recent lp relaxation. |
---|
1264 | */ |
---|
1265 | |
---|
1266 | inline double * currentSolution() const { |
---|
1267 | return currentSolution_; |
---|
1268 | } |
---|
1269 | /** For testing infeasibilities - will point to |
---|
1270 | currentSolution_ or solver-->getColSolution() |
---|
1271 | */ |
---|
1272 | inline const double * testSolution() const { |
---|
1273 | return testSolution_; |
---|
1274 | } |
---|
1275 | inline void setTestSolution(const double * solution) { |
---|
1276 | testSolution_ = solution; |
---|
1277 | } |
---|
1278 | /// Make sure region there and optionally copy solution |
---|
1279 | void reserveCurrentSolution(const double * solution = NULL); |
---|
1280 | |
---|
1281 | /// Get pointer to array[getNumCols()] of primal solution vector |
---|
1282 | inline const double * getColSolution() const { |
---|
1283 | return solver_->getColSolution(); |
---|
1284 | } |
---|
1285 | |
---|
1286 | /// Get pointer to array[getNumRows()] of dual prices |
---|
1287 | inline const double * getRowPrice() const { |
---|
1288 | return solver_->getRowPrice(); |
---|
1289 | } |
---|
1290 | |
---|
1291 | /// Get a pointer to array[getNumCols()] of reduced costs |
---|
1292 | inline const double * getReducedCost() const { |
---|
1293 | return solver_->getReducedCost(); |
---|
1294 | } |
---|
1295 | |
---|
1296 | /// Get pointer to array[getNumRows()] of row activity levels. |
---|
1297 | inline const double * getRowActivity() const { |
---|
1298 | return solver_->getRowActivity(); |
---|
1299 | } |
---|
1300 | |
---|
1301 | /// Get current objective function value |
---|
1302 | inline double getCurrentObjValue() const { |
---|
1303 | return dblParam_[CbcCurrentObjectiveValue]; |
---|
1304 | } |
---|
1305 | /// Get current minimization objective function value |
---|
1306 | inline double getCurrentMinimizationObjValue() const { |
---|
1307 | return dblParam_[CbcCurrentMinimizationObjectiveValue]; |
---|
1308 | } |
---|
1309 | |
---|
1310 | /// Get best objective function value as minimization |
---|
1311 | inline double getMinimizationObjValue() const { |
---|
1312 | return bestObjective_; |
---|
1313 | } |
---|
1314 | /// Set best objective function value as minimization |
---|
1315 | inline void setMinimizationObjValue(double value) { |
---|
1316 | bestObjective_ = value; |
---|
1317 | } |
---|
1318 | |
---|
1319 | /// Get best objective function value |
---|
1320 | inline double getObjValue() const { |
---|
1321 | return bestObjective_ * solver_->getObjSense() ; |
---|
1322 | } |
---|
1323 | /** Get best possible objective function value. |
---|
1324 | This is better of best possible left on tree |
---|
1325 | and best solution found. |
---|
1326 | If called from within branch and cut may be optimistic. |
---|
1327 | */ |
---|
1328 | double getBestPossibleObjValue() const; |
---|
1329 | /// Set best objective function value |
---|
1330 | inline void setObjValue(double value) { |
---|
1331 | bestObjective_ = value * solver_->getObjSense() ; |
---|
1332 | } |
---|
1333 | /// Get solver objective function value (as minimization) |
---|
1334 | inline double getSolverObjValue() const { |
---|
1335 | return solver_->getObjValue() * solver_->getObjSense() ; |
---|
1336 | } |
---|
1337 | |
---|
1338 | /** The best solution to the integer programming problem. |
---|
1339 | |
---|
1340 | The best solution to the integer programming problem found during |
---|
1341 | the search. If no solution is found, the method returns null. |
---|
1342 | */ |
---|
1343 | |
---|
1344 | inline double * bestSolution() const { |
---|
1345 | return bestSolution_; |
---|
1346 | } |
---|
1347 | /** User callable setBestSolution. |
---|
1348 | If check false does not check valid |
---|
1349 | If true then sees if feasible and warns if objective value |
---|
1350 | worse than given (so just set to COIN_DBL_MAX if you don't care). |
---|
1351 | If check true then does not save solution if not feasible |
---|
1352 | */ |
---|
1353 | void setBestSolution(const double * solution, int numberColumns, |
---|
1354 | double objectiveValue, bool check = false); |
---|
1355 | |
---|
1356 | /// Get number of solutions |
---|
1357 | inline int getSolutionCount() const { |
---|
1358 | return numberSolutions_; |
---|
1359 | } |
---|
1360 | |
---|
1361 | /// Set number of solutions (so heuristics will be different) |
---|
1362 | inline void setSolutionCount(int value) { |
---|
1363 | numberSolutions_ = value; |
---|
1364 | } |
---|
1365 | /// Number of saved solutions (including best) |
---|
1366 | int numberSavedSolutions() const; |
---|
1367 | /// Maximum number of extra saved solutions |
---|
1368 | inline int maximumSavedSolutions() const { |
---|
1369 | return maximumSavedSolutions_; |
---|
1370 | } |
---|
1371 | /// Set maximum number of extra saved solutions |
---|
1372 | void setMaximumSavedSolutions(int value); |
---|
1373 | /// Return a saved solution (0==best) - NULL if off end |
---|
1374 | const double * savedSolution(int which) const; |
---|
1375 | /// Return a saved solution objective (0==best) - COIN_DBL_MAX if off end |
---|
1376 | double savedSolutionObjective(int which) const; |
---|
1377 | /// Delete a saved solution and move others up |
---|
1378 | void deleteSavedSolution(int which); |
---|
1379 | |
---|
1380 | /** Current phase (so heuristics etc etc can find out). |
---|
1381 | 0 - initial solve |
---|
1382 | 1 - solve with cuts at root |
---|
1383 | 2 - solve with cuts |
---|
1384 | 3 - other e.g. strong branching |
---|
1385 | 4 - trying to validate a solution |
---|
1386 | 5 - at end of search |
---|
1387 | */ |
---|
1388 | inline int phase() const { |
---|
1389 | return phase_; |
---|
1390 | } |
---|
1391 | |
---|
1392 | /// Get number of heuristic solutions |
---|
1393 | inline int getNumberHeuristicSolutions() const { |
---|
1394 | return numberHeuristicSolutions_; |
---|
1395 | } |
---|
1396 | /// Set number of heuristic solutions |
---|
1397 | inline void setNumberHeuristicSolutions(int value) { |
---|
1398 | numberHeuristicSolutions_ = value; |
---|
1399 | } |
---|
1400 | |
---|
1401 | /// Set objective function sense (1 for min (default), -1 for max,) |
---|
1402 | inline void setObjSense(double s) { |
---|
1403 | dblParam_[CbcOptimizationDirection] = s; |
---|
1404 | solver_->setObjSense(s); |
---|
1405 | } |
---|
1406 | |
---|
1407 | /// Value of objective at continuous |
---|
1408 | inline double getContinuousObjective() const { |
---|
1409 | return originalContinuousObjective_; |
---|
1410 | } |
---|
1411 | inline void setContinuousObjective(double value) { |
---|
1412 | originalContinuousObjective_ = value; |
---|
1413 | } |
---|
1414 | /// Number of infeasibilities at continuous |
---|
1415 | inline int getContinuousInfeasibilities() const { |
---|
1416 | return continuousInfeasibilities_; |
---|
1417 | } |
---|
1418 | inline void setContinuousInfeasibilities(int value) { |
---|
1419 | continuousInfeasibilities_ = value; |
---|
1420 | } |
---|
1421 | /// Value of objective after root node cuts added |
---|
1422 | inline double rootObjectiveAfterCuts() const { |
---|
1423 | return continuousObjective_; |
---|
1424 | } |
---|
1425 | /// Sum of Changes to objective by first solve |
---|
1426 | inline double sumChangeObjective() const { |
---|
1427 | return sumChangeObjective1_; |
---|
1428 | } |
---|
1429 | /** Number of times global cuts violated. When global cut pool then this |
---|
1430 | should be kept for each cut and type of cut */ |
---|
1431 | inline int numberGlobalViolations() const { |
---|
1432 | return numberGlobalViolations_; |
---|
1433 | } |
---|
1434 | inline void clearNumberGlobalViolations() { |
---|
1435 | numberGlobalViolations_ = 0; |
---|
1436 | } |
---|
1437 | /// Whether to force a resolve after takeOffCuts |
---|
1438 | inline bool resolveAfterTakeOffCuts() const { |
---|
1439 | return resolveAfterTakeOffCuts_; |
---|
1440 | } |
---|
1441 | inline void setResolveAfterTakeOffCuts(bool yesNo) { |
---|
1442 | resolveAfterTakeOffCuts_ = yesNo; |
---|
1443 | } |
---|
1444 | /// Maximum number of rows |
---|
1445 | inline int maximumRows() const { |
---|
1446 | return maximumRows_; |
---|
1447 | } |
---|
1448 | /// Work basis for temporary use |
---|
1449 | inline CoinWarmStartBasis & workingBasis() { |
---|
1450 | return workingBasis_; |
---|
1451 | } |
---|
1452 | /// Get number of "iterations" to stop after |
---|
1453 | inline int getStopNumberIterations() const { |
---|
1454 | return stopNumberIterations_; |
---|
1455 | } |
---|
1456 | /// Set number of "iterations" to stop after |
---|
1457 | inline void setStopNumberIterations(int value) { |
---|
1458 | stopNumberIterations_ = value; |
---|
1459 | } |
---|
1460 | /// A pointer to model from CbcHeuristic |
---|
1461 | inline CbcModel * heuristicModel() const |
---|
1462 | { return heuristicModel_;} |
---|
1463 | /// Set a pointer to model from CbcHeuristic |
---|
1464 | inline void setHeuristicModel(CbcModel * model) |
---|
1465 | { heuristicModel_ = model;} |
---|
1466 | //@} |
---|
1467 | |
---|
1468 | /** \name Node selection */ |
---|
1469 | //@{ |
---|
1470 | // Comparison functions (which may be overridden by inheritance) |
---|
1471 | inline CbcCompareBase * nodeComparison() const { |
---|
1472 | return nodeCompare_; |
---|
1473 | } |
---|
1474 | void setNodeComparison(CbcCompareBase * compare); |
---|
1475 | void setNodeComparison(CbcCompareBase & compare); |
---|
1476 | //@} |
---|
1477 | |
---|
1478 | /** \name Problem feasibility checking */ |
---|
1479 | //@{ |
---|
1480 | // Feasibility functions (which may be overridden by inheritance) |
---|
1481 | inline CbcFeasibilityBase * problemFeasibility() const { |
---|
1482 | return problemFeasibility_; |
---|
1483 | } |
---|
1484 | void setProblemFeasibility(CbcFeasibilityBase * feasibility); |
---|
1485 | void setProblemFeasibility(CbcFeasibilityBase & feasibility); |
---|
1486 | //@} |
---|
1487 | |
---|
1488 | /** \name Tree methods and subtree methods */ |
---|
1489 | //@{ |
---|
1490 | /// Tree method e.g. heap (which may be overridden by inheritance) |
---|
1491 | inline CbcTree * tree() const { |
---|
1492 | return tree_; |
---|
1493 | } |
---|
1494 | /// For modifying tree handling (original is cloned) |
---|
1495 | void passInTreeHandler(CbcTree & tree); |
---|
1496 | /** For passing in an CbcModel to do a sub Tree (with derived tree handlers). |
---|
1497 | Passed in model must exist for duration of branch and bound |
---|
1498 | */ |
---|
1499 | void passInSubTreeModel(CbcModel & model); |
---|
1500 | /** For retrieving a copy of subtree model with given OsiSolver. |
---|
1501 | If no subtree model will use self (up to user to reset cutoff etc). |
---|
1502 | If solver NULL uses current |
---|
1503 | */ |
---|
1504 | CbcModel * subTreeModel(OsiSolverInterface * solver = NULL) const; |
---|
1505 | /// Returns number of times any subtree stopped on nodes, time etc |
---|
1506 | inline int numberStoppedSubTrees() const { |
---|
1507 | return numberStoppedSubTrees_; |
---|
1508 | } |
---|
1509 | /// Says a sub tree was stopped |
---|
1510 | inline void incrementSubTreeStopped() { |
---|
1511 | numberStoppedSubTrees_++; |
---|
1512 | } |
---|
1513 | /** Whether to automatically do presolve before branch and bound (subTrees). |
---|
1514 | 0 - no |
---|
1515 | 1 - ordinary presolve |
---|
1516 | 2 - integer presolve (dodgy) |
---|
1517 | */ |
---|
1518 | inline int typePresolve() const { |
---|
1519 | return presolve_; |
---|
1520 | } |
---|
1521 | inline void setTypePresolve(int value) { |
---|
1522 | presolve_ = value; |
---|
1523 | } |
---|
1524 | |
---|
1525 | //@} |
---|
1526 | |
---|
1527 | /** \name Branching Decisions |
---|
1528 | |
---|
1529 | See the CbcBranchDecision class for additional information. |
---|
1530 | */ |
---|
1531 | //@{ |
---|
1532 | |
---|
1533 | /// Get the current branching decision method. |
---|
1534 | inline CbcBranchDecision * branchingMethod() const { |
---|
1535 | return branchingMethod_; |
---|
1536 | } |
---|
1537 | /// Set the branching decision method. |
---|
1538 | inline void setBranchingMethod(CbcBranchDecision * method) { |
---|
1539 | delete branchingMethod_; |
---|
1540 | branchingMethod_ = method->clone(); |
---|
1541 | } |
---|
1542 | /** Set the branching method |
---|
1543 | |
---|
1544 | \overload |
---|
1545 | */ |
---|
1546 | inline void setBranchingMethod(CbcBranchDecision & method) { |
---|
1547 | delete branchingMethod_; |
---|
1548 | branchingMethod_ = method.clone(); |
---|
1549 | } |
---|
1550 | /// Get the current cut modifier method |
---|
1551 | inline CbcCutModifier * cutModifier() const { |
---|
1552 | return cutModifier_; |
---|
1553 | } |
---|
1554 | /// Set the cut modifier method |
---|
1555 | void setCutModifier(CbcCutModifier * modifier); |
---|
1556 | /** Set the cut modifier method |
---|
1557 | |
---|
1558 | \overload |
---|
1559 | */ |
---|
1560 | void setCutModifier(CbcCutModifier & modifier); |
---|
1561 | //@} |
---|
1562 | |
---|
1563 | /** \name Row (constraint) and Column (variable) cut generation */ |
---|
1564 | //@{ |
---|
1565 | |
---|
1566 | /** State of search |
---|
1567 | 0 - no solution |
---|
1568 | 1 - only heuristic solutions |
---|
1569 | 2 - branched to a solution |
---|
1570 | 3 - no solution but many nodes |
---|
1571 | */ |
---|
1572 | inline int stateOfSearch() const { |
---|
1573 | return stateOfSearch_; |
---|
1574 | } |
---|
1575 | inline void setStateOfSearch(int state) { |
---|
1576 | stateOfSearch_ = state; |
---|
1577 | } |
---|
1578 | /// Strategy worked out - mainly at root node for use by CbcNode |
---|
1579 | inline int searchStrategy() const { |
---|
1580 | return searchStrategy_; |
---|
1581 | } |
---|
1582 | /// Set strategy worked out - mainly at root node for use by CbcNode |
---|
1583 | inline void setSearchStrategy(int value) { |
---|
1584 | searchStrategy_ = value; |
---|
1585 | } |
---|
1586 | /// Stong branching strategy |
---|
1587 | inline int strongStrategy() const { |
---|
1588 | return strongStrategy_; |
---|
1589 | } |
---|
1590 | /// Set strong branching strategy |
---|
1591 | inline void setStrongStrategy(int value) { |
---|
1592 | strongStrategy_ = value; |
---|
1593 | } |
---|
1594 | |
---|
1595 | /// Get the number of cut generators |
---|
1596 | inline int numberCutGenerators() const { |
---|
1597 | return numberCutGenerators_; |
---|
1598 | } |
---|
1599 | /// Get the list of cut generators |
---|
1600 | inline CbcCutGenerator ** cutGenerators() const { |
---|
1601 | return generator_; |
---|
1602 | } |
---|
1603 | ///Get the specified cut generator |
---|
1604 | inline CbcCutGenerator * cutGenerator(int i) const { |
---|
1605 | return generator_[i]; |
---|
1606 | } |
---|
1607 | ///Get the specified cut generator before any changes |
---|
1608 | inline CbcCutGenerator * virginCutGenerator(int i) const { |
---|
1609 | return virginGenerator_[i]; |
---|
1610 | } |
---|
1611 | /** Add one generator - up to user to delete generators. |
---|
1612 | howoften affects how generator is used. 0 or 1 means always, |
---|
1613 | >1 means every that number of nodes. Negative values have same |
---|
1614 | meaning as positive but they may be switched off (-> -100) by code if |
---|
1615 | not many cuts generated at continuous. -99 is just done at root. |
---|
1616 | Name is just for printout. |
---|
1617 | If depth >0 overrides how often generator is called (if howOften==-1 or >0). |
---|
1618 | */ |
---|
1619 | void addCutGenerator(CglCutGenerator * generator, |
---|
1620 | int howOften = 1, const char * name = NULL, |
---|
1621 | bool normal = true, bool atSolution = false, |
---|
1622 | bool infeasible = false, int howOftenInSub = -100, |
---|
1623 | int whatDepth = -1, int whatDepthInSub = -1); |
---|
1624 | //@} |
---|
1625 | /** \name Strategy and sub models |
---|
1626 | |
---|
1627 | See the CbcStrategy class for additional information. |
---|
1628 | */ |
---|
1629 | //@{ |
---|
1630 | |
---|
1631 | /// Get the current strategy |
---|
1632 | inline CbcStrategy * strategy() const { |
---|
1633 | return strategy_; |
---|
1634 | } |
---|
1635 | /// Set the strategy. Clones |
---|
1636 | void setStrategy(CbcStrategy & strategy); |
---|
1637 | /// Set the strategy. assigns |
---|
1638 | inline void setStrategy(CbcStrategy * strategy) { |
---|
1639 | strategy_ = strategy; |
---|
1640 | } |
---|
1641 | /// Get the current parent model |
---|
1642 | inline CbcModel * parentModel() const { |
---|
1643 | return parentModel_; |
---|
1644 | } |
---|
1645 | /// Set the parent model |
---|
1646 | inline void setParentModel(CbcModel & parentModel) { |
---|
1647 | parentModel_ = &parentModel; |
---|
1648 | } |
---|
1649 | //@} |
---|
1650 | |
---|
1651 | |
---|
1652 | /** \name Heuristics and priorities */ |
---|
1653 | //@{ |
---|
1654 | /*! \brief Add one heuristic - up to user to delete |
---|
1655 | |
---|
1656 | The name is just used for print messages. |
---|
1657 | */ |
---|
1658 | void addHeuristic(CbcHeuristic * generator, const char *name = NULL, |
---|
1659 | int before = -1); |
---|
1660 | ///Get the specified heuristic |
---|
1661 | inline CbcHeuristic * heuristic(int i) const { |
---|
1662 | return heuristic_[i]; |
---|
1663 | } |
---|
1664 | /// Get the number of heuristics |
---|
1665 | inline int numberHeuristics() const { |
---|
1666 | return numberHeuristics_; |
---|
1667 | } |
---|
1668 | /// Set the number of heuristics |
---|
1669 | inline void setNumberHeuristics(int value) { |
---|
1670 | numberHeuristics_ = value; |
---|
1671 | } |
---|
1672 | /// Pointer to heuristic solver which found last solution (or NULL) |
---|
1673 | inline CbcHeuristic * lastHeuristic() const { |
---|
1674 | return lastHeuristic_; |
---|
1675 | } |
---|
1676 | /// set last heuristic which found a solution |
---|
1677 | inline void setLastHeuristic(CbcHeuristic * last) { |
---|
1678 | lastHeuristic_ = last; |
---|
1679 | } |
---|
1680 | |
---|
1681 | /** Pass in branching priorities. |
---|
1682 | |
---|
1683 | If ifClique then priorities are on cliques otherwise priorities are |
---|
1684 | on integer variables. |
---|
1685 | Other type (if exists set to default) |
---|
1686 | 1 is highest priority. (well actually -INT_MAX is but that's ugly) |
---|
1687 | If hotstart > 0 then branches are created to force |
---|
1688 | the variable to the value given by best solution. This enables a |
---|
1689 | sort of hot start. The node choice should be greatest depth |
---|
1690 | and hotstart should normally be switched off after a solution. |
---|
1691 | |
---|
1692 | If ifNotSimpleIntegers true then appended to normal integers |
---|
1693 | |
---|
1694 | This is now deprecated except for simple usage. If user |
---|
1695 | creates Cbcobjects then set priority in them |
---|
1696 | |
---|
1697 | \internal Added for Kurt Spielberg. |
---|
1698 | */ |
---|
1699 | void passInPriorities(const int * priorities, bool ifNotSimpleIntegers); |
---|
1700 | |
---|
1701 | /// Returns priority level for an object (or 1000 if no priorities exist) |
---|
1702 | inline int priority(int sequence) const { |
---|
1703 | return object_[sequence]->priority(); |
---|
1704 | } |
---|
1705 | |
---|
1706 | /*! \brief Set an event handler |
---|
1707 | |
---|
1708 | A clone of the handler passed as a parameter is stored in CbcModel. |
---|
1709 | */ |
---|
1710 | void passInEventHandler(const CbcEventHandler *eventHandler) ; |
---|
1711 | |
---|
1712 | /*! \brief Retrieve a pointer to the event handler */ |
---|
1713 | inline CbcEventHandler* getEventHandler() const { |
---|
1714 | return (eventHandler_) ; |
---|
1715 | } |
---|
1716 | |
---|
1717 | //@} |
---|
1718 | |
---|
1719 | /**@name Setting/Accessing application data */ |
---|
1720 | //@{ |
---|
1721 | /** Set application data. |
---|
1722 | |
---|
1723 | This is a pointer that the application can store into and |
---|
1724 | retrieve from the solver interface. |
---|
1725 | This field is available for the application to optionally |
---|
1726 | define and use. |
---|
1727 | */ |
---|
1728 | void setApplicationData (void * appData); |
---|
1729 | |
---|
1730 | /// Get application data |
---|
1731 | void * getApplicationData() const; |
---|
1732 | /** |
---|
1733 | For advanced applications you may wish to modify the behavior of Cbc |
---|
1734 | e.g. if the solver is a NLP solver then you may not have an exact |
---|
1735 | optimum solution at each step. Information could be built into |
---|
1736 | OsiSolverInterface but this is an alternative so that that interface |
---|
1737 | does not have to be changed. If something similar is useful to |
---|
1738 | enough solvers then it could be migrated |
---|
1739 | You can also pass in by using solver->setAuxiliaryInfo. |
---|
1740 | You should do that if solver is odd - if solver is normal simplex |
---|
1741 | then use this. |
---|
1742 | NOTE - characteristics are not cloned |
---|
1743 | */ |
---|
1744 | void passInSolverCharacteristics(OsiBabSolver * solverCharacteristics); |
---|
1745 | /// Get solver characteristics |
---|
1746 | inline const OsiBabSolver * solverCharacteristics() const { |
---|
1747 | return solverCharacteristics_; |
---|
1748 | } |
---|
1749 | //@} |
---|
1750 | |
---|
1751 | //--------------------------------------------------------------------------- |
---|
1752 | |
---|
1753 | /**@name Message handling etc */ |
---|
1754 | //@{ |
---|
1755 | /// Pass in Message handler (not deleted at end) |
---|
1756 | void passInMessageHandler(CoinMessageHandler * handler); |
---|
1757 | /// Set language |
---|
1758 | void newLanguage(CoinMessages::Language language); |
---|
1759 | inline void setLanguage(CoinMessages::Language language) { |
---|
1760 | newLanguage(language); |
---|
1761 | } |
---|
1762 | /// Return handler |
---|
1763 | inline CoinMessageHandler * messageHandler() const { |
---|
1764 | return handler_; |
---|
1765 | } |
---|
1766 | /// Return messages |
---|
1767 | inline CoinMessages & messages() { |
---|
1768 | return messages_; |
---|
1769 | } |
---|
1770 | /// Return pointer to messages |
---|
1771 | inline CoinMessages * messagesPointer() { |
---|
1772 | return &messages_; |
---|
1773 | } |
---|
1774 | /// Set log level |
---|
1775 | void setLogLevel(int value); |
---|
1776 | /// Get log level |
---|
1777 | inline int logLevel() const { |
---|
1778 | return handler_->logLevel(); |
---|
1779 | } |
---|
1780 | /** Set flag to say if handler_ is the default handler. |
---|
1781 | |
---|
1782 | The default handler is deleted when the model is deleted. Other |
---|
1783 | handlers (supplied by the client) will not be deleted. |
---|
1784 | */ |
---|
1785 | inline void setDefaultHandler(bool yesNo) { |
---|
1786 | defaultHandler_ = yesNo; |
---|
1787 | } |
---|
1788 | /// Check default handler |
---|
1789 | inline bool defaultHandler() const { |
---|
1790 | return defaultHandler_; |
---|
1791 | } |
---|
1792 | //@} |
---|
1793 | //--------------------------------------------------------------------------- |
---|
1794 | ///@name Specialized |
---|
1795 | //@{ |
---|
1796 | |
---|
1797 | /** |
---|
1798 | Set special options |
---|
1799 | 0 bit (1) - check if cuts valid (if on debugger list) |
---|
1800 | 1 bit (2) - use current basis to check integer solution (rather than all slack) |
---|
1801 | 2 bit (4) - don't check integer solution (by solving LP) |
---|
1802 | 3 bit (8) - fast analyze |
---|
1803 | 4 bit (16) - non-linear model - so no well defined CoinPackedMatrix |
---|
1804 | 5 bit (32) - keep names |
---|
1805 | 6 bit (64) - try for dominated columns |
---|
1806 | 7 bit (128) - SOS type 1 but all declared integer |
---|
1807 | 8 bit (256) - Set to say solution just found, unset by doing cuts |
---|
1808 | 9 bit (512) - Try reduced model after 100 nodes |
---|
1809 | 10 bit (1024) - Switch on some heuristics even if seems unlikely |
---|
1810 | 11 bit (2048) - Mark as in small branch and bound |
---|
1811 | 12 bit (4096) - Funny cuts so do slow way (in some places) |
---|
1812 | 13 bit (8192) - Funny cuts so do slow way (in other places) |
---|
1813 | 14 bit (16384) - Use Cplex! for fathoming |
---|
1814 | 15 bit (32768) - Try reduced model after 0 nodes |
---|
1815 | 16 bit (65536) - Original model had integer bounds |
---|
1816 | 17 bit (131072) - Perturbation switched off |
---|
1817 | 18 bit (262144) - donor CbcModel |
---|
1818 | 19 bit (524288) - recipient CbcModel |
---|
1819 | 20 bit (1048576) - waiting for sub model to return |
---|
1820 | 22 bit (4194304) - do not initialize random seed in solver (user has) |
---|
1821 | 23 bit (8388608) - leave solver_ with cuts |
---|
1822 | 24 bit (16777216) - just get feasible if no cutoff |
---|
1823 | 25 bit (33554432) - feasibility pump after root cuts |
---|
1824 | 26 bit (67108864) - child model but going for complete search |
---|
1825 | */ |
---|
1826 | inline void setSpecialOptions(int value) { |
---|
1827 | specialOptions_ = value; |
---|
1828 | } |
---|
1829 | /// Get special options |
---|
1830 | inline int specialOptions() const { |
---|
1831 | return specialOptions_; |
---|
1832 | } |
---|
1833 | /// Set random seed |
---|
1834 | inline void setRandomSeed(int value) { |
---|
1835 | randomSeed_ = value; |
---|
1836 | } |
---|
1837 | /// Get random seed |
---|
1838 | inline int getRandomSeed() const { |
---|
1839 | return randomSeed_; |
---|
1840 | } |
---|
1841 | /// Set multiple root tries |
---|
1842 | inline void setMultipleRootTries(int value) { |
---|
1843 | multipleRootTries_ = value; |
---|
1844 | } |
---|
1845 | /// Get multiple root tries |
---|
1846 | inline int getMultipleRootTries() const { |
---|
1847 | return multipleRootTries_; |
---|
1848 | } |
---|
1849 | /// Tell model to stop on event |
---|
1850 | inline void sayEventHappened() |
---|
1851 | { eventHappened_=true;} |
---|
1852 | /// Says if normal solver i.e. has well defined CoinPackedMatrix |
---|
1853 | inline bool normalSolver() const { |
---|
1854 | return (specialOptions_&16) == 0; |
---|
1855 | } |
---|
1856 | /** Says if model is sitting there waiting for mini branch and bound to finish |
---|
1857 | This is because an event handler may only have access to parent model in |
---|
1858 | mini branch and bound |
---|
1859 | */ |
---|
1860 | inline bool waitingForMiniBranchAndBound() const { |
---|
1861 | return (specialOptions_&1048576) != 0; |
---|
1862 | } |
---|
1863 | /** Set more special options |
---|
1864 | at present bottom 6 bits used for shadow price mode |
---|
1865 | 1024 for experimental hotstart |
---|
1866 | 2048,4096 breaking out of cuts |
---|
1867 | 8192 slowly increase minimum drop |
---|
1868 | 16384 gomory |
---|
1869 | 32768 more heuristics in sub trees |
---|
1870 | 65536 no cuts in preprocessing |
---|
1871 | 131072 Time limits elapsed |
---|
1872 | 18 bit (262144) - Perturb fathom nodes |
---|
1873 | 19 bit (524288) - No limit on fathom nodes |
---|
1874 | 20 bit (1048576) - Reduce sum of infeasibilities before cuts |
---|
1875 | 21 bit (2097152) - Reduce sum of infeasibilities after cuts |
---|
1876 | 22 bit (4194304) - Conflict analysis |
---|
1877 | 23 bit (8388608) - Conflict analysis - temporary bit |
---|
1878 | 24 bit (16777216) - Add cutoff as LP constraint (out) |
---|
1879 | 25 bit (33554432) - diving/reordering |
---|
1880 | 26 bit (67108864) - load global cuts from file |
---|
1881 | 27 bit (134217728) - append binding global cuts to file |
---|
1882 | 28 bit (268435456) - idiot branching |
---|
1883 | 29 bit (536870912) - don't make fake objective |
---|
1884 | 30 bit (1073741824) - Funny SOS or similar - be careful |
---|
1885 | */ |
---|
1886 | inline void setMoreSpecialOptions(int value) { |
---|
1887 | moreSpecialOptions_ = value; |
---|
1888 | } |
---|
1889 | /// Get more special options |
---|
1890 | inline int moreSpecialOptions() const { |
---|
1891 | return moreSpecialOptions_; |
---|
1892 | } |
---|
1893 | /** Set more more special options |
---|
1894 | 0 bit (1) - find switching variables |
---|
1895 | 1 bit (2) - using fake objective until solution |
---|
1896 | 2 bit (4) - switching variables exist |
---|
1897 | 3 bit (8) - skip most of setBestSolution checks |
---|
1898 | 4 bit (16) - very lightweight preprocessing in smallB&B |
---|
1899 | 5 bit (32) - event handler needs to be cloned when parallel |
---|
1900 | 6 bit (64) - testing - use probing to make cliques |
---|
1901 | 7/8 bit (128) - try orbital branching (if nauty) |
---|
1902 | 9 bit (512) - branching on objective (later) |
---|
1903 | 10 bit (1024) - branching on constraints (later) |
---|
1904 | 11/12 bit 2048 - intermittent cuts |
---|
1905 | 13/14 bit 8192 - go to bitter end in strong branching (first time) |
---|
1906 | 15 bit 32768 - take care of very very small values for Integer/SOS variables |
---|
1907 | */ |
---|
1908 | inline void setMoreSpecialOptions2(int value) { |
---|
1909 | moreSpecialOptions2_ = value; |
---|
1910 | } |
---|
1911 | /// Get more special options2 |
---|
1912 | inline int moreSpecialOptions2() const { |
---|
1913 | return moreSpecialOptions2_; |
---|
1914 | } |
---|
1915 | /// Set cutoff as constraint |
---|
1916 | inline void setCutoffAsConstraint(bool yesNo) { |
---|
1917 | cutoffRowNumber_ = (yesNo) ? -2 : -1; |
---|
1918 | } |
---|
1919 | /// Set time method |
---|
1920 | inline void setUseElapsedTime(bool yesNo) { |
---|
1921 | if (yesNo) |
---|
1922 | moreSpecialOptions_ |= 131072; |
---|
1923 | else |
---|
1924 | moreSpecialOptions_ &= ~131072; |
---|
1925 | } |
---|
1926 | /// Get time method |
---|
1927 | inline bool useElapsedTime() const { |
---|
1928 | return (moreSpecialOptions_&131072)!=0; |
---|
1929 | } |
---|
1930 | /// Get useful temporary pointer |
---|
1931 | inline void * temporaryPointer() const |
---|
1932 | { return temporaryPointer_;} |
---|
1933 | /// Set useful temporary pointer |
---|
1934 | inline void setTemporaryPointer(void * pointer) |
---|
1935 | { temporaryPointer_=pointer;} |
---|
1936 | /// Go to dantzig pivot selection if easy problem (clp only) |
---|
1937 | void goToDantzig(int numberNodes, ClpDualRowPivot *& savePivotMethod); |
---|
1938 | /// Now we may not own objects - just point to solver's objects |
---|
1939 | inline bool ownObjects() const { |
---|
1940 | return ownObjects_; |
---|
1941 | } |
---|
1942 | /// Check original model before it gets messed up |
---|
1943 | void checkModel(); |
---|
1944 | //@} |
---|
1945 | //--------------------------------------------------------------------------- |
---|
1946 | |
---|
1947 | ///@name Constructors and destructors etc |
---|
1948 | //@{ |
---|
1949 | /// Default Constructor |
---|
1950 | CbcModel(); |
---|
1951 | |
---|
1952 | /// Constructor from solver |
---|
1953 | CbcModel(const OsiSolverInterface &); |
---|
1954 | |
---|
1955 | /** Assign a solver to the model (model assumes ownership) |
---|
1956 | |
---|
1957 | On return, \p solver will be NULL. |
---|
1958 | If deleteSolver then current solver deleted (if model owned) |
---|
1959 | |
---|
1960 | \note Parameter settings in the outgoing solver are not inherited by |
---|
1961 | the incoming solver. |
---|
1962 | */ |
---|
1963 | void assignSolver(OsiSolverInterface *&solver, bool deleteSolver = true); |
---|
1964 | |
---|
1965 | /** \brief Set ownership of solver |
---|
1966 | |
---|
1967 | A parameter of false tells CbcModel it does not own the solver and |
---|
1968 | should not delete it. Once you claim ownership of the solver, you're |
---|
1969 | responsible for eventually deleting it. Note that CbcModel clones |
---|
1970 | solvers with abandon. Unless you have a deep understanding of the |
---|
1971 | workings of CbcModel, the only time you want to claim ownership is when |
---|
1972 | you're about to delete the CbcModel object but want the solver to |
---|
1973 | continue to exist (as, for example, when branchAndBound has finished |
---|
1974 | and you want to hang on to the answer). |
---|
1975 | */ |
---|
1976 | inline void setModelOwnsSolver (bool ourSolver) { |
---|
1977 | ownership_ = ourSolver ? (ownership_ | 0x80000000) : (ownership_ & (~0x80000000)) ; |
---|
1978 | } |
---|
1979 | |
---|
1980 | /*! \brief Get ownership of solver |
---|
1981 | |
---|
1982 | A return value of true means that CbcModel owns the solver and will |
---|
1983 | take responsibility for deleting it when that becomes necessary. |
---|
1984 | */ |
---|
1985 | inline bool modelOwnsSolver () { |
---|
1986 | return ((ownership_&0x80000000) != 0) ; |
---|
1987 | } |
---|
1988 | |
---|
1989 | /** Copy constructor . |
---|
1990 | If cloneHandler is true then message handler is cloned |
---|
1991 | */ |
---|
1992 | CbcModel(const CbcModel & rhs, bool cloneHandler = false); |
---|
1993 | |
---|
1994 | /** Clone */ |
---|
1995 | virtual CbcModel *clone (bool cloneHandler); |
---|
1996 | |
---|
1997 | /// Assignment operator |
---|
1998 | CbcModel & operator=(const CbcModel& rhs); |
---|
1999 | |
---|
2000 | /// Destructor |
---|
2001 | virtual ~CbcModel (); |
---|
2002 | |
---|
2003 | /// Returns solver - has current state |
---|
2004 | inline OsiSolverInterface * solver() const { |
---|
2005 | return solver_; |
---|
2006 | } |
---|
2007 | |
---|
2008 | /// Returns current solver - sets new one |
---|
2009 | inline OsiSolverInterface * swapSolver(OsiSolverInterface * solver) { |
---|
2010 | OsiSolverInterface * returnSolver = solver_; |
---|
2011 | solver_ = solver; |
---|
2012 | return returnSolver; |
---|
2013 | } |
---|
2014 | |
---|
2015 | /// Returns solver with continuous state |
---|
2016 | inline OsiSolverInterface * continuousSolver() const { |
---|
2017 | return continuousSolver_; |
---|
2018 | } |
---|
2019 | |
---|
2020 | /// Create solver with continuous state |
---|
2021 | inline void createContinuousSolver() { |
---|
2022 | continuousSolver_ = solver_->clone(); |
---|
2023 | } |
---|
2024 | /// Clear solver with continuous state |
---|
2025 | inline void clearContinuousSolver() { |
---|
2026 | delete continuousSolver_; |
---|
2027 | continuousSolver_ = NULL; |
---|
2028 | } |
---|
2029 | |
---|
2030 | /// A copy of the solver, taken at constructor or by saveReferenceSolver |
---|
2031 | inline OsiSolverInterface * referenceSolver() const { |
---|
2032 | return referenceSolver_; |
---|
2033 | } |
---|
2034 | |
---|
2035 | /// Save a copy of the current solver so can be reset to |
---|
2036 | void saveReferenceSolver(); |
---|
2037 | |
---|
2038 | /** Uses a copy of reference solver to be current solver. |
---|
2039 | Because of possible mismatches all exotic integer information is loat |
---|
2040 | (apart from normal information in OsiSolverInterface) |
---|
2041 | so SOS etc and priorities will have to be redone |
---|
2042 | */ |
---|
2043 | void resetToReferenceSolver(); |
---|
2044 | |
---|
2045 | /// Clears out as much as possible (except solver) |
---|
2046 | void gutsOfDestructor(); |
---|
2047 | /** Clears out enough to reset CbcModel as if no branch and bound done |
---|
2048 | */ |
---|
2049 | void gutsOfDestructor2(); |
---|
2050 | /** Clears out enough to reset CbcModel cutoff etc |
---|
2051 | */ |
---|
2052 | void resetModel(); |
---|
2053 | /** Most of copy constructor |
---|
2054 | mode - 0 copy but don't delete before |
---|
2055 | 1 copy and delete before |
---|
2056 | 2 copy and delete before (but use virgin generators) |
---|
2057 | */ |
---|
2058 | void gutsOfCopy(const CbcModel & rhs, int mode = 0); |
---|
2059 | /// Move status, nodes etc etc across |
---|
2060 | void moveInfo(const CbcModel & rhs); |
---|
2061 | //@} |
---|
2062 | |
---|
2063 | ///@name Multithreading |
---|
2064 | //@{ |
---|
2065 | /// Indicates whether Cbc library has been compiled with multithreading support |
---|
2066 | static bool haveMultiThreadSupport(); |
---|
2067 | /// Get pointer to masterthread |
---|
2068 | CbcThread * masterThread() const { |
---|
2069 | return masterThread_; |
---|
2070 | } |
---|
2071 | /// Get pointer to walkback |
---|
2072 | CbcNodeInfo ** walkback() const { |
---|
2073 | return walkback_; |
---|
2074 | } |
---|
2075 | /// Get number of threads |
---|
2076 | inline int getNumberThreads() const { |
---|
2077 | return numberThreads_; |
---|
2078 | } |
---|
2079 | /// Set number of threads |
---|
2080 | inline void setNumberThreads(int value) { |
---|
2081 | numberThreads_ = value; |
---|
2082 | } |
---|
2083 | /// Get thread mode |
---|
2084 | inline int getThreadMode() const { |
---|
2085 | return threadMode_; |
---|
2086 | } |
---|
2087 | /** Set thread mode |
---|
2088 | always use numberThreads for branching |
---|
2089 | 1 set then deterministic |
---|
2090 | 2 set then use numberThreads for root cuts |
---|
2091 | 4 set then use numberThreads in root mini branch and bound |
---|
2092 | 8 set and numberThreads - do heuristics numberThreads at a time |
---|
2093 | 8 set and numberThreads==0 do all heuristics at once |
---|
2094 | default is 0 |
---|
2095 | */ |
---|
2096 | inline void setThreadMode(int value) { |
---|
2097 | threadMode_ = value; |
---|
2098 | } |
---|
2099 | /** Return |
---|
2100 | -2 if deterministic threaded and main thread |
---|
2101 | -1 if deterministic threaded and serial thread |
---|
2102 | 0 if serial |
---|
2103 | 1 if opportunistic threaded |
---|
2104 | */ |
---|
2105 | inline int parallelMode() const { |
---|
2106 | if (!numberThreads_) { |
---|
2107 | if ((threadMode_&1) == 0) |
---|
2108 | return 0; |
---|
2109 | else |
---|
2110 | return -1; |
---|
2111 | return 0; |
---|
2112 | } else { |
---|
2113 | if ((threadMode_&1) == 0) |
---|
2114 | return 1; |
---|
2115 | else |
---|
2116 | return -2; |
---|
2117 | } |
---|
2118 | } |
---|
2119 | /// Thread stuff for master |
---|
2120 | inline CbcBaseModel * master() const |
---|
2121 | { return master_;} |
---|
2122 | /// From here to end of section - code in CbcThread.cpp until class changed |
---|
2123 | /// Returns true if locked |
---|
2124 | bool isLocked() const; |
---|
2125 | #ifdef CBC_THREAD |
---|
2126 | /** |
---|
2127 | Locks a thread if parallel so that stuff like cut pool |
---|
2128 | can be updated and/or used. |
---|
2129 | */ |
---|
2130 | void lockThread(); |
---|
2131 | /** |
---|
2132 | Unlocks a thread if parallel to say cut pool stuff not needed |
---|
2133 | */ |
---|
2134 | void unlockThread(); |
---|
2135 | #else |
---|
2136 | inline void lockThread() {} |
---|
2137 | inline void unlockThread() {} |
---|
2138 | #endif |
---|
2139 | /** Set information in a child |
---|
2140 | -3 pass pointer to child thread info |
---|
2141 | -2 just stop |
---|
2142 | -1 delete simple child stuff |
---|
2143 | 0 delete opportunistic child stuff |
---|
2144 | 1 delete deterministic child stuff |
---|
2145 | */ |
---|
2146 | void setInfoInChild(int type, CbcThread * info); |
---|
2147 | /** Move/copy information from one model to another |
---|
2148 | -1 - initialization |
---|
2149 | 0 - from base model |
---|
2150 | 1 - to base model (and reset) |
---|
2151 | 2 - add in final statistics etc (and reset so can do clean destruction) |
---|
2152 | */ |
---|
2153 | void moveToModel(CbcModel * baseModel, int mode); |
---|
2154 | /// Split up nodes |
---|
2155 | int splitModel(int numberModels, CbcModel ** model, |
---|
2156 | int numberNodes); |
---|
2157 | /// Start threads |
---|
2158 | void startSplitModel(int numberIterations); |
---|
2159 | /// Merge models |
---|
2160 | void mergeModels(int numberModel, CbcModel ** model, |
---|
2161 | int numberNodes); |
---|
2162 | //@} |
---|
2163 | |
---|
2164 | ///@name semi-private i.e. users should not use |
---|
2165 | //@{ |
---|
2166 | /// Get how many Nodes it took to solve the problem. |
---|
2167 | int getNodeCount2() const { |
---|
2168 | return numberNodes2_; |
---|
2169 | } |
---|
2170 | /// Set pointers for speed |
---|
2171 | void setPointers(const OsiSolverInterface * solver); |
---|
2172 | /** Perform reduced cost fixing |
---|
2173 | |
---|
2174 | Fixes integer variables at their current value based on reduced cost |
---|
2175 | penalties. Returns number fixed |
---|
2176 | */ |
---|
2177 | int reducedCostFix() ; |
---|
2178 | /** Makes all handlers same. If makeDefault 1 then makes top level |
---|
2179 | default and rest point to that. If 2 then each is copy |
---|
2180 | */ |
---|
2181 | void synchronizeHandlers(int makeDefault); |
---|
2182 | /// Save a solution to saved list |
---|
2183 | void saveExtraSolution(const double * solution, double objectiveValue); |
---|
2184 | /// Save a solution to best and move current to saved |
---|
2185 | void saveBestSolution(const double * solution, double objectiveValue); |
---|
2186 | /// Delete best and saved solutions |
---|
2187 | void deleteSolutions(); |
---|
2188 | /// Encapsulates solver resolve |
---|
2189 | int resolve(OsiSolverInterface * solver); |
---|
2190 | #ifdef CLP_RESOLVE |
---|
2191 | /// Special purpose resolve |
---|
2192 | int resolveClp(OsiClpSolverInterface * solver, int type); |
---|
2193 | #endif |
---|
2194 | |
---|
2195 | /** Encapsulates choosing a variable - |
---|
2196 | anyAction -2, infeasible (-1 round again), 0 done |
---|
2197 | */ |
---|
2198 | int chooseBranch(CbcNode * & newNode, int numberPassesLeft, |
---|
2199 | CbcNode * oldNode, OsiCuts & cuts, |
---|
2200 | bool & resolved, CoinWarmStartBasis *lastws, |
---|
2201 | const double * lowerBefore, const double * upperBefore, |
---|
2202 | OsiSolverBranch * & branches); |
---|
2203 | int chooseBranch(CbcNode * newNode, int numberPassesLeft, bool & resolved); |
---|
2204 | |
---|
2205 | /** Return an empty basis object of the specified size |
---|
2206 | |
---|
2207 | A useful utility when constructing a basis for a subproblem from scratch. |
---|
2208 | The object returned will be of the requested capacity and appropriate for |
---|
2209 | the solver attached to the model. |
---|
2210 | */ |
---|
2211 | CoinWarmStartBasis *getEmptyBasis(int ns = 0, int na = 0) const ; |
---|
2212 | |
---|
2213 | /** Remove inactive cuts from the model |
---|
2214 | |
---|
2215 | An OsiSolverInterface is expected to maintain a valid basis, but not a |
---|
2216 | valid solution, when loose cuts are deleted. Restoring a valid solution |
---|
2217 | requires calling the solver to reoptimise. If it's certain the solution |
---|
2218 | will not be required, set allowResolve to false to suppress |
---|
2219 | reoptimisation. |
---|
2220 | If saveCuts then slack cuts will be saved |
---|
2221 | On input current cuts are cuts and newCuts |
---|
2222 | on exit current cuts will be correct. Returns number dropped |
---|
2223 | */ |
---|
2224 | int takeOffCuts(OsiCuts &cuts, |
---|
2225 | bool allowResolve, OsiCuts * saveCuts, |
---|
2226 | int numberNewCuts = 0, const OsiRowCut ** newCuts = NULL) ; |
---|
2227 | |
---|
2228 | /** Determine and install the active cuts that need to be added for |
---|
2229 | the current subproblem |
---|
2230 | |
---|
2231 | The whole truth is a bit more complicated. The first action is a call to |
---|
2232 | addCuts1(). addCuts() then sorts through the list, installs the tight |
---|
2233 | cuts in the model, and does bookkeeping (adjusts reference counts). |
---|
2234 | The basis returned from addCuts1() is adjusted accordingly. |
---|
2235 | |
---|
2236 | If it turns out that the node should really be fathomed by bound, |
---|
2237 | addCuts() simply treats all the cuts as loose as it does the bookkeeping. |
---|
2238 | |
---|
2239 | */ |
---|
2240 | int addCuts(CbcNode * node, CoinWarmStartBasis *&lastws); |
---|
2241 | |
---|
2242 | /** Traverse the tree from node to root and prep the model |
---|
2243 | |
---|
2244 | addCuts1() begins the job of prepping the model to match the current |
---|
2245 | subproblem. The model is stripped of all cuts, and the search tree is |
---|
2246 | traversed from node to root to determine the changes required. Appropriate |
---|
2247 | bounds changes are installed, a list of cuts is collected but not |
---|
2248 | installed, and an appropriate basis (minus the cuts, but big enough to |
---|
2249 | accommodate them) is constructed. |
---|
2250 | |
---|
2251 | Returns true if new problem similar to old |
---|
2252 | |
---|
2253 | \todo addCuts1() is called in contexts where it's known in advance that |
---|
2254 | all that's desired is to determine a list of cuts and do the |
---|
2255 | bookkeeping (adjust the reference counts). The work of installing |
---|
2256 | bounds and building a basis goes to waste. |
---|
2257 | */ |
---|
2258 | bool addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws); |
---|
2259 | /** Returns bounds just before where - initially original bounds. |
---|
2260 | Also sets downstream nodes (lower if force 1, upper if 2) |
---|
2261 | */ |
---|
2262 | void previousBounds (CbcNode * node, CbcNodeInfo * where, int iColumn, |
---|
2263 | double & lower, double & upper, int force); |
---|
2264 | /** Set objective value in a node. This is separated out so that |
---|
2265 | odd solvers can use. It may look at extra information in |
---|
2266 | solverCharacteriscs_ and will also use bound from parent node |
---|
2267 | */ |
---|
2268 | void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const; |
---|
2269 | |
---|
2270 | /** If numberBeforeTrust >0 then we are going to use CbcBranchDynamic. |
---|
2271 | Scan and convert CbcSimpleInteger objects |
---|
2272 | */ |
---|
2273 | void convertToDynamic(); |
---|
2274 | /// Set numberBeforeTrust in all objects |
---|
2275 | void synchronizeNumberBeforeTrust(int type = 0); |
---|
2276 | /// Zap integer information in problem (may leave object info) |
---|
2277 | void zapIntegerInformation(bool leaveObjects = true); |
---|
2278 | /// Use cliques for pseudocost information - return nonzero if infeasible |
---|
2279 | int cliquePseudoCosts(int doStatistics); |
---|
2280 | /// Fill in useful estimates |
---|
2281 | void pseudoShadow(int type); |
---|
2282 | /** Return pseudo costs |
---|
2283 | If not all integers or not pseudo costs - returns all zero |
---|
2284 | Length of arrays are numberIntegers() and entries |
---|
2285 | correspond to integerVariable()[i] |
---|
2286 | User must allocate arrays before call |
---|
2287 | */ |
---|
2288 | void fillPseudoCosts(double * downCosts, double * upCosts, |
---|
2289 | int * priority = NULL, |
---|
2290 | int * numberDown = NULL, int * numberUp = NULL, |
---|
2291 | int * numberDownInfeasible = NULL, |
---|
2292 | int * numberUpInfeasible = NULL) const; |
---|
2293 | /** Do heuristics at root. |
---|
2294 | 0 - don't delete |
---|
2295 | 1 - delete |
---|
2296 | 2 - just delete - don't even use |
---|
2297 | */ |
---|
2298 | void doHeuristicsAtRoot(int deleteHeuristicsAfterwards = 0); |
---|
2299 | /// Adjust heuristics based on model |
---|
2300 | void adjustHeuristics(); |
---|
2301 | /// Get the hotstart solution |
---|
2302 | inline const double * hotstartSolution() const { |
---|
2303 | return hotstartSolution_; |
---|
2304 | } |
---|
2305 | /// Get the hotstart priorities |
---|
2306 | inline const int * hotstartPriorities() const { |
---|
2307 | return hotstartPriorities_; |
---|
2308 | } |
---|
2309 | |
---|
2310 | /// Return the list of cuts initially collected for this subproblem |
---|
2311 | inline CbcCountRowCut ** addedCuts() const { |
---|
2312 | return addedCuts_; |
---|
2313 | } |
---|
2314 | /// Number of entries in the list returned by #addedCuts() |
---|
2315 | inline int currentNumberCuts() const { |
---|
2316 | return currentNumberCuts_; |
---|
2317 | } |
---|
2318 | /// Global cuts |
---|
2319 | inline CbcRowCuts * globalCuts() { |
---|
2320 | return &globalCuts_; |
---|
2321 | } |
---|
2322 | /// Get rid of global cuts |
---|
2323 | inline void zapGlobalCuts() { |
---|
2324 | globalCuts_ = CbcRowCuts(); |
---|
2325 | } |
---|
2326 | /// Copy and set a pointer to a row cut which will be added instead of normal branching. |
---|
2327 | void setNextRowCut(const OsiRowCut & cut); |
---|
2328 | /// Get a pointer to current node (be careful) |
---|
2329 | inline CbcNode * currentNode() const { |
---|
2330 | return currentNode_; |
---|
2331 | } |
---|
2332 | /// Get a pointer to probing info |
---|
2333 | inline CglTreeProbingInfo * probingInfo() const { |
---|
2334 | return probingInfo_; |
---|
2335 | } |
---|
2336 | /// Thread specific random number generator |
---|
2337 | inline CoinThreadRandom * randomNumberGenerator() { |
---|
2338 | return &randomNumberGenerator_; |
---|
2339 | } |
---|
2340 | /// Set the number of iterations done in strong branching. |
---|
2341 | inline void setNumberStrongIterations(int number) { |
---|
2342 | numberStrongIterations_ = number; |
---|
2343 | } |
---|
2344 | /// Get the number of iterations done in strong branching. |
---|
2345 | inline int numberStrongIterations() const { |
---|
2346 | return numberStrongIterations_; |
---|
2347 | } |
---|
2348 | /// Get maximum number of iterations (designed to be used in heuristics) |
---|
2349 | inline int maximumNumberIterations() const { |
---|
2350 | return maximumNumberIterations_; |
---|
2351 | } |
---|
2352 | /// Set maximum number of iterations (designed to be used in heuristics) |
---|
2353 | inline void setMaximumNumberIterations(int value) { |
---|
2354 | maximumNumberIterations_ = value; |
---|
2355 | } |
---|
2356 | #ifdef COIN_HAS_NTY |
---|
2357 | /// Symmetry information |
---|
2358 | inline CbcSymmetry * symmetryInfo() const |
---|
2359 | { return symmetryInfo_;} |
---|
2360 | /// get rid of all |
---|
2361 | void zapSymmetry(); |
---|
2362 | #endif |
---|
2363 | /// Set depth for fast nodes |
---|
2364 | inline void setFastNodeDepth(int value) { |
---|
2365 | fastNodeDepth_ = value; |
---|
2366 | } |
---|
2367 | /// Get depth for fast nodes |
---|
2368 | inline int fastNodeDepth() const { |
---|
2369 | return fastNodeDepth_; |
---|
2370 | } |
---|
2371 | /// Get anything with priority >= this can be treated as continuous |
---|
2372 | inline int continuousPriority() const { |
---|
2373 | return continuousPriority_; |
---|
2374 | } |
---|
2375 | /// Set anything with priority >= this can be treated as continuous |
---|
2376 | inline void setContinuousPriority(int value) { |
---|
2377 | continuousPriority_ = value; |
---|
2378 | } |
---|
2379 | inline void incrementExtra(int nodes, int iterations, int fathoms=1) { |
---|
2380 | numberExtraNodes_ += nodes; |
---|
2381 | numberExtraIterations_ += iterations; |
---|
2382 | numberFathoms_ += fathoms; |
---|
2383 | } |
---|
2384 | /// Zero extra |
---|
2385 | inline void zeroExtra() { |
---|
2386 | numberExtraNodes_ = 0; |
---|
2387 | numberExtraIterations_ = 0; |
---|
2388 | numberFathoms_ = 0; |
---|
2389 | } |
---|
2390 | /// Number of extra iterations |
---|
2391 | inline int numberExtraIterations() const { |
---|
2392 | return numberExtraIterations_; |
---|
2393 | } |
---|
2394 | /// Increment strong info |
---|
2395 | void incrementStrongInfo(int numberTimes, int numberIterations, |
---|
2396 | int numberFixed, bool ifInfeasible); |
---|
2397 | /// Return strong info |
---|
2398 | inline const int * strongInfo() const { |
---|
2399 | return strongInfo_; |
---|
2400 | } |
---|
2401 | |
---|
2402 | /// Return mutable strong info |
---|
2403 | inline int * mutableStrongInfo() { |
---|
2404 | return strongInfo_; |
---|
2405 | } |
---|
2406 | /// Get stored row cuts for donor/recipient CbcModel |
---|
2407 | CglStored * storedRowCuts() const { |
---|
2408 | return storedRowCuts_; |
---|
2409 | } |
---|
2410 | /// Set stored row cuts for donor/recipient CbcModel |
---|
2411 | void setStoredRowCuts(CglStored * cuts) { |
---|
2412 | storedRowCuts_ = cuts; |
---|
2413 | } |
---|
2414 | /// Says whether all dynamic integers |
---|
2415 | inline bool allDynamic () const { |
---|
2416 | return ((ownership_&0x40000000) != 0) ; |
---|
2417 | } |
---|
2418 | /// Create C++ lines to get to current state |
---|
2419 | void generateCpp( FILE * fp, int options); |
---|
2420 | /// Generate an OsiBranchingInformation object |
---|
2421 | OsiBranchingInformation usefulInformation() const; |
---|
2422 | /** Warm start object produced by heuristic or strong branching |
---|
2423 | |
---|
2424 | If get a valid integer solution outside branch and bound then it can take |
---|
2425 | a reasonable time to solve LP which produces clean solution. If this object has |
---|
2426 | any size then it will be used in solve. |
---|
2427 | */ |
---|
2428 | inline void setBestSolutionBasis(const CoinWarmStartBasis & bestSolutionBasis) { |
---|
2429 | bestSolutionBasis_ = bestSolutionBasis; |
---|
2430 | } |
---|
2431 | /// Redo walkback arrays |
---|
2432 | void redoWalkBack(); |
---|
2433 | //@} |
---|
2434 | |
---|
2435 | void setMIPStart( const std::vector< std::pair< std::string, double > > &mips ) { |
---|
2436 | this->mipStart_ = mips; |
---|
2437 | } |
---|
2438 | |
---|
2439 | /** may be safer to use this overload method: c++ string libraries |
---|
2440 | * implementation may not be binary compatible */ |
---|
2441 | void setMIPStart( int count, const char **colNames, const double colValues[] ); |
---|
2442 | |
---|
2443 | const std::vector< std::pair< std::string, double > > &getMIPStart() { |
---|
2444 | return this->mipStart_; |
---|
2445 | } |
---|
2446 | |
---|
2447 | |
---|
2448 | //--------------------------------------------------------------------------- |
---|
2449 | |
---|
2450 | private: |
---|
2451 | ///@name Private member data |
---|
2452 | //@{ |
---|
2453 | |
---|
2454 | /// The solver associated with this model. |
---|
2455 | OsiSolverInterface * solver_; |
---|
2456 | |
---|
2457 | /** Ownership of objects and other stuff |
---|
2458 | |
---|
2459 | 0x80000000 model owns solver |
---|
2460 | 0x40000000 all variables CbcDynamicPseudoCost |
---|
2461 | */ |
---|
2462 | unsigned int ownership_ ; |
---|
2463 | |
---|
2464 | /// A copy of the solver, taken at the continuous (root) node. |
---|
2465 | OsiSolverInterface * continuousSolver_; |
---|
2466 | |
---|
2467 | /// A copy of the solver, taken at constructor or by saveReferenceSolver |
---|
2468 | OsiSolverInterface * referenceSolver_; |
---|
2469 | |
---|
2470 | /// Message handler |
---|
2471 | CoinMessageHandler * handler_; |
---|
2472 | |
---|
2473 | /** Flag to say if handler_ is the default handler. |
---|
2474 | |
---|
2475 | The default handler is deleted when the model is deleted. Other |
---|
2476 | handlers (supplied by the client) will not be deleted. |
---|
2477 | */ |
---|
2478 | bool defaultHandler_; |
---|
2479 | |
---|
2480 | /// Cbc messages |
---|
2481 | CoinMessages messages_; |
---|
2482 | |
---|
2483 | /// Array for integer parameters |
---|
2484 | int intParam_[CbcLastIntParam]; |
---|
2485 | |
---|
2486 | /// Array for double parameters |
---|
2487 | double dblParam_[CbcLastDblParam]; |
---|
2488 | |
---|
2489 | /** Pointer to an empty warm start object |
---|
2490 | |
---|
2491 | It turns out to be useful to have this available as a base from |
---|
2492 | which to build custom warm start objects. This is typed as CoinWarmStart |
---|
2493 | rather than CoinWarmStartBasis to allow for the possibility that a |
---|
2494 | client might want to apply a solver that doesn't use a basis-based warm |
---|
2495 | start. See getEmptyBasis for an example of how this field can be used. |
---|
2496 | */ |
---|
2497 | mutable CoinWarmStart *emptyWarmStart_ ; |
---|
2498 | |
---|
2499 | /// Best objective |
---|
2500 | double bestObjective_; |
---|
2501 | /// Best possible objective |
---|
2502 | double bestPossibleObjective_; |
---|
2503 | /// Sum of Changes to objective by first solve |
---|
2504 | double sumChangeObjective1_; |
---|
2505 | /// Sum of Changes to objective by subsequent solves |
---|
2506 | double sumChangeObjective2_; |
---|
2507 | |
---|
2508 | /// Array holding the incumbent (best) solution. |
---|
2509 | double * bestSolution_; |
---|
2510 | /// Arrays holding other solutions. |
---|
2511 | double ** savedSolutions_; |
---|
2512 | |
---|
2513 | /** Array holding the current solution. |
---|
2514 | |
---|
2515 | This array is used more as a temporary. |
---|
2516 | */ |
---|
2517 | double * currentSolution_; |
---|
2518 | /** For testing infeasibilities - will point to |
---|
2519 | currentSolution_ or solver-->getColSolution() |
---|
2520 | */ |
---|
2521 | mutable const double * testSolution_; |
---|
2522 | /** MIPstart values |
---|
2523 | values for integer variables which will be converted to a complete integer initial feasible solution |
---|
2524 | */ |
---|
2525 | std::vector< std::pair< std::string, double > > mipStart_; |
---|
2526 | /** Warm start object produced by heuristic or strong branching |
---|
2527 | |
---|
2528 | If get a valid integer solution outside branch and bound then it can take |
---|
2529 | a reasonable time to solve LP which produces clean solution. If this object has |
---|
2530 | any size then it will be used in solve. |
---|
2531 | */ |
---|
2532 | CoinWarmStartBasis bestSolutionBasis_ ; |
---|
2533 | /// Global cuts |
---|
2534 | CbcRowCuts globalCuts_; |
---|
2535 | /// Global conflict cuts |
---|
2536 | CbcRowCuts * globalConflictCuts_; |
---|
2537 | |
---|
2538 | /// Minimum degradation in objective value to continue cut generation |
---|
2539 | double minimumDrop_; |
---|
2540 | /// Number of solutions |
---|
2541 | int numberSolutions_; |
---|
2542 | /// Number of saved solutions |
---|
2543 | int numberSavedSolutions_; |
---|
2544 | /// Maximum number of saved solutions |
---|
2545 | int maximumSavedSolutions_; |
---|
2546 | /** State of search |
---|
2547 | 0 - no solution |
---|
2548 | 1 - only heuristic solutions |
---|
2549 | 2 - branched to a solution |
---|
2550 | 3 - no solution but many nodes |
---|
2551 | */ |
---|
2552 | int stateOfSearch_; |
---|
2553 | /// At which depths to do cuts |
---|
2554 | int whenCuts_; |
---|
2555 | /// Hotstart solution |
---|
2556 | double * hotstartSolution_; |
---|
2557 | /// Hotstart priorities |
---|
2558 | int * hotstartPriorities_; |
---|
2559 | /// Number of heuristic solutions |
---|
2560 | int numberHeuristicSolutions_; |
---|
2561 | /// Cumulative number of nodes |
---|
2562 | int numberNodes_; |
---|
2563 | /** Cumulative number of nodes for statistics. |
---|
2564 | Must fix to match up |
---|
2565 | */ |
---|
2566 | int numberNodes2_; |
---|
2567 | /// Cumulative number of iterations |
---|
2568 | int numberIterations_; |
---|
2569 | /// Cumulative number of solves |
---|
2570 | int numberSolves_; |
---|
2571 | /// Status of problem - 0 finished, 1 stopped, 2 difficulties |
---|
2572 | int status_; |
---|
2573 | /** Secondary status of problem |
---|
2574 | -1 unset (status_ will also be -1) |
---|
2575 | 0 search completed with solution |
---|
2576 | 1 linear relaxation not feasible (or worse than cutoff) |
---|
2577 | 2 stopped on gap |
---|
2578 | 3 stopped on nodes |
---|
2579 | 4 stopped on time |
---|
2580 | 5 stopped on user event |
---|
2581 | 6 stopped on solutions |
---|
2582 | */ |
---|
2583 | int secondaryStatus_; |
---|
2584 | /// Number of integers in problem |
---|
2585 | int numberIntegers_; |
---|
2586 | /// Number of rows at continuous |
---|
2587 | int numberRowsAtContinuous_; |
---|
2588 | /** |
---|
2589 | -1 - cutoff as constraint not activated |
---|
2590 | -2 - waiting to activate |
---|
2591 | >=0 - activated |
---|
2592 | */ |
---|
2593 | int cutoffRowNumber_; |
---|
2594 | /// Maximum number of cuts |
---|
2595 | int maximumNumberCuts_; |
---|
2596 | /** Current phase (so heuristics etc etc can find out). |
---|
2597 | 0 - initial solve |
---|
2598 | 1 - solve with cuts at root |
---|
2599 | 2 - solve with cuts |
---|
2600 | 3 - other e.g. strong branching |
---|
2601 | 4 - trying to validate a solution |
---|
2602 | 5 - at end of search |
---|
2603 | */ |
---|
2604 | int phase_; |
---|
2605 | |
---|
2606 | /// Number of entries in #addedCuts_ |
---|
2607 | int currentNumberCuts_; |
---|
2608 | |
---|
2609 | /** Current limit on search tree depth |
---|
2610 | |
---|
2611 | The allocated size of #walkback_. Increased as needed. |
---|
2612 | */ |
---|
2613 | int maximumDepth_; |
---|
2614 | /** Array used to assemble the path between a node and the search tree root |
---|
2615 | |
---|
2616 | The array is resized when necessary. #maximumDepth_ is the current |
---|
2617 | allocated size. |
---|
2618 | */ |
---|
2619 | CbcNodeInfo ** walkback_; |
---|
2620 | /// preProcess used before branch and bound (optional) |
---|
2621 | CglPreProcess * preProcess_; |
---|
2622 | CbcNodeInfo ** lastNodeInfo_; |
---|
2623 | const OsiRowCut ** lastCut_; |
---|
2624 | int lastDepth_; |
---|
2625 | int lastNumberCuts2_; |
---|
2626 | int maximumCuts_; |
---|
2627 | int * lastNumberCuts_; |
---|
2628 | |
---|
2629 | /** The list of cuts initially collected for this subproblem |
---|
2630 | |
---|
2631 | When the subproblem at this node is rebuilt, a set of cuts is collected |
---|
2632 | for inclusion in the constraint system. If any of these cuts are |
---|
2633 | subsequently removed because they have become loose, the corresponding |
---|
2634 | entry is set to NULL. |
---|
2635 | */ |
---|
2636 | CbcCountRowCut ** addedCuts_; |
---|
2637 | |
---|
2638 | /** A pointer to a row cut which will be added instead of normal branching. |
---|
2639 | After use it should be set to NULL. |
---|
2640 | */ |
---|
2641 | OsiRowCut * nextRowCut_; |
---|
2642 | |
---|
2643 | /// Current node so can be used elsewhere |
---|
2644 | CbcNode * currentNode_; |
---|
2645 | |
---|
2646 | /// Indices of integer variables |
---|
2647 | int * integerVariable_; |
---|
2648 | /// Whether of not integer |
---|
2649 | char * integerInfo_; |
---|
2650 | /// Holds solution at continuous (after cuts) |
---|
2651 | double * continuousSolution_; |
---|
2652 | /// Array marked whenever a solution is found if non-zero |
---|
2653 | int * usedInSolution_; |
---|
2654 | /** |
---|
2655 | Special options |
---|
2656 | 0 bit (1) - check if cuts valid (if on debugger list) |
---|
2657 | 1 bit (2) - use current basis to check integer solution (rather than all slack) |
---|
2658 | 2 bit (4) - don't check integer solution (by solving LP) |
---|
2659 | 3 bit (8) - fast analyze |
---|
2660 | 4 bit (16) - non-linear model - so no well defined CoinPackedMatrix |
---|
2661 | 5 bit (32) - keep names |
---|
2662 | 6 bit (64) - try for dominated columns |
---|
2663 | 7 bit (128) - SOS type 1 but all declared integer |
---|
2664 | 8 bit (256) - Set to say solution just found, unset by doing cuts |
---|
2665 | 9 bit (512) - Try reduced model after 100 nodes |
---|
2666 | 10 bit (1024) - Switch on some heuristics even if seems unlikely |
---|
2667 | 11 bit (2048) - Mark as in small branch and bound |
---|
2668 | 12 bit (4096) - Funny cuts so do slow way (in some places) |
---|
2669 | 13 bit (8192) - Funny cuts so do slow way (in other places) |
---|
2670 | 14 bit (16384) - Use Cplex! for fathoming |
---|
2671 | 15 bit (32768) - Try reduced model after 0 nodes |
---|
2672 | 16 bit (65536) - Original model had integer bounds |
---|
2673 | 17 bit (131072) - Perturbation switched off |
---|
2674 | 18 bit (262144) - donor CbcModel |
---|
2675 | 19 bit (524288) - recipient CbcModel |
---|
2676 | 20 bit (1048576) - waiting for sub model to return |
---|
2677 | 22 bit (4194304) - do not initialize random seed in solver (user has) |
---|
2678 | 23 bit (8388608) - leave solver_ with cuts |
---|
2679 | 24 bit (16777216) - just get feasible if no cutoff |
---|
2680 | */ |
---|
2681 | int specialOptions_; |
---|
2682 | /** More special options |
---|
2683 | at present bottom 6 bits used for shadow price mode |
---|
2684 | 1024 for experimental hotstart |
---|
2685 | 2048,4096 breaking out of cuts |
---|
2686 | 8192 slowly increase minimum drop |
---|
2687 | 16384 gomory |
---|
2688 | 32768 more heuristics in sub trees |
---|
2689 | 65536 no cuts in preprocessing |
---|
2690 | 131072 Time limits elapsed |
---|
2691 | 18 bit (262144) - Perturb fathom nodes |
---|
2692 | 19 bit (524288) - No limit on fathom nodes |
---|
2693 | 20 bit (1048576) - Reduce sum of infeasibilities before cuts |
---|
2694 | 21 bit (2097152) - Reduce sum of infeasibilities after cuts |
---|
2695 | */ |
---|
2696 | int moreSpecialOptions_; |
---|
2697 | /** More more special options |
---|
2698 | 0 bit (1) - find switching variables |
---|
2699 | 1 bit (2) - using fake objective until solution |
---|
2700 | 2 bit (4) - switching variables exist |
---|
2701 | 3 bit (8) - skip most of setBestSolution checks |
---|
2702 | 4 bit (16) - very lightweight preprocessing in smallB&B |
---|
2703 | 5 bit (32) - event handler needs to be cloned when parallel |
---|
2704 | 6 bit (64) - testing - use probing to make cliques |
---|
2705 | 7/8 bit (128) - try orbital branching (if nauty) |
---|
2706 | 9 bit (512) - branching on objective (later) |
---|
2707 | 10 bit (1024) - branching on constraints (later) |
---|
2708 | 11/12 bit 2048 - intermittent cuts |
---|
2709 | */ |
---|
2710 | int moreSpecialOptions2_; |
---|
2711 | /// User node comparison function |
---|
2712 | CbcCompareBase * nodeCompare_; |
---|
2713 | /// User feasibility function (see CbcFeasibleBase.hpp) |
---|
2714 | CbcFeasibilityBase * problemFeasibility_; |
---|
2715 | /// Tree |
---|
2716 | CbcTree * tree_; |
---|
2717 | /// Pointer to top of tree |
---|
2718 | CbcFullNodeInfo * topOfTree_; |
---|
2719 | /// A pointer to model to be used for subtrees |
---|
2720 | CbcModel * subTreeModel_; |
---|
2721 | /// A pointer to model from CbcHeuristic |
---|
2722 | CbcModel * heuristicModel_; |
---|
2723 | /// Number of times any subtree stopped on nodes, time etc |
---|
2724 | int numberStoppedSubTrees_; |
---|
2725 | /// Variable selection function |
---|
2726 | CbcBranchDecision * branchingMethod_; |
---|
2727 | /// Cut modifier function |
---|
2728 | CbcCutModifier * cutModifier_; |
---|
2729 | /// Strategy |
---|
2730 | CbcStrategy * strategy_; |
---|
2731 | /// Parent model |
---|
2732 | CbcModel * parentModel_; |
---|
2733 | /** Whether to automatically do presolve before branch and bound. |
---|
2734 | 0 - no |
---|
2735 | 1 - ordinary presolve |
---|
2736 | 2 - integer presolve (dodgy) |
---|
2737 | */ |
---|
2738 | /// Pointer to array[getNumCols()] (for speed) of column lower bounds |
---|
2739 | const double * cbcColLower_; |
---|
2740 | /// Pointer to array[getNumCols()] (for speed) of column upper bounds |
---|
2741 | const double * cbcColUpper_; |
---|
2742 | /// Pointer to array[getNumRows()] (for speed) of row lower bounds |
---|
2743 | const double * cbcRowLower_; |
---|
2744 | /// Pointer to array[getNumRows()] (for speed) of row upper bounds |
---|
2745 | const double * cbcRowUpper_; |
---|
2746 | /// Pointer to array[getNumCols()] (for speed) of primal solution vector |
---|
2747 | const double * cbcColSolution_; |
---|
2748 | /// Pointer to array[getNumRows()] (for speed) of dual prices |
---|
2749 | const double * cbcRowPrice_; |
---|
2750 | /// Get a pointer to array[getNumCols()] (for speed) of reduced costs |
---|
2751 | const double * cbcReducedCost_; |
---|
2752 | /// Pointer to array[getNumRows()] (for speed) of row activity levels. |
---|
2753 | const double * cbcRowActivity_; |
---|
2754 | /// Pointer to user-defined data structure |
---|
2755 | void * appData_; |
---|
2756 | /// Presolve for CbcTreeLocal |
---|
2757 | int presolve_; |
---|
2758 | /** Maximum number of candidates to consider for strong branching. |
---|
2759 | To disable strong branching, set this to 0. |
---|
2760 | */ |
---|
2761 | int numberStrong_; |
---|
2762 | /** \brief The number of branches before pseudo costs believed |
---|
2763 | in dynamic strong branching. |
---|
2764 | |
---|
2765 | A value of 0 is off. |
---|
2766 | */ |
---|
2767 | int numberBeforeTrust_; |
---|
2768 | /** \brief The number of variables for which to compute penalties |
---|
2769 | in dynamic strong branching. |
---|
2770 | */ |
---|
2771 | int numberPenalties_; |
---|
2772 | /// For threads - stop after this many "iterations" |
---|
2773 | int stopNumberIterations_; |
---|
2774 | /** Scale factor to make penalties match strong. |
---|
2775 | Should/will be computed */ |
---|
2776 | double penaltyScaleFactor_; |
---|
2777 | /// Number of analyze iterations to do |
---|
2778 | int numberAnalyzeIterations_; |
---|
2779 | /// Arrays with analysis results |
---|
2780 | double * analyzeResults_; |
---|
2781 | /// Useful temporary pointer |
---|
2782 | void * temporaryPointer_; |
---|
2783 | /// Number of nodes infeasible by normal branching (before cuts) |
---|
2784 | int numberInfeasibleNodes_; |
---|
2785 | /** Problem type as set by user or found by analysis. This will be extended |
---|
2786 | 0 - not known |
---|
2787 | 1 - Set partitioning <= |
---|
2788 | 2 - Set partitioning == |
---|
2789 | 3 - Set covering |
---|
2790 | */ |
---|
2791 | int problemType_; |
---|
2792 | /// Print frequency |
---|
2793 | int printFrequency_; |
---|
2794 | /// Number of cut generators |
---|
2795 | int numberCutGenerators_; |
---|
2796 | // Cut generators |
---|
2797 | CbcCutGenerator ** generator_; |
---|
2798 | // Cut generators before any changes |
---|
2799 | CbcCutGenerator ** virginGenerator_; |
---|
2800 | /// Number of heuristics |
---|
2801 | int numberHeuristics_; |
---|
2802 | /// Heuristic solvers |
---|
2803 | CbcHeuristic ** heuristic_; |
---|
2804 | /// Pointer to heuristic solver which found last solution (or NULL) |
---|
2805 | CbcHeuristic * lastHeuristic_; |
---|
2806 | /// Depth for fast nodes |
---|
2807 | int fastNodeDepth_; |
---|
2808 | /*! Pointer to the event handler */ |
---|
2809 | # ifdef CBC_ONLY_CLP |
---|
2810 | ClpEventHandler *eventHandler_ ; |
---|
2811 | # else |
---|
2812 | CbcEventHandler *eventHandler_ ; |
---|
2813 | # endif |
---|
2814 | /// Symmetry information |
---|
2815 | CbcSymmetry * symmetryInfo_; |
---|
2816 | /// Total number of objects |
---|
2817 | int numberObjects_; |
---|
2818 | |
---|
2819 | /** \brief Integer and Clique and ... information |
---|
2820 | |
---|
2821 | \note The code assumes that the first objects on the list will be |
---|
2822 | SimpleInteger objects for each integer variable, followed by |
---|
2823 | Clique objects. Portions of the code that understand Clique objects |
---|
2824 | will fail if they do not immediately follow the SimpleIntegers. |
---|
2825 | Large chunks of the code will fail if the first objects are not |
---|
2826 | SimpleInteger. As of 2003.08, SimpleIntegers and Cliques are the only |
---|
2827 | objects. |
---|
2828 | */ |
---|
2829 | OsiObject ** object_; |
---|
2830 | /// Now we may not own objects - just point to solver's objects |
---|
2831 | bool ownObjects_; |
---|
2832 | |
---|
2833 | /// Original columns as created by integerPresolve or preprocessing |
---|
2834 | int * originalColumns_; |
---|
2835 | /// How often to scan global cuts |
---|
2836 | int howOftenGlobalScan_; |
---|
2837 | /** Number of times global cuts violated. When global cut pool then this |
---|
2838 | should be kept for each cut and type of cut */ |
---|
2839 | int numberGlobalViolations_; |
---|
2840 | /// Number of extra iterations in fast lp |
---|
2841 | int numberExtraIterations_; |
---|
2842 | /// Number of extra nodes in fast lp |
---|
2843 | int numberExtraNodes_; |
---|
2844 | /// Number of times fast lp entered |
---|
2845 | int numberFathoms_; |
---|
2846 | /** Value of objective at continuous |
---|
2847 | (Well actually after initial round of cuts) |
---|
2848 | */ |
---|
2849 | double continuousObjective_; |
---|
2850 | /** Value of objective before root node cuts added |
---|
2851 | */ |
---|
2852 | double originalContinuousObjective_; |
---|
2853 | /// Number of infeasibilities at continuous |
---|
2854 | int continuousInfeasibilities_; |
---|
2855 | /// Maximum number of cut passes at root |
---|
2856 | int maximumCutPassesAtRoot_; |
---|
2857 | /// Maximum number of cut passes |
---|
2858 | int maximumCutPasses_; |
---|
2859 | /// Preferred way of branching |
---|
2860 | int preferredWay_; |
---|
2861 | /// Current cut pass number |
---|
2862 | int currentPassNumber_; |
---|
2863 | /// Maximum number of cuts (for whichGenerator_) |
---|
2864 | int maximumWhich_; |
---|
2865 | /// Maximum number of rows |
---|
2866 | int maximumRows_; |
---|
2867 | /// Random seed |
---|
2868 | int randomSeed_; |
---|
2869 | /// Multiple root tries |
---|
2870 | int multipleRootTries_; |
---|
2871 | /// Current depth |
---|
2872 | int currentDepth_; |
---|
2873 | /// Thread specific random number generator |
---|
2874 | mutable CoinThreadRandom randomNumberGenerator_; |
---|
2875 | /// Work basis for temporary use |
---|
2876 | CoinWarmStartBasis workingBasis_; |
---|
2877 | /// Which cut generator generated this cut |
---|
2878 | int * whichGenerator_; |
---|
2879 | /// Maximum number of statistics |
---|
2880 | int maximumStatistics_; |
---|
2881 | /// statistics |
---|
2882 | CbcStatistics ** statistics_; |
---|
2883 | /// Maximum depth reached |
---|
2884 | int maximumDepthActual_; |
---|
2885 | /// Number of reduced cost fixings |
---|
2886 | double numberDJFixed_; |
---|
2887 | /// Probing info |
---|
2888 | CglTreeProbingInfo * probingInfo_; |
---|
2889 | /// Number of fixed by analyze at root |
---|
2890 | int numberFixedAtRoot_; |
---|
2891 | /// Number fixed by analyze so far |
---|
2892 | int numberFixedNow_; |
---|
2893 | /// Whether stopping on gap |
---|
2894 | bool stoppedOnGap_; |
---|
2895 | /// Whether event happened |
---|
2896 | mutable bool eventHappened_; |
---|
2897 | /// Number of long strong goes |
---|
2898 | int numberLongStrong_; |
---|
2899 | /// Number of old active cuts |
---|
2900 | int numberOldActiveCuts_; |
---|
2901 | /// Number of new cuts |
---|
2902 | int numberNewCuts_; |
---|
2903 | /// Strategy worked out - mainly at root node |
---|
2904 | int searchStrategy_; |
---|
2905 | /** Strategy for strong branching |
---|
2906 | 0 - normal |
---|
2907 | when to do all fractional |
---|
2908 | 1 - root node |
---|
2909 | 2 - depth less than modifier |
---|
2910 | 4 - if objective == best possible |
---|
2911 | 6 - as 2+4 |
---|
2912 | when to do all including satisfied |
---|
2913 | 10 - root node etc. |
---|
2914 | If >=100 then do when depth <= strategy/100 (otherwise 5) |
---|
2915 | */ |
---|
2916 | int strongStrategy_; |
---|
2917 | /// Number of iterations in strong branching |
---|
2918 | int numberStrongIterations_; |
---|
2919 | /** 0 - number times strong branching done, 1 - number fixed, 2 - number infeasible |
---|
2920 | Second group of three is a snapshot at node [6] */ |
---|
2921 | int strongInfo_[7]; |
---|
2922 | /** |
---|
2923 | For advanced applications you may wish to modify the behavior of Cbc |
---|
2924 | e.g. if the solver is a NLP solver then you may not have an exact |
---|
2925 | optimum solution at each step. This gives characteristics - just for one BAB. |
---|
2926 | For actually saving/restoring a solution you need the actual solver one. |
---|
2927 | */ |
---|
2928 | OsiBabSolver * solverCharacteristics_; |
---|
2929 | /// Whether to force a resolve after takeOffCuts |
---|
2930 | bool resolveAfterTakeOffCuts_; |
---|
2931 | /// Maximum number of iterations (designed to be used in heuristics) |
---|
2932 | int maximumNumberIterations_; |
---|
2933 | /// Anything with priority >= this can be treated as continuous |
---|
2934 | int continuousPriority_; |
---|
2935 | /// Number of outstanding update information items |
---|
2936 | int numberUpdateItems_; |
---|
2937 | /// Maximum number of outstanding update information items |
---|
2938 | int maximumNumberUpdateItems_; |
---|
2939 | /// Update items |
---|
2940 | CbcObjectUpdateData * updateItems_; |
---|
2941 | /// Stored row cuts for donor/recipient CbcModel |
---|
2942 | CglStored * storedRowCuts_; |
---|
2943 | /** |
---|
2944 | Parallel |
---|
2945 | 0 - off |
---|
2946 | 1 - testing |
---|
2947 | 2-99 threads |
---|
2948 | other special meanings |
---|
2949 | */ |
---|
2950 | int numberThreads_; |
---|
2951 | /** thread mode |
---|
2952 | always use numberThreads for branching |
---|
2953 | 1 set then deterministic |
---|
2954 | 2 set then use numberThreads for root cuts |
---|
2955 | 4 set then use numberThreads in root mini branch and bound |
---|
2956 | default is 0 |
---|
2957 | */ |
---|
2958 | int threadMode_; |
---|
2959 | /// Number of global cuts on entry to a node |
---|
2960 | int numberGlobalCutsIn_; |
---|
2961 | /// Thread stuff for master |
---|
2962 | CbcBaseModel * master_; |
---|
2963 | /// Pointer to masterthread |
---|
2964 | CbcThread * masterThread_; |
---|
2965 | //@} |
---|
2966 | }; |
---|
2967 | /// So we can use osiObject or CbcObject during transition |
---|
2968 | void getIntegerInformation(const OsiObject * object, double & originalLower, |
---|
2969 | double & originalUpper) ; |
---|
2970 | // So we can call from other programs |
---|
2971 | // Real main program |
---|
2972 | class OsiClpSolverInterface; |
---|
2973 | int CbcMain (int argc, const char *argv[], OsiClpSolverInterface & solver, CbcModel ** babSolver); |
---|
2974 | int CbcMain (int argc, const char *argv[], CbcModel & babSolver); |
---|
2975 | // four ways of calling |
---|
2976 | int callCbc(const char * input2, OsiClpSolverInterface& solver1); |
---|
2977 | int callCbc(const char * input2); |
---|
2978 | int callCbc(const std::string input2, OsiClpSolverInterface& solver1); |
---|
2979 | int callCbc(const std::string input2) ; |
---|
2980 | // When we want to load up CbcModel with options first |
---|
2981 | void CbcMain0 (CbcModel & babSolver); |
---|
2982 | int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver); |
---|
2983 | // two ways of calling |
---|
2984 | int callCbc(const char * input2, CbcModel & babSolver); |
---|
2985 | int callCbc(const std::string input2, CbcModel & babSolver); |
---|
2986 | // And when CbcMain0 already called to initialize |
---|
2987 | int callCbc1(const char * input2, CbcModel & babSolver); |
---|
2988 | int callCbc1(const std::string input2, CbcModel & babSolver); |
---|
2989 | // And when CbcMain0 already called to initialize (with call back) (see CbcMain1 for whereFrom) |
---|
2990 | int callCbc1(const char * input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom)); |
---|
2991 | int callCbc1(const std::string input2, CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom)); |
---|
2992 | int CbcMain1 (int argc, const char *argv[], CbcModel & babSolver, int (CbcModel * currentSolver, int whereFrom)); |
---|
2993 | // For uniform setting of cut and heuristic options |
---|
2994 | void setCutAndHeuristicOptions(CbcModel & model); |
---|
2995 | #endif |
---|
2996 | |
---|