Changeset 2417


Ignore:
Timestamp:
Mar 6, 2019 7:59:36 PM (8 months ago)
Author:
stefan
Message:

formatting of moresamples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gh-pages/moresamples.md

    r2416 r2417  
    11# More Samples
    22
    3 # CLP’s Samples Directory
     3# CLP's Samples Directory
    44
    55The CLP dsitribution includes a number of `.cpp` sample files. Users are
    66encouraged to use them as starting points for their own CLP projects.
    7 The files can be found in the \``directory. For the latest information
     7The files can be found in the `examples` directory. For the latest information
    88on compiling and running these samples, please see the
    9 file`CLPSAMPLESDIRINSTALL\`. Below is a list of some of the most useful
    10 sample files with a short description for each
    11 file.
     9file `INSTALL` in the `examples` directory. Below is a list of some of the most useful
     10sample files with a short description for each file.
     11
     12Basic Samples:
    1213
    1314| Source file    | Description                                                                                                                                                                                                                                   |
    1415| :------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    15 | MINIMUMCPP     | This is a CLP “Hello, world” program. It reads a problem from an MPS file, and solves the problem. \[[More...](#minimumcppdesc)\]                                                                                                             |
    16 | DEFAULTSCPP    | This is one of the simpler driver programs available. It sets tolerances to defaults and is a good place to find straightforward uses of “set” and “get” methods. It also prints out full MPS-like solutions. \[[More...](#defaultscppdesc)\] |
    17 | DRIVERCPP      | This is designed to be a file that a user could modify to get a useful driver program for his or her project. In particular, it demonstrates the use of CLP’s presolve functionality. \[[More...](#drivercppdesc)\]                           |
    18 | NETWORKCPP     | This shows the use of non-standard matrices and how to load a problem without the use of MPS files. \[[More...](#networkcppdesc)\]                                                                                                            |
    19 | TESTBARRIERCPP | This is a basic driver file for the barrier method of CLP, similar to MINIMUMCPP. The barrier method is not currently addressed in this guide. \[[More...](#testbarriercppdesc)\]                                                             |
     16| MINIMUMCPP     | This is a CLP "Hello, world" program. It reads a problem from an MPS file, and solves the problem.                                                                                                             |
     17| DEFAULTSCPP    | This is one of the simpler driver programs available. It sets tolerances to defaults and is a good place to find straightforward uses of "set" and "get" methods. It also prints out full MPS-like solutions. |
     18| DRIVERCPP      | This is designed to be a file that a user could modify to get a useful driver program for his or her project. In particular, it demonstrates the use of CLP's presolve functionality.                            |
     19| NETWORKCPP     | This shows the use of non-standard matrices and how to load a problem without the use of MPS files.                                                                                                             |
     20| TESTBARRIERCPP | This is a basic driver file for the barrier method of CLP, similar to MINIMUMCPP. The barrier method is not currently addressed in this guide.                                                             |
    2021
    21 Basic
    22 Samples
     22Advanced Samples:
    2323
    2424| Source file  | Description                                                                                                                                                                                                                                                                                                                    |
     
    2727| DUALCUTSCPP  | This sample implements a method of treating a problem as a collection of cuts.                                                                                                                                                                                                                                                 |
    2828| DECOMPOSECPP | This does full Dantzig-Wolfe decomposition. It illustrates the use of many models, adding columns, et cetera.                                                                                                                                                                                                                  |
    29 | SPRINTCPP    | This solves a long, thin problem by solving smaller subsets. It is a simplified version of work done by one of the authors on aircrew scheduling problems. It shows the use of two models and their synchronization. A more general version can be found in `COIN/Clp/ClpSolve.cpp`                                            |
     29| SPRINTCPP    | This solves a long, thin problem by solving smaller subsets. It is a simplified version of work done by one of the authors on aircrew scheduling problems. It shows the use of two models and their synchronization. A more general version can be found in `ClpSolve.cpp`                                            |
    3030| SPRINT2CPP   | This is similar to `sprint.cpp` but is designed for solving large problems with little choice. The idea is that if relatively few variables are fixed, presolve can greatly reduce the problem size so that a series of solves can get close to the optimal solution much faster than would a naïve solve of the full problem. |
    31 
    32 Advanced Samples
    3331
    3432The remaining Samples listed here are considered unsupported in that
    3533they are of a more esoteric nature and are sometimes contributed as a
    36 result of an individual’s request. The are to be found in
    37 `CLPSAMPLESDIRContributed`.
     34result of an individual's request.
    3835
    3936| Source file  | Description                                                                                                                                                                                                                         |
    4037| :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    4138| TESTBASISCPP | This sample takes a problem, changes any inequality constraints to equality constraints, solves the problem, and creates the optimal basis.                                                                                         |
    42 | TESTGUBCPP   | This sample illustrates the use of the GUB (“Generalized Upper Bound”) technique.                                                                                                                                                   |
     39| TESTGUBCPP   | This sample illustrates the use of the GUB ("Generalized Upper Bound") technique.                                                                                                                                                   |
    4340| EKKCPP       | This sample can be used to compare CLP and OSL. It uses an additional file in the Samples directory, `ekk_interface.cpp`. These sample files are not likely to be interesting to new CLP users who do not have experience with OSL. |
    44 | HELLOCPP     | This sample creates a text-based picture of a matrix on screen (limited to an 80x80 matrix). It’s not terribly useful but it does illustrate one way to step through the elements of a matrix.                                      |
     41| HELLOCPP     | This sample creates a text-based picture of a matrix on screen (limited to an 80x80 matrix). It's not terribly useful but it does illustrate one way to step through the elements of a matrix.                                      |
    4542| PIECECPP     | This sample takes a matrix read in by `CoinMpsIo` (can be used to read in MPS files without a solver), deletes every second column and solves the resulting problem.                                                                |
    4643| USEVOLUMECPP | The Volume Algorithm is another solver available as part of the COIN-OR distribution. This sample shows how to use the Volume Algorithm with CLP.                                                                                   |
    4744
    48 Unsupported Samples
    49 
    5045## minimum.cpp
    5146
    52 This sample is examined in more detail in [???](#firstexample).
     47This sample is examined in more detail as first example [here](./basicmodelclasses).
    5348
    5449## defaults.cpp
    5550
    5651This sample begins by reading an MPS file. The default MPS file is
    57 `COIN/Mps/Sample/p0033.mps`; this can be over-riden by a command-line
     52`COIN/Netlib/Sample/p0033.mps`; this can be over-riden by a command-line
    5853specification of a (path and) file name). The sample then sets the pivot
    59 algorithm to be exact devex. It “gets” the default infeasibility cost
    60 and “sets” it to that value (and prints it to standard out). This sort
     54algorithm to be exact devex. It "gets" the default infeasibility cost
     55and "sets" it to that value (and prints it to standard out). This sort
    6156of getting and setting of various parameters constitutes a common theme
    6257in this sample, with the purpose of illustrating usage of some of the
     
    7166Next, a copy of the original model is made. More sets and gets are
    7267performed to demonstrate the use of additional options (including the
    73 setting of the default message handling as well as changing of the “log
    74 level” (amount of output)). The model is solved again a number of times
     68setting of the default message handling as well as changing of the "log
     69level" (amount of output)). The model is solved again a number of times
    7570between changes of the optimization direction (i.e. changing from min to
    7671max or vice versa). The remaining lines of this sample serve to display
     
    8176
    8277This sample begins by reading an MPS file. The default MPS file is
    83 `COIN/Mps/Sample/p0033.mps`; this can be over-riden by a command-line
     78`COIN/Data/Sample/p0033.mps`; this can be over-riden by a command-line
    8479specification of a (path and) file name). A second command-line argument
    85 can specify that either the “primal” or “dual” method (or even the
    86 â€œbarrier”, see below) should be used by CLP.
     80can specify that either the "primal" or "dual" method (or even the
     81"barrier", see below) should be used by CLP.
    8782
    8883Once the problem has been read, there are two options for how to solve
     
    10499This handy sample reads a network problem generated by
    105100[netgen](http://www.netlib.org/lp/generators/netgen), converts it to an
    106 LP using CLP’s network matrix type, and solves. This entirely avoids the
     101LP using CLP's network matrix type, and solves. This entirely avoids the
    107102use of an MPS file, as the LP is built in memory from the network data
    108103file created by netgen. Also, the factorization frequency is changed,
     
    122117inequalities are considered to be part of a pool of available cuts in
    123118much the same way as is done in integer programming. However, in this
    124 case, the cuts are not “generated”, they are simply the inequalities of
     119case, the cuts are not "generated", they are simply the inequalities of
    125120the problem.
    126121
    127122## decompose.cpp
    128123
    129 More on this sample coming soon\!
     124More on this sample coming soon!
    130125
    131126## driver2.cpp
    132127
    133 More on this sample coming soon\!
     128More on this sample coming soon!
    134129
    135130# Common CLP Tasks in the Samples
     
    137132Below is a listing of a number of common CLP tasks, such as loading a
    138133problem from an MPS file, matched with a list of each Sample file which
    139 illustrates the performance of a given
    140 task.
     134illustrates the performance of a given task.
    141135
    142136| CLP Task(s)                                 | Method(s)                                                                                                                                                                                                                                                                                        | Sample(s)                          |
     
    146140| Choose pivot rule                           | `void setPrimalColumnPivotAlgorithm(ClpPrimalColumnPivot &choice)` `void setDualRowPivotAlgorithm(ClpDualRowPivot &choice)`                                                                                                                                                                      | DEFAULTSCPP                        |
    147141| Get/set infeasibility cost                  | `void setInfeasibilityCost(double value)` `void setInfeasibilityCost(double value)`                                                                                                                                                                                                              | DEFAULTSCPP                        |
    148 | Get string/“double”/integer information \`b | ool getStrParam(ClpStrParam key, std::string \&value) const`  `bool getDblParam(ClpDblParam key, double \&value) const`  `bool getIntParam (ClpIntParam key, int \&value) const \` DE                                                                                                            | FAULTSCPP                          |
     142| Get string/"double"/integer information \`b | ool getStrParam(ClpStrParam key, std::string \&value) const`  `bool getDblParam(ClpDblParam key, double \&value) const`  `bool getIntParam (ClpIntParam key, int \&value) const \` DE                                                                                                            | FAULTSCPP                          |
    149143| Set maximum number of iterations            | `void setMaximumIterations(int value)`                                                                                                                                                                                                                                                           | DEFAULTSCPP                        |
    150 | Check solution status                       | `int status() const` `bool isAbandoned() const` `bool isProvenOptimal() const` `bool isProvenPrimalInfeasible() const` `bool isProvenDualInfeasible() const` `bool isPrimalObjectiveLimitReached() const` `bool isDualObjectiveLimitReached() const` `bool isIterationLimitReached() const` `  ` |                                    |
    151 
    152 Contents of the Samples directory
     144| Check solution status                       | `int status() const` `bool isAbandoned() const` `bool isProvenOptimal() const` `bool isProvenPrimalInfeasible() const` `bool isProvenDualInfeasible() const` `bool isPrimalObjectiveLimitReached() const` `bool isDualObjectiveLimitReached() const` `bool isIterationLimitReached() const`      |                                    |
Note: See TracChangeset for help on using the changeset viewer.