Changeset 416


Ignore:
Timestamp:
Sep 1, 2004 4:06:04 PM (16 years ago)
Author:
ddelanu
Message:

Edited a bunch of stuff, including presolve example (new one from JF in place)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Docs/basicmodelclasses.xml

    r412 r416  
    308308  There are set and get methods for tolerances, for example,
    309309  <function>double&nbsp;primalTolerance()</function> and
    310   <function>setPrimalTolerance(double)</function>.  An individual variable is
    311   deemed primal feasible if it is less than the tolerance referred to by these
    312   methods below its lower bound and less than it above its upper bound.
    313   Similarly for dual tolerances, a variable is deemed to be dual feasible if its
    314   reduced cost is greater than minus the tolerance or its distance to the upper
    315   bound is less than primal tolerance and the reduced cost is less than plus the
    316   tolerance or the distance to lower bound is less than primal tolerance.  This
    317   is just complementarity conditions adadpted for tolerances and simple lower and
    318   upper bounds.(Note that the above was stated as for minimization - signs are
    319   reversed for maximization.)
     310  <function>setPrimalTolerance(double)</function>.  Assuming that one has a
     311  minimization problem, an individual variable is deemed primal feasible if it
     312  is less than the tolerance referred to by these methods below its lower bound
     313  and less than it above its upper bound.  Similarly for dual tolerances, a
     314  variable is deemed to be dual feasible if its reduced cost is greater than
     315  minus the tolerance or its distance to the upper bound is less than primal
     316  tolerance and the reduced cost is less than plus the tolerance or the distance
     317  to lower bound is less than primal tolerance.  In short, this is complementarity
     318  conditions adadpted for tolerances and simple lower and upper bounds.(Note
     319  that the above was stated as for minimization; signs are reversed for
     320  maximization.)
    320321  </para>
    321322  </section>
     
    323324  <title>Some Useful Set and Get Methods</title>
    324325  <table frame="none">
    325   <title>Some Useful Sets and Gets</title>
     326  <title>Some Useful Set and Get Methods</title>
    326327    <tgroup cols="2">
    327328    <thead>
     
    405406    <row>
    406407      <entry align="left" valign="top">
    407       <function>CoinBigIndex getNumElements()</function>
     408      <function>CoinBigIndex&nbsp;getNumElements()</function>
     409      <footnote>
     410        <para>
     411        <type>CoinBigIndex</type> is a <function>typedef</function> which in
     412        most cases is the same as <type>int</type>.
     413        </para>
     414      </footnote>
    408415      </entry>
    409416      <entry align="left" valign="top">
     
    488495      </entry>
    489496      <entry align="left" valign="top">
    490       This method attemps to improve on an all slack basis and remains a work
    491       in progress.  For dual this will move variables to the dual feasible bound
     497      This method attemps to improve on an all slack basis.
     498      For dual this will move variables to the dual feasible bound
    492499      if the gap between bounds is less than <parameter>gap</parameter>.  Setting
    493500      <parameter>mode</parameter> to 0 guesses which algorithm is better, while
     
    566573  <para>
    567574  The header file for the use of CLP's presolve functionality is
    568   <filename>COIN/Clp/include/Presolve.hpp</filename>.  The code fragment below
     575  <filename>COIN/Clp/include/Presolve.hpp</filename>.  The sample program below
    569576  illustrates some of the possibilities offered by CLP's presolve:
    570577  </para>
     
    572579  <title>Presolve code fragment</title>
    573580  <programlisting>
    574     #include "Presolve.hpp"
    575    
    576     ...
    577 
    578     ClpSimplex model; // initialized by readMps or some other method
    579    
    580     ...
    581 
    582     Presolve presolveInfo;
    583     ClpSimplex * presolvedModel = presolveInfo(model);
    584     // at this point we have original model and a new model.  The information
    585     // on the operations done is in presolveInfo
    586     if (presolvedModel) {
    587       // was not found to be infeasible - so lets solve
    588       // if presolvedModel was NULL then it was primal infeasible and ...
    589       presolvedModel->dual(); // or whatever else we wish to do
    590       presolveInfo.postsolve(true);  // the true updates status arrays in original
    591       /* If the presolved model was optimal then so should the original be.
    592          We can use checkSolution and test feasibility */
    593     model.checkSolution();     
    594     if (model.numberDualInfeasibilities()||
    595       model.numberPrimalInfeasibilities()) {
    596       printf("%g dual %g(%d) Primal %g(%d)\n",
    597          model.objectiveValue(),
    598           model.sumDualInfeasibilities(),
    599           model.numberDualInfeasibilities(),
    600           model.sumPrimalInfeasibilities(),
    601           model.numberPrimalInfeasibilities());
    602       // Due to tolerances we can not guarantee that so you may wish to throw in
    603       model.primal(1);
    604     }
     581#include "ClpSimplex.hpp"
     582#include "ClpPresolve.hpp"
     583int main (int argc, const char *argv[])
     584{
     585  ClpSimplex model;
     586  model.readMps("../../Mps/Sample/p0033.mps"); // initialized by readMps or whatever
     587  ClpPresolve presolveInfo;
     588  ClpSimplex * presolvedModel = presolveInfo.presolvedModel(model);
     589  // at this point we have original model and a new model.  The  information
     590  // on the operations done is in presolveInfo
     591  if (presolvedModel) {
     592    // was not found to be infeasible - so lets solve
     593    // if presolvedModel was NULL then it was primal infeasible and ...
     594    presolvedModel->dual(); // or whatever else we wish to do
     595    presolveInfo.postsolve(true);  // the true updates status arrays in original       
     596    /* If the presolved model was optimal then so should the
     597       original be.           
     598       We can use checkSolution and test feasibility */
     599    model.checkSolution();         
     600    if (model.numberDualInfeasibilities()||
     601        model.numberPrimalInfeasibilities())
     602      printf("%g dual %g(%d) Primal %g(%d)\n",
     603             model.objectiveValue(),
     604             model.sumDualInfeasibilities(),
     605             model.numberDualInfeasibilities(),
     606             model.sumPrimalInfeasibilities(),
     607             model.numberPrimalInfeasibilities());
     608    // Due to tolerances we can not guarantee that so you may wish to throw in
     609    model.primal(1);
     610  }
     611}   
    605612  </programlisting>
    606613  </example>
     
    637644        <row>
    638645          <entry align="left" valign="top">
    639           <constant>isFree</constant>
    640           </entry>
    641           <entry align="left" valign="top">
    642           Not in basis, has infinite bounds
     646          <constant>basic</constant>
     647          </entry>
     648          <entry align="left" valign="top">
     649          In basis
    643650          </entry>
    644651        </row>
    645652        <row>
    646653          <entry align="left" valign="top">
    647           <constant>basic</constant>
    648           </entry>
    649           <entry align="left" valign="top">
    650           In basis
     654          <constant>isFree</constant>
     655          </entry>
     656          <entry align="left" valign="top">
     657          Not in basis, has infinite bounds
    651658          </entry>
    652659        </row>
    653660        <row>
    654661          <entry align="left" valign="top">
    655           <constant>atUpperBound</constant>
    656           </entry>
    657           <entry align="left" valign="top">
    658           At upper bound
     662          <constant>isFixed</constant>
     663          </entry>
     664          <entry align="left" valign="top">
     665          Not in basis, bounds are equal
    659666          </entry>
    660667        </row>
    661668        <row>
    662669          <entry align="left" valign="top">
    663           <constant>atLowerBound</constant>
    664           </entry>
    665           <entry align="left" valign="top">
    666           At lower bound
     670          <constant>atUpperBound</constant>
     671          </entry>
     672          <entry align="left" valign="top">
     673          At upper bound, not in basis
    667674          </entry>
    668675        </row>
    669676        <row>
    670677          <entry align="left" valign="top">
    671           <constant>superBasic</constant>
    672           </entry>
    673           <entry align="left" valign="top">
    674           Between bounds, but not basic or free
     678          <constant>atLowerBound</constant>
     679          </entry>
     680          <entry align="left" valign="top">
     681          At lower bound, not in basis
    675682          </entry>
    676683        </row>
    677684        <row>
    678685          <entry align="left" valign="top">
    679           <constant>isFixed</constant>
    680           </entry>
    681           <entry align="left" valign="top">
    682           Not in basis, bounds are equal
     686          <constant>superBasic</constant>
     687          </entry>
     688          <entry align="left" valign="top">
     689          Between bounds, but not basic or free
    683690          </entry>
    684691        </row>
Note: See TracChangeset for help on using the changeset viewer.