Changeset 1391 for branches


Ignore:
Timestamp:
Dec 10, 2009 3:53:52 PM (9 years ago)
Author:
lou
Message:

Add comments for callCbc, callCbc1 shells.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/Cbc/src/CbcSolver.cpp

    r1390 r1391  
    796796#endif
    797797
     798/*
     799  Global parameters for command processing.
     800
     801  These will need to be moved into an object of some sort in order to make
     802  this set of calls thread-safe.
     803*/
     804
    798805int CbcOrClpRead_mode = 1;
    799806FILE * CbcOrClpReadCommand = stdin;
     
    802809
    803810#ifndef CBC_OTHER_SOLVER
    804 static int * analyze(OsiClpSolverInterface * solverMod, int & numberChanged, double & increment,
    805                      bool changeInt,  CoinMessageHandler * generalMessageHandler)
     811/*
     812  Look to see if a constraint is all-integer (variables & coeffs), or could be
     813  all integer. Consider whether one or two continuous variables can be declared
     814  integer. John's comment is that integer preprocessing might do a better job,
     815  so we should consider whether this routine should stay.
     816
     817  No hurry to get rid of it, in my opinion  -- lh, 091210 --
     818*/
     819static int * analyze(OsiClpSolverInterface * solverMod, int & numberChanged,
     820                     double & increment, bool changeInt,
     821                     CoinMessageHandler * generalMessageHandler)
    806822{
    807823    bool noPrinting_ = noPrinting;
     
    11081124/*  Returns OsiSolverInterface (User should delete)
    11091125    On entry numberKnapsack is maximum number of Total entries
     1126
     1127    Expanding possibilities of x*y, where x*y are both integers, constructing
     1128    a knapsack constraint. Results in a tighter model.
    11101129*/
    11111130static OsiSolverInterface *
     
    16081627/*
    16091628  Debug checks on special ordered sets.
     1629
     1630  This is active only for debugging. The entire body of the routine becomes
     1631  a noop when COIN_DEVELOP is not defined. To avoid compiler warnings, the
     1632  formal parameters also need to go away.
    16101633*/
    16111634#ifdef COIN_DEVELOP
     
    17121735    return 0;
    17131736}
    1714 
    17151737/*
    1716   Various overloads of callCbc1, in rough order, followed by the main definition.
     1738  Wrappers for CbcMain0, CbcMain1. The various forms of callCbc will eventually
     1739  resolve to a call to CbcMain0 followed by a call to callCbc1.
     1740*/
     1741/*
     1742  Simplest calling form: supply just a string with the command options. The
     1743  wrapper creates an OsiClpSolverInterface and calls the next wrapper.
     1744*/
     1745int callCbc(const std::string input2)
     1746{
     1747    char * input3 = CoinStrdup(input2.c_str());
     1748    OsiClpSolverInterface solver1;
     1749    int returnCode = callCbc(input3, solver1);
     1750    free(input3);
     1751    return returnCode;
     1752}
     1753
     1754int callCbc(const char * input2)
     1755{
     1756    {
     1757        OsiClpSolverInterface solver1;
     1758        return callCbc(input2, solver1);
     1759    }
     1760}
     1761
     1762/*
     1763  Second calling form: supply the command line and an OsiClpSolverInterface.
     1764  the wrapper will create a CbcModel and call the next wrapper.
     1765*/
     1766
     1767int callCbc(const std::string input2, OsiClpSolverInterface& solver1)
     1768{
     1769    char * input3 = CoinStrdup(input2.c_str());
     1770    int returnCode = callCbc(input3, solver1);
     1771    free(input3);
     1772    return returnCode;
     1773}
     1774
     1775int callCbc(const char * input2, OsiClpSolverInterface& solver1)
     1776{
     1777    CbcModel model(solver1);
     1778    return callCbc(input2, model);
     1779}
     1780
     1781/*
     1782  Third calling form: supply the command line and a CbcModel. This wrapper will
     1783  actually call CbcMain0 and then call the next set of wrappers (callCbc1) to
     1784  handle the call to CbcMain1.
     1785*/
     1786int callCbc(const char * input2, CbcModel & babSolver)
     1787{
     1788    CbcMain0(babSolver);
     1789    return callCbc1(input2, babSolver);
     1790}
     1791
     1792int callCbc(const std::string input2, CbcModel & babSolver)
     1793{
     1794    char * input3 = CoinStrdup(input2.c_str());
     1795    CbcMain0(babSolver);
     1796    int returnCode = callCbc1(input3, babSolver);
     1797    free(input3);
     1798    return returnCode;
     1799}
     1800
     1801
     1802/*
     1803  Various overloads of callCbc1. The first pair accepts just a CbcModel and
     1804  supplements it with a dummy callback routine. The second pair allows the
     1805  user to supply a callback. See CbcMain1 for further explanation of the
     1806  callback. The various overloads of callCbc1 resolve to the final version,
     1807  which breaks the string into individual parameter strings (i.e., creates
     1808  something that looks like a standard argv vector).
    17171809*/
    17181810
     
    17301822}
    17311823
    1732 int callCbc1(const std::string input2, CbcModel & babSolver, int callBack(CbcModel * currentSolver, int whereFrom))
     1824int callCbc1(const std::string input2, CbcModel & babSolver,
     1825             int callBack(CbcModel * currentSolver, int whereFrom))
    17331826{
    17341827    char * input3 = CoinStrdup(input2.c_str());
     
    17381831}
    17391832
    1740 int callCbc1(const char * input2, CbcModel & model, int callBack(CbcModel * currentSolver, int whereFrom))
     1833int callCbc1(const char * input2, CbcModel & model,
     1834             int callBack(CbcModel * currentSolver, int whereFrom))
    17411835{
    17421836    char * input = CoinStrdup(input2);
     
    17891883    CbcOrClpReadCommand = stdin;
    17901884    noPrinting = false;
    1791     int returnCode = CbcMain1(n + 2, const_cast<const char **>(argv), model, callBack);
     1885    int returnCode = CbcMain1(n + 2, const_cast<const char **>(argv),
     1886                              model, callBack);
    17921887    for (int k = 0; k < n + 2; k++)
    17931888        free(argv[k]);
     
    17961891}
    17971892
    1798 
    1799 int callCbc(const char * input2, CbcModel & babSolver)
    1800 {
    1801     CbcMain0(babSolver);
    1802     return callCbc1(input2, babSolver);
    1803 }
    1804 
    1805 int callCbc(const std::string input2, CbcModel & babSolver)
    1806 {
    1807     char * input3 = CoinStrdup(input2.c_str());
    1808     CbcMain0(babSolver);
    1809     int returnCode = callCbc1(input3, babSolver);
    1810     free(input3);
    1811     return returnCode;
    1812 }
    1813 
    1814 int callCbc(const char * input2, OsiClpSolverInterface& solver1)
    1815 {
    1816     CbcModel model(solver1);
    1817     return callCbc(input2, model);
    1818 }
    1819 
    1820 int callCbc(const char * input2)
    1821 {
    1822     {
    1823         OsiClpSolverInterface solver1;
    1824         return callCbc(input2, solver1);
    1825     }
    1826 }
    1827 
    1828 int callCbc(const std::string input2, OsiClpSolverInterface& solver1)
    1829 {
    1830     char * input3 = CoinStrdup(input2.c_str());
    1831     int returnCode = callCbc(input3, solver1);
    1832     free(input3);
    1833     return returnCode;
    1834 }
    1835 
    1836 int callCbc(const std::string input2)
    1837 {
    1838     char * input3 = CoinStrdup(input2.c_str());
    1839     OsiClpSolverInterface solver1;
    1840     int returnCode = callCbc(input3, solver1);
    1841     free(input3);
    1842     return returnCode;
    1843 }
    1844 
    18451893#define CBCMAXPARAMETERS 200
    18461894static CbcOrClpParam parameters[CBCMAXPARAMETERS];
     
    18581906
    18591907
    1860 /* Meaning of whereFrom:
    1861    1 after initial solve by dualsimplex etc
    1862    2 after preprocessing
    1863    3 just before branchAndBound (so user can override)
    1864    4 just after branchAndBound (before postprocessing)
    1865    5 after postprocessing
    1866    6 after a user called heuristic phase
     1908/*
     1909  Meaning of whereFrom:
     1910    1 after initial solve by dualsimplex etc
     1911    2 after preprocessing
     1912    3 just before branchAndBound (so user can override)
     1913    4 just after branchAndBound (before postprocessing)
     1914    5 after postprocessing
     1915    6 after a user called heuristic phase
    18671916*/
    18681917
Note: See TracChangeset for help on using the changeset viewer.