Ignore:
Timestamp:
May 10, 2005 11:40:19 AM (15 years ago)
Author:
rlh
Message:

updated the user guide

File:
1 edited

Legend:

Unmodified
Added
Removed
  • html/trunk/Cbc/ch02s03.html

    r554 r557  
    1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>
    2   Getting at the Solution (CbcModel methods)
    3   </title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="index.html" title="CBC User Guide"><link rel="up" href="ch02.html" title="Chapter 2. 
    4   Basic Model Classes
    5   "><link rel="previous" href="ch02s02.html" title="
    6   First Example
    7   "><link rel="next" href="ch02s04.html" title="Some Useful Set and Get Methods"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
    8   Getting at the Solution (CbcModel methods)
    9   </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
    10   Basic Model Classes
    11   </th><td width="20%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="gettingsolution"></a>
    12   Getting at the Solution (CbcModel methods)
    13   </h2></div></div><div></div></div><p>
    14   The OSI way to check for optimality is to call model.isProvenOptimal().  Also
    15   available are <tt class="function">isProvenInfeasible()</tt>,
    16   <tt class="function">isSolutionLimitReached()</tt>,
    17   <tt class="function">isNodeLimitReached()</tt> or the feared
    18   <tt class="function">isAbandoned()</tt>. You can also pick up
    19   <tt class="function">int status()</tt> which returns 0 if finished,
    20    1 if stopped by user and 2 if difficulties. (status of 0 even if proved
    21    infeasible)
    22   </p><p>
    23   Similarly, we can pick up the solution values.  The OSI methods pick up
    24   the current solution.  This will match the best solution found so far if
    25   called after branchAndBound and if a solution was found.
    26   </p><div class="table"><a name="id2898257"></a><p class="title"><b>Table 2.3. 
    27   Methods for getting solution information from OSI solver
    28   </b></p><table summary="
    29   Methods for getting solution information from OSI solver
    30   " border="0"><colgroup><col><col></colgroup><thead><tr><th>
    31       Purpose
    32       </th><th>
    33       Name
    34       </th><th>
    35       Notes
    36       </th></tr></thead><tbody><tr><td align="left" valign="top">
    37       Primal column solution
    38       </td><td align="left" valign="top"><tt class="function">const double * getColSolution()</tt></td><td align="left" valign="top">
    39       Outside CBC will be best solution unless none found.  Safer to use
    40       CbcModel::bestSolution()
    41       </td></tr><tr><td align="left" valign="top">
    42       Dual row solution
    43       </td><td align="left" valign="top"><tt class="function">const double * getRowPrice()</tt></td><td align="left" valign="top">
    44       CbcModel:: version available and identical
    45       </td></tr><tr><td align="left" valign="top">
    46       Primal row solution
    47       </td><td align="left" valign="top"><tt class="function">const double * getRowActivity()</tt></td><td align="left" valign="top">
    48       CbcModel:: version available and identical
    49       </td></tr><tr><td align="left" valign="top">
    50       Dual column solution
    51       </td><td align="left" valign="top"><tt class="function">const double * getReducedCost()</tt></td><td align="left" valign="top"> </td></tr><tr><td align="left" valign="top">
    52       Number of rows in model
    53       </td><td align="left" valign="top"><tt class="function">int getNumRows()</tt></td><td align="left" valign="top">
    54       CbcModel:: version available and identical
    55       (but note that number of rows may change due to cuts)
    56       </td></tr><tr><td align="left" valign="top">
    57       Number of columns in model
    58       </td><td align="left" valign="top"><tt class="function">int getNumCols()</tt></td><td align="left" valign="top">
    59       CbcModel:: version available and identical
    60       </td></tr></tbody></table></div><p>
    61   The remainder of this chapter will show  more of the basic CBC tasks a user
    62   might wish to perform.
    63   </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
    64   First Example
    65    </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Some Useful Set and Get Methods</td></tr></table></div></body></html>
     1<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
     2<html xmlns="http://www.w3.org/1999/xhtml"><head><title>
     3The Relationship Between OSI and CBC
     4</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"/><link rel="home" href="index.html" title="CBC User Guide"/><link rel="up" href="ch02.html" title="Chapter 2. &#10;   The CBC Model Class&#10;  "/><link rel="previous" href="ch02s02.html" title="&#10;  Simple Branch-and-Bound Example&#10;  "/><link rel="next" href="ch02s04.html" title="&#10;  Getting Solution Information&#10;  "/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
     5The Relationship Between OSI and CBC
     6</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
     7   The CBC Model Class
     8  </th><td width="20%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr></table><hr/></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="osiAndCbc"/>
     9The Relationship Between OSI and CBC
     10</h2></div></div><div/></div><p>
     11The program in <a href="ch02s02.html#minimum.cpp" title="Example 2.1. minimum.cpp">Example 2.1</a> illustrates the dependency of CBC on 
     12  the <tt class="classname">OsiSolverInterface</tt> class. The constructor of <tt class="classname">CbcModel</tt> takes a pointer to an <tt class="classname">OsiSolverInterface</tt> (i.e., a solver). The <tt class="classname">CbcModel</tt> clones the solver, and uses its own instance of the solver. The <tt class="classname">CbcModel</tt>'s solver and the original solver (e.g., <tt class="varname">solver1</tt>) are not in sync unless the user synchronizes them. The user can always access the <tt class="classname">CbcModel</tt>'s solver through the <tt class="function">model()</tt> class.  To synchronize the two solvers, explicitly refreshing the original, e.g., 
     13 </p><pre class="programlisting">
     14  solver1 = model.solver();
     15</pre><p>
     16<tt class="classname">CbcModel</tt>'s method <tt class="function">solver()</tt> returns a pointer to CBC's cloned solver.
     17</p><p>
     18For convenience, many of the OSI methods to access problem data have identical method names in  <tt class="classname">CbcModel</tt>. (It's just more convenient to type <tt class="function">model.getNumCols()</tt> rather than <tt class="function">model.solver()-&gt;getNumCols()</tt>). The <tt class="classname">CbcModel</tt> refreshes its solver at certain logical points during the algorithm. At these points, the information from the <tt class="classname">CbcModel</tt> <tt class="varname">model</tt> will match the information from the <tt class="function">model.solver()</tt>. Elsewhere, the information may vary. For instance, the method <tt class="function">CbcModel::bestSolution()</tt> will contain the best solution so far, the OSI method <tt class="function">getColSolution()</tt> may not. In this case, it is safer to use <tt class="function">CbcModel::bestSolution()</tt>.
     19</p><p>
     20While all the OSI methods used in <tt class="filename">minimum.cpp</tt> have equivalent methods in <tt class="classname">CbcModel</tt>, there are some OSI methods which do not. For example, if  the program produced a lot of undesired output, one might add the line
     21</p><pre class="programlisting">
     22  model.solver()-&gt;setHintParam(OsiDoReducePrint,true,OsiHintTry);
     23</pre><p>
     24 
     25  to reduce the output. There is no <tt class="function">setHintParam()</tt> method in <tt class="classname">CbcModel</tt>.
     26  </p></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
     27  Simple Branch-and-Bound Example
     28   </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
     29  Getting Solution Information
     30  </td></tr></table></div></body></html>
Note: See TracChangeset for help on using the changeset viewer.