1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
2 | <chapter id="cbcmodelclass"> |
---|
3 | <title> |
---|
4 | The CBC Model Class |
---|
5 | </title> |
---|
6 | <section id="hierarchy"> |
---|
7 | <title> |
---|
8 | Overview |
---|
9 | </title> |
---|
10 | <para> |
---|
11 | The main class in CBC is <classname>CbcModel</classname>. The <classname>CbcModel</classname> class is where most |
---|
12 | of the parameter setting is done. The absolute minimum number of actions taken with <classname>CbcModel</classname> is two, |
---|
13 | <itemizedlist> |
---|
14 | <listitem> |
---|
15 | <simpara> |
---|
16 | <function>CbcModel(OsiSolverInterface & linearSolver)</function> as constructor, and |
---|
17 | </simpara> |
---|
18 | </listitem> |
---|
19 | <listitem> |
---|
20 | <simpara> |
---|
21 | <function>branchAndBound()</function> for solving the problem. |
---|
22 | </simpara> |
---|
23 | </listitem> |
---|
24 | </itemizedlist> |
---|
25 | </para> |
---|
26 | </section> |
---|
27 | |
---|
28 | <section id="firstexample"> |
---|
29 | <title> |
---|
30 | Simple Branch-and-Bound Example |
---|
31 | </title> |
---|
32 | <para> |
---|
33 | The first sample program shows how to perform simple branch-and-bound with CBC. This program is short enough to present in full. Most of the remaining examples will take the form of small code fragments. |
---|
34 | The complete code for all the examples in this Guide can be found in the CBC Samples directory, <filename>COIN/Cbc/Samples</filename>. |
---|
35 | |
---|
36 | </para> |
---|
37 | <example id="minimum.cpp"> |
---|
38 | <title>minimum.cpp</title> |
---|
39 | <programlisting> |
---|
40 | <![CDATA[ |
---|
41 | // Copyright (C) 2005, International Business Machines |
---|
42 | // Corporation and others. All Rights Reserved. |
---|
43 | |
---|
44 | #include "CbcModel.hpp" |
---|
45 | |
---|
46 | // Using CLP as the solver |
---|
47 | #include "OsiClpSolverInterface.hpp" |
---|
48 | |
---|
49 | int main (int argc, const char *argv[]) |
---|
50 | { |
---|
51 | OsiClpSolverInterface solver1; |
---|
52 | |
---|
53 | // Read in example model in MPS file format |
---|
54 | // and assert that it is a clean model |
---|
55 | int numMpsReadErrors = solver1.readMps("../../Mps/Sample/p0033.mps",""); |
---|
56 | assert(numMpsReadErrors==0); |
---|
57 | |
---|
58 | // Pass the solver with the problem to be solved to CbcModel |
---|
59 | CbcModel model(solver1); |
---|
60 | |
---|
61 | // Do complete search |
---|
62 | model.branchAndBound(); |
---|
63 | |
---|
64 | /* Print the solution. CbcModel clones the solver so we |
---|
65 | need to get current copy from the CbcModel */ |
---|
66 | int numberColumns = model.solver()->getNumCols(); |
---|
67 | |
---|
68 | const double * solution = model.solver()->getColSolution(); |
---|
69 | |
---|
70 | for (int iColumn=0;iColumn<numberColumns;iColumn++) { |
---|
71 | double value=solution[iColumn]; |
---|
72 | if (fabs(value)>1.0e-7&&model.solver()->isInteger(iColumn)) |
---|
73 | printf("%d has value %g\n",iColumn,value); |
---|
74 | } |
---|
75 | return 0; |
---|
76 | } |
---|
77 | ]]> |
---|
78 | </programlisting> |
---|
79 | </example> |
---|
80 | <!-- Clone comment needs more explanation. What info is safe? When do you need to do a refresh?? --> |
---|
81 | <!-- printf vs cout --> |
---|
82 | |
---|
83 | <para> |
---|
84 | The program in <xref linkend="minimum.cpp"/> creates a <classname>OsiClpSolverInterface</classname> solver interface (i.e., <varname>solver1</varname>), and reads an MPS file. If there are no errors, the program passes the problem to <classname>CbcModel</classname> which solves the problem using the branch-and-bound algorithm. The part of the program which solves the problem is very small (one line!) but before that one line, the LP solver (i.e., <varname>solver1</varname>) had to be created and populated with the problem. After that one line, the results were printed out. |
---|
85 | </para> |
---|
86 | </section> |
---|
87 | |
---|
88 | <section id="osiAndCbc"> |
---|
89 | <title> |
---|
90 | The Relationship Between OSI and CBC |
---|
91 | </title> |
---|
92 | <para> |
---|
93 | The program in <xref linkend="minimum.cpp"/> illustrates the dependency of CBC on |
---|
94 | the <classname>OsiSolverInterface</classname> class. The constructor of <classname>CbcModel</classname> takes a pointer to an <classname>OsiSolverInterface</classname> (i.e., a solver). The <classname>CbcModel</classname> clones the solver, and uses its own instance of the solver. The <classname>CbcModel</classname>'s solver and the original solver (e.g., <varname>solver1</varname>) are not in sync unless the user synchronizes them. The user can always access the <classname>CbcModel</classname>'s solver through the <function>model()</function> method. To synchronize the two solvers, explicitly refreshing the original, e.g., |
---|
95 | <programlisting> |
---|
96 | solver1 = model.solver(); |
---|
97 | </programlisting> |
---|
98 | <classname>CbcModel</classname>'s method <function>solve()</function> returns a pointer to CBC's cloned solver. |
---|
99 | </para> |
---|
100 | |
---|
101 | <para> |
---|
102 | For convenience, many of the OSI methods to access problem data have identical method names in <classname>CbcModel</classname>. (It's just more convenient to type <function>model.getNumCols()</function> rather than <function>model.solver()->getNumCols()</function>). The <classname>CbcModel</classname> refreshes its solver at certain logical points during the algorithm. At these points, the information from the <classname>CbcModel</classname> <varname>model</varname> will match the information from the <function>model.solver()</function>. Elsewhere, the information may vary. For instance, the OSI method <function>getColSolution()</function> will contain the best solution so far, while the <classname>CbcModel</classname> method may not. In this case, it is safer to use <function>CbcModel::bestSolution()</function>. |
---|
103 | </para> |
---|
104 | <para> |
---|
105 | While all the OSI methods used in <filename>minimum.cpp</filename> have equivalent methods in <classname>CbcModel</classname>, there are some OSI methods which do not. For example, if the program produced a lot of undesired output, one might add the line |
---|
106 | </para> |
---|
107 | <programlisting> |
---|
108 | model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry); |
---|
109 | </programlisting> |
---|
110 | <para> |
---|
111 | <!-- model.solver() returns an OSISolverInterface? --> |
---|
112 | to reduce the output. There is no <function>setHintParam()</function> method in <classname>CbcModel</classname>. |
---|
113 | </para> |
---|
114 | </section> |
---|
115 | |
---|
116 | <section id="gettingsolution"> |
---|
117 | <title> |
---|
118 | Getting Solution Information |
---|
119 | </title> |
---|
120 | <para> |
---|
121 | Optimality can be checked through a call to <function>model.isProvenOptimal()</function>. Also |
---|
122 | available are <function>isProvenInfeasible()</function>, |
---|
123 | <function>isSolutionLimitReached()</function>, |
---|
124 | <function>isNodeLimitReached()</function> or the feared |
---|
125 | <function>isAbandoned()</function>. There is also |
---|
126 | <function>int status()</function> which returns 0 if finished (which includes the case when the algorithm is finished because it has been proved infeasible), 1 if stopped by user, and 2 if difficulties arose. |
---|
127 | </para> |
---|
128 | <para> |
---|
129 | In addition to these <classname>CbcModel</classname> methods, solution values can be accessed via OSI methods. The OSI methods pick up the current solution in the <classname>CBCModel</classname>. The current solution will match the best solution found so far if called after <function>branchAndBound()</function> and a solution was found. |
---|
130 | </para> |
---|
131 | <table frame="none"> |
---|
132 | <title> |
---|
133 | Methods for Getting Solution Information from OSI |
---|
134 | </title> |
---|
135 | <tgroup cols="2"> |
---|
136 | <thead> |
---|
137 | <row> |
---|
138 | <entry> |
---|
139 | Purpose |
---|
140 | </entry> |
---|
141 | <entry> |
---|
142 | Name |
---|
143 | </entry> |
---|
144 | <entry> |
---|
145 | Notes |
---|
146 | </entry> |
---|
147 | </row> |
---|
148 | </thead> |
---|
149 | <tbody> |
---|
150 | <row> |
---|
151 | <entry align="left" valign="top"> |
---|
152 | Primal column solution |
---|
153 | </entry> |
---|
154 | <entry align="left" valign="top"> |
---|
155 | <function>const double * getColSolution()</function> |
---|
156 | </entry> |
---|
157 | <entry align="left" valign="top"> |
---|
158 | The OSI method will return the best solution found thus far, unless none has been found. It is safer to use <classname>CbcModel</classname> version, <function>CbcModel::bestSolution()</function> |
---|
159 | </entry> |
---|
160 | </row> |
---|
161 | <row> |
---|
162 | <entry align="left" valign="top"> |
---|
163 | Dual row solution |
---|
164 | </entry> |
---|
165 | <entry align="left" valign="top"> |
---|
166 | <function>const double * getRowPrice()</function> |
---|
167 | </entry> |
---|
168 | <entry align="left" valign="top"> |
---|
169 | Identical <classname>CbcModel</classname> version available, <function>CbcModel::getRowPrice()</function>. |
---|
170 | </entry> |
---|
171 | </row> |
---|
172 | <row> |
---|
173 | <entry align="left" valign="top"> |
---|
174 | Primal row solution |
---|
175 | </entry> |
---|
176 | <entry align="left" valign="top"> |
---|
177 | <function>const double * getRowActivity()</function> |
---|
178 | </entry> |
---|
179 | <entry align="left" valign="top"> |
---|
180 | Identical <classname>CbcModel</classname> version available, <function>CbcModel::getRowActivity()</function>. |
---|
181 | </entry> |
---|
182 | </row> |
---|
183 | <row> |
---|
184 | <entry align="left" valign="top"> |
---|
185 | Dual column solution |
---|
186 | </entry> |
---|
187 | <entry align="left" valign="top"> |
---|
188 | <function>const double * getReducedCost()</function> |
---|
189 | </entry> |
---|
190 | <entry align="left" valign="top"> |
---|
191 | Identical <classname>CbcModel</classname> version available, <function>CbcModel::gtReducedCost()</function>. |
---|
192 | </entry> |
---|
193 | </row> |
---|
194 | <row> |
---|
195 | <entry align="left" valign="top"> |
---|
196 | Number of rows in model |
---|
197 | </entry> |
---|
198 | <entry align="left" valign="top"> |
---|
199 | <function>int getNumRows()</function> |
---|
200 | </entry> |
---|
201 | <entry align="left" valign="top"> |
---|
202 | Identical <classname>CbcModel</classname> version available, <function>CbcModel::getNumRows()</function>. Note: the number of rows can change due to cuts. |
---|
203 | </entry> |
---|
204 | </row> |
---|
205 | <row> |
---|
206 | <entry align="left" valign="top"> |
---|
207 | Number of columns in model |
---|
208 | </entry> |
---|
209 | <entry align="left" valign="top"> |
---|
210 | <function>int getNumCols()</function> |
---|
211 | </entry> |
---|
212 | <entry align="left" valign="top"> |
---|
213 | Identical <classname>CbcModel</classname> version available, <function>CbcModel::getNumCols()</function>. |
---|
214 | </entry> |
---|
215 | </row> |
---|
216 | </tbody> |
---|
217 | </tgroup> |
---|
218 | </table> |
---|
219 | </section> |
---|
220 | |
---|
221 | <section id="setsandgets"> |
---|
222 | <title> |
---|
223 | Useful Set and Get Methods in <classname>CbcModel</classname> |
---|
224 | </title> |
---|
225 | <para> |
---|
226 | Most of the parameter setting in CBC is done through <classname>CbcModel</classname> methods. The most commonly used set and get methods are listed in <xref linkend="setGet"/>. |
---|
227 | </para> |
---|
228 | <table frame="none" id="setGet"> |
---|
229 | <title>Useful Set and Get Methods in <classname>CbcModel</classname></title> |
---|
230 | <tgroup cols="2"> |
---|
231 | <thead> |
---|
232 | <row> |
---|
233 | <entry> |
---|
234 | Method(s) |
---|
235 | </entry> |
---|
236 | <entry> |
---|
237 | Description |
---|
238 | </entry> |
---|
239 | </row> |
---|
240 | </thead> |
---|
241 | <tbody> |
---|
242 | <row> |
---|
243 | <entry align="left" valign="top"> |
---|
244 | <function>bool setMaximumNodes(int value)</function><sbr/> |
---|
245 | <function>int getMaximumNodes() const</function><sbr/> |
---|
246 | <function>bool setMaximumSeconds(double value)</function><sbr/> |
---|
247 | |
---|
248 | <function>double getMaximumSeconds()</function><sbr/> |
---|
249 | <function>bool setMaximumSolutions(double value)</function><sbr/> |
---|
250 | <function>double getMaximumSolutions() const</function> |
---|
251 | </entry> |
---|
252 | <entry align="left" valign="top"> |
---|
253 | These set methods tell CBC to stop after a given number of nodes, |
---|
254 | seconds, or solutions is reached. The get methods return the corresponding values. |
---|
255 | </entry> |
---|
256 | </row> |
---|
257 | <row> |
---|
258 | <entry align="left" valign="top"> |
---|
259 | <function>bool setIntegerTolerance(double value) const</function><sbr/> |
---|
260 | <function>double getIntegerTolerance() const</function> |
---|
261 | </entry> |
---|
262 | <entry align="left" valign="top"> |
---|
263 | An integer variable is deemed to be at an integral value if it is no further than this <parameter>value</parameter> (tolerance) away. |
---|
264 | </entry> |
---|
265 | </row> |
---|
266 | <row> |
---|
267 | <entry align="left" valign="top"> |
---|
268 | <function>bool setAllowableGap(double value)</function><sbr/> |
---|
269 | <function>double getAllowableGap() const</function><sbr/> |
---|
270 | <function>bool setAllowablePercentageGap(double value)</function><sbr/> |
---|
271 | <function>double getAllowablePercentageGap() const</function><sbr/> |
---|
272 | <function>bool setAllowableFractionGap(double value)</function><sbr/> |
---|
273 | <function>double getAllowableFractionGap() const</function><sbr/> |
---|
274 | </entry> |
---|
275 | <entry align="left" valign="top"> |
---|
276 | <classname>CbcModel</classname> returns if the gap between the best known solution and the best |
---|
277 | possible solution is less than this <parameter>value</parameter>, or as a percentage, or a fraction. |
---|
278 | </entry> |
---|
279 | </row> |
---|
280 | <row> |
---|
281 | <entry align="left" valign="top"> |
---|
282 | <function>void setNumberStrong(double value) </function><sbr/> |
---|
283 | <function>int numberStrong() const </function> <!-- should be a "get" --> |
---|
284 | </entry> |
---|
285 | <entry align="left" valign="top"> |
---|
286 | These methods set or get the maximum number of candidates at a node to |
---|
287 | be evaluated for strong branching. |
---|
288 | </entry> |
---|
289 | </row> |
---|
290 | <row> |
---|
291 | <entry align="left" valign="top"> |
---|
292 | <function>void setPrintFrequency(int value) </function><sbr/> |
---|
293 | <function>int printFrequency() const</function> |
---|
294 | </entry> |
---|
295 | <entry align="left" valign="top"> |
---|
296 | Controls the number of nodes evaluated between status prints. |
---|
297 | Print frequency has a very slight overhead, if <parameter>value</parameter> is small. |
---|
298 | </entry> |
---|
299 | </row> |
---|
300 | <row> |
---|
301 | <entry align="left" valign="top"> |
---|
302 | <function>int getNodeCount() const</function> |
---|
303 | </entry> |
---|
304 | <entry align="left" valign="top"> |
---|
305 | Returns number of nodes evaluated in the search. |
---|
306 | </entry> |
---|
307 | </row> |
---|
308 | <row> |
---|
309 | <entry align="left" valign="top"> |
---|
310 | <function>int numberRowsAtContinuous() const</function> |
---|
311 | </entry> |
---|
312 | <entry align="left" valign="top"> |
---|
313 | Returns number of rows at continuous <!-- rlh: huh? --> |
---|
314 | </entry> |
---|
315 | </row> |
---|
316 | <row> |
---|
317 | <entry align="left" valign="top"> |
---|
318 | <function>int numberIntegers() const</function><sbr/> |
---|
319 | <function>const int * integerVariable() const</function> |
---|
320 | </entry> |
---|
321 | <entry align="left" valign="top"> |
---|
322 | Returns number of integer variables and an array specifying them. |
---|
323 | </entry> |
---|
324 | </row> |
---|
325 | <row> |
---|
326 | <entry align="left" valign="top"> |
---|
327 | <function>bool isBinary(int colIndex) const</function><sbr/> |
---|
328 | <function>bool isContinuous(int colIndex) const</function><sbr/> |
---|
329 | <function>bool isInteger(int colIndex) const</function> |
---|
330 | </entry> |
---|
331 | <entry align="left" valign="top"> |
---|
332 | Returns information on variable <parameter>colIndex</parameter>. OSI methods |
---|
333 | can be used to set these attributes (before handing the model to <classname>CbcModel</classname>). |
---|
334 | </entry> |
---|
335 | </row> |
---|
336 | <row> |
---|
337 | <entry align="left" valign="top"> |
---|
338 | <function>double getObjValue() const</function> |
---|
339 | </entry> |
---|
340 | <entry align="left" valign="top"> |
---|
341 | This method returns the best objective value so far. |
---|
342 | </entry> |
---|
343 | </row> |
---|
344 | <row> |
---|
345 | <entry align="left" valign="top"> |
---|
346 | <function>double getCurrentObjValue() const</function> |
---|
347 | </entry> |
---|
348 | <entry align="left" valign="top"> |
---|
349 | This method returns the current objective value. |
---|
350 | </entry> |
---|
351 | </row> |
---|
352 | <row> |
---|
353 | <entry align="left" valign="top"> |
---|
354 | <function>const double * getObjCoefficients() const</function><sbr/> |
---|
355 | </entry> |
---|
356 | <entry align="left" valign="top"> |
---|
357 | This method return the objective coefficients. |
---|
358 | </entry> |
---|
359 | </row> |
---|
360 | <row> |
---|
361 | <entry align="left" valign="top"> |
---|
362 | <function>const double * getRowLower() const</function><sbr/> |
---|
363 | <function>const double * getRowUpper() const</function><sbr/> |
---|
364 | <function>const double * getColLower() const</function><sbr/> |
---|
365 | <function>const double * getColUpper() const</function><sbr/> |
---|
366 | </entry> |
---|
367 | <entry align="left" valign="top"> |
---|
368 | These methods return the lower and upper bounds on row and column activities. |
---|
369 | </entry> |
---|
370 | </row> |
---|
371 | <row> |
---|
372 | <entry align="left" valign="top"> |
---|
373 | <function>const CoinPackMatrix * getMatrixByRow() const</function> |
---|
374 | </entry> |
---|
375 | <entry align="left" valign="top"> |
---|
376 | This method returns a pointer to a row copy of matrix stored as a |
---|
377 | <classname>CoinPackedMatrix</classname> which can be further examined. |
---|
378 | </entry> |
---|
379 | </row> |
---|
380 | <row> |
---|
381 | <entry align="left" valign="top"> |
---|
382 | <function>const CoinPackMatrix * getMatrixByCol() const</function> |
---|
383 | </entry> |
---|
384 | <entry align="left" valign="top"> |
---|
385 | This method returns a pointer to a column copy of matrix stored as a |
---|
386 | <classname>CoinPackedMatrix</classname> which can be further examined. |
---|
387 | </entry> |
---|
388 | </row> |
---|
389 | <row> |
---|
390 | <entry align="left" valign="top"> |
---|
391 | <function>CoinBigIndex getNumElements() const</function> |
---|
392 | <footnote> |
---|
393 | <para> |
---|
394 | <type>CoinBigIndex</type> is a <function>typedef</function> which in |
---|
395 | most cases is the same as <type>int</type>. |
---|
396 | </para> |
---|
397 | </footnote> |
---|
398 | </entry> |
---|
399 | <entry align="left" valign="top"> |
---|
400 | Returns the number of nonzero elements in the problem matrix. |
---|
401 | </entry> |
---|
402 | </row> |
---|
403 | <row> |
---|
404 | <entry align="left" valign="top"> |
---|
405 | <function>void setObjSense(double value)</function><sbr/> |
---|
406 | <function>double getObjSense() const</function> |
---|
407 | </entry> |
---|
408 | <entry align="left" valign="top"> |
---|
409 | These methods set and get the objective sense. The parameter |
---|
410 | <parameter>value</parameter> should be +1 to minimize and -1 to maximize. |
---|
411 | </entry> |
---|
412 | </row> |
---|
413 | </tbody> |
---|
414 | </tgroup> |
---|
415 | </table> |
---|
416 | </section> |
---|
417 | <section id="majormethods"> |
---|
418 | <title> |
---|
419 | Impacting the Solution Process |
---|
420 | </title> |
---|
421 | <para> |
---|
422 | <classname>CbcModel</classname> is extremely flexible and customizable. The class structure of CBC is designed to make the most commonly desired customizations of branch-and-cut possible. These include: |
---|
423 | <itemizedlist> |
---|
424 | <listitem> |
---|
425 | <simpara> |
---|
426 | selecting the next node to consider in the search tree, |
---|
427 | </simpara> |
---|
428 | </listitem> |
---|
429 | <listitem> |
---|
430 | <simpara> |
---|
431 | determining which variable to branch on, |
---|
432 | </simpara> |
---|
433 | </listitem> |
---|
434 | <listitem> |
---|
435 | <simpara> |
---|
436 | using heuristics to generate MIP-feasible solutions quickly, |
---|
437 | </simpara> |
---|
438 | </listitem> |
---|
439 | <listitem> |
---|
440 | <simpara> |
---|
441 | including cut generation when solving the LP-relaxations, and |
---|
442 | </simpara> |
---|
443 | </listitem> |
---|
444 | <listitem> |
---|
445 | <simpara> |
---|
446 | invoking customized subproblem solvers. |
---|
447 | </simpara> |
---|
448 | </listitem> |
---|
449 | </itemizedlist> |
---|
450 | |
---|
451 | |
---|
452 | To enable this flexibility, <classname>CbcModel</classname> uses other classes in CBC (some of which are virtual and may have multiple instances). Not all classes are created equal. The two tables below list in alphabetical order the classes used by <classname>CbcModel</classname> that are of most interest and of least interest. |
---|
453 | </para> |
---|
454 | <table frame="none"> |
---|
455 | <title>Classes Used by CbcModel - Most Useful</title> |
---|
456 | <tgroup cols="3"> |
---|
457 | <thead> |
---|
458 | <row> |
---|
459 | <entry> |
---|
460 | Class name |
---|
461 | </entry> |
---|
462 | <entry> |
---|
463 | Description |
---|
464 | </entry> |
---|
465 | <entry> |
---|
466 | Notes |
---|
467 | </entry> |
---|
468 | </row> |
---|
469 | </thead> |
---|
470 | <tbody> |
---|
471 | <row> |
---|
472 | <entry align="left" valign="top"> |
---|
473 | <classname>CbcCompareBase</classname> |
---|
474 | </entry> |
---|
475 | <entry align="left" valign="top"> |
---|
476 | Controls which node on the tree is selected. |
---|
477 | </entry> |
---|
478 | <entry align="left" valign="top"> |
---|
479 | The default is <classname>CbcCompareDefault</classname>. Other comparison classes in <filename>CbcCompareActual.hpp</filename> include <classname>CbcCompareDepth</classname> and <classname>CbcCompareObjective</classname>. Experimenting with these classes and creating new compare classes is easy. |
---|
480 | </entry> |
---|
481 | </row> |
---|
482 | <row> |
---|
483 | <entry align="left" valign="top"> |
---|
484 | <classname>CbcCutGenerator</classname> |
---|
485 | </entry> |
---|
486 | <entry align="left" valign="top"> |
---|
487 | A wrapper for <classname>CglCutGenerator</classname> with additional data to control when the cut generator is invoked during the tree search. |
---|
488 | </entry> |
---|
489 | <entry align="left" valign="top"> |
---|
490 | Other than knowing how to add a cut generator to <classname>CbcModel</classname>, there is not much the average user needs to know about this class. However, sophisticated users can implement their own cut generators. <!-- what's the default? --> |
---|
491 | </entry> |
---|
492 | </row> |
---|
493 | <row> |
---|
494 | <entry align="left" valign="top"> |
---|
495 | <classname>CbcHeuristic</classname> |
---|
496 | </entry> |
---|
497 | <entry align="left" valign="top"> |
---|
498 | Heuristic that attempts to generate valid MIP-solutions leading to good upper bounds. |
---|
499 | </entry> |
---|
500 | <entry align="left" valign="top"> |
---|
501 | Specialized heuristics can dramatically improve branch-and-cut performance. As many different heuristics as desired can be used in CBC. Advanced users should consider implementing custom heuristics when tackling difficult problems. <!-- What's the default? --> |
---|
502 | </entry> |
---|
503 | </row> |
---|
504 | <row> |
---|
505 | <entry align="left" valign="top"> |
---|
506 | <classname>CbcObject</classname> |
---|
507 | </entry> |
---|
508 | <entry align="left" valign="top"> |
---|
509 | Defines what it means for a variable to be satisfied. Used in branching. |
---|
510 | </entry> |
---|
511 | <entry align="left" valign="top"> |
---|
512 | Virtual class. CBC's concept of branching is based on the idea of an "object". An object has (i) a feasible region, (ii) can be evaluated for infeasibility, (iii) can be branched on, e.g., a method of generating a branching object, which defines an up branch and a down branch, and (iv) allows comparsion of the effect of branching. Instances of objects include <classname>CbcSimpleInteger</classname>, <classname>CbcSimpleIntegerPseudoCosts</classname>, <classname>CbcClique</classname>, <classname>CbcSOS</classname> (type 1 and 2), <classname>CbcFollowOn</classname>, and <classname>CbcLotsize</classname>. |
---|
513 | </entry> |
---|
514 | </row> |
---|
515 | <row> |
---|
516 | <entry align="left" valign="top"> |
---|
517 | <classname>OsiSolverInterface</classname> |
---|
518 | </entry> |
---|
519 | <entry align="left" valign="top"> |
---|
520 | Defines the LP solver being used and the LP model. Normally |
---|
521 | a pointer to the desired <classname>OsiSolverInteface</classname> is passed to <classname>CbcModel</classname> before branch and cut. |
---|
522 | </entry> |
---|
523 | <entry align="left" valign="top"> |
---|
524 | Virtual class. The user instantiates the solver interface of their choice, e.g., |
---|
525 | <classname>OsiClpSolverInterface</classname>. |
---|
526 | </entry> |
---|
527 | </row> |
---|
528 | </tbody> |
---|
529 | </tgroup> |
---|
530 | </table> |
---|
531 | <para> |
---|
532 | There is not much about the classes listed in <xref linkend="least"/> that the average user needs to know about. |
---|
533 | </para> |
---|
534 | <table frame="none" id="least"> |
---|
535 | <title>Classes Used by CbcModel - Least Useful</title> |
---|
536 | <tgroup cols="3"> |
---|
537 | <thead> |
---|
538 | <row> |
---|
539 | <entry> |
---|
540 | Class name |
---|
541 | </entry> |
---|
542 | <entry> |
---|
543 | Description |
---|
544 | </entry> |
---|
545 | <entry> |
---|
546 | Notes |
---|
547 | </entry> |
---|
548 | </row> |
---|
549 | </thead> |
---|
550 | <tbody> |
---|
551 | <row> |
---|
552 | <entry align="left" valign="top"> |
---|
553 | <classname>CbcBranchDecision</classname> |
---|
554 | </entry> |
---|
555 | <entry align="left" valign="top"> |
---|
556 | Used in choosing which variable to branch on, however, most of |
---|
557 | the work is done by the definitions in <classname>CbcObject</classname>. |
---|
558 | </entry> |
---|
559 | <entry align="left" valign="top"> |
---|
560 | Defaults to <classname>CbcBranchDefaultDecision</classname>. |
---|
561 | </entry> |
---|
562 | </row> |
---|
563 | <row> |
---|
564 | <entry align="left" valign="top"> |
---|
565 | <classname>CbcCountRowCut</classname> |
---|
566 | </entry> |
---|
567 | <entry align="left" valign="top"> |
---|
568 | Interface to <classname>OsiRowCut</classname>. It counts the usage so cuts can gracefully vanish. |
---|
569 | </entry> |
---|
570 | <entry align="left" valign="top"> |
---|
571 | See <classname>OsiRowCut</classname> for more details. <!-- Default? --> |
---|
572 | </entry> |
---|
573 | </row> |
---|
574 | <row> |
---|
575 | <entry align="left" valign="top"> |
---|
576 | <classname>CbcNode</classname> |
---|
577 | </entry> |
---|
578 | <entry align="left" valign="top"> |
---|
579 | Controls which variable/entity is selected to be branch on. |
---|
580 | </entry> |
---|
581 | <entry align="left" valign="top"> |
---|
582 | Controlled via <classname>CbcModel</classname> parameters. Information from <classname>CbcNode</classname> can be useful in creating customized node selection rules. <!-- Default? --> |
---|
583 | </entry> |
---|
584 | </row> |
---|
585 | <row> |
---|
586 | <entry align="left" valign="top"> |
---|
587 | <classname>CbcNodeInfo</classname> |
---|
588 | </entry> |
---|
589 | <entry align="left" valign="top"> |
---|
590 | Contains data on bounds, basis, etc. for one node of the search tree. |
---|
591 | </entry> |
---|
592 | <entry align="left" valign="top"> |
---|
593 | Header is located in <filename>CbcNode.hpp</filename>. <!-- Defaults? --> |
---|
594 | </entry> |
---|
595 | </row> |
---|
596 | <row> |
---|
597 | <entry align="left" valign="top"> |
---|
598 | <classname>CbcTree</classname> |
---|
599 | </entry> |
---|
600 | <entry align="left" valign="top"> |
---|
601 | Defines how the search tree is stored. |
---|
602 | </entry> |
---|
603 | <entry align="left" valign="top"> |
---|
604 | This class can be changed but it is not likely to be modified.<!-- Defaults? --> |
---|
605 | </entry> |
---|
606 | </row> |
---|
607 | <row> |
---|
608 | <entry align="left" valign="top"> |
---|
609 | <classname>CoinMessageHandler</classname> |
---|
610 | </entry> |
---|
611 | <entry align="left" valign="top"> |
---|
612 | Deals with message handling |
---|
613 | </entry> |
---|
614 | <entry align="left" valign="top"> |
---|
615 | The user can inherit from <classname>CoinMessageHandler</classname> to specialize message handling. |
---|
616 | <!-- Defaults? --> |
---|
617 | </entry> |
---|
618 | </row> |
---|
619 | <row> |
---|
620 | <entry align="left" valign="top"> |
---|
621 | <classname>CoinWarmStartBasis</classname> |
---|
622 | </entry> |
---|
623 | <entry align="left" valign="top"> |
---|
624 | Basis representation to be used by solver |
---|
625 | </entry> |
---|
626 | <entry align="left" valign="top"> |
---|
627 | <!-- Defaults? --> |
---|
628 | </entry> |
---|
629 | </row> |
---|
630 | </tbody> |
---|
631 | </tgroup> |
---|
632 | </table> |
---|
633 | </section> |
---|
634 | |
---|
635 | </chapter> |
---|