| 1 | /* $Id: CoinPresolvePsdebug.hpp 1372 2011-01-03 23:31:00Z lou $ */ |
| 2 | // Copyright (C) 2002, International Business Machines |
| 3 | // Corporation and others. All Rights Reserved. |
| 4 | // This code is licensed under the terms of the Eclipse Public License (EPL). |
| 5 | |
| 6 | #ifndef CoinPresolvePsdebug_H |
| 7 | #define CoinPresolvePsdebug_H |
| 8 | |
| 9 | /*! \defgroup PresolveDebugFunctions Presolve Debug Functions |
| 10 | |
| 11 | These functions implement consistency checks on data structures |
| 12 | involved in presolve and postsolve and on the components of the lp solution. |
| 13 | |
| 14 | To use these functions, include CoinPresolvePsdebug.hpp in your file and |
| 15 | define the compile-time constants PRESOLVE_SUMMARY, PRESOLVE_DEBUG, and |
| 16 | PRESOLVE_CONSISTENCY (either in individual files or in Coin/Makefile). |
| 17 | A value is needed (<i>i.e.</i>, PRESOLVE_DEBUG=1) but not at present used |
| 18 | to control debug level. Be sure that the definition occurs before any |
| 19 | CoinPresolve*.hpp file is processed. |
| 20 | */ |
| 21 | |
| 22 | //@{ |
| 23 | |
| 24 | /*! \relates CoinPresolveMatrix |
| 25 | \brief Check column-major and/or row-major matrices for duplicate |
| 26 | entries in the major vectors. |
| 27 | |
| 28 | By default, scans both the column- and row-major matrices. Set doCol (doRow) |
| 29 | to false to suppress one or the other. |
| 30 | */ |
| 31 | void presolve_no_dups(const CoinPresolveMatrix *preObj, |
| 32 | bool doCol = true, bool doRow = true) ; |
| 33 | |
| 34 | /*! \relates CoinPresolveMatrix |
| 35 | \brief Check the links which track storage order for major vectors in |
| 36 | the bulk storage area. |
| 37 | |
| 38 | By default, scans only the column-major matrix. Set doCol = false to |
| 39 | suppress the scan. Set doRow = false to scan the row-major links. But be |
| 40 | warned, the row-major links are not maintained with the same zeal as the |
| 41 | column-major links. |
| 42 | */ |
| 43 | void presolve_links_ok(const CoinPresolveMatrix *preObj, |
| 44 | bool doCol = true, bool doRow = false) ; |
| 45 | |
| 46 | /*! \relates CoinPresolveMatrix |
| 47 | \brief Check for explicit zeros in the column- and/or row-major matrices. |
| 48 | |
| 49 | By default, scans both the column- and row-major matrices. Set doCol (doRow) |
| 50 | to false to suppress one or the other. |
| 51 | */ |
| 52 | void presolve_no_zeros(const CoinPresolveMatrix *preObj, |
| 53 | bool doCol = true, bool doRow = true) ; |
| 54 | |
| 55 | /*! \relates CoinPresolveMatrix |
| 56 | \brief Checks for equivalence of the column- and row-major matrices. |
| 57 | |
| 58 | Normally the routine will test for coefficient presence and value. Set |
| 59 | \p chkvals to false to suppress the check for equal value. |
| 60 | */ |
| 61 | void presolve_consistent(const CoinPresolveMatrix *preObj, |
| 62 | bool chkvals = true) ; |
| 63 | |
| 64 | /*! \relates CoinPostsolveMatrix |
| 65 | \brief Checks that column threads agree with column lengths |
| 66 | */ |
| 67 | void presolve_check_threads(const CoinPostsolveMatrix *obj) ; |
| 68 | |
| 69 | /*! \relates CoinPostsolveMatrix |
| 70 | \brief Checks the free list |
| 71 | |
| 72 | Scans the thread of free locations in the bulk store and checks that all |
| 73 | entries are reasonable (0 <= index < bulk0_). If chkElemCnt is true, it |
| 74 | Also checks that the total number of entries in the matrix plus the |
| 75 | locations on the free list total to the size of the bulk store. Postsolve |
| 76 | routines do not maintain an accurate element count, but this is useful |
| 77 | for checking a newly constructed postsolve matrix. |
| 78 | */ |
| 79 | void presolve_check_free_list(const CoinPostsolveMatrix *obj, |
| 80 | bool chkElemCnt = false) ; |
| 81 | |
| 82 | /*! \relates CoinPostsolveMatrix |
| 83 | \brief Check stored reduced costs for accuracy and consistency with |
| 84 | variable status. |
| 85 | |
| 86 | The routine will check the value of the reduced costs for architectural |
| 87 | variables (CoinPrePostsolveMatrix::rcosts_). It performs an accuracy check |
| 88 | by recalculating the reduced cost from scratch. It will also check the |
| 89 | value for consistency with the status information in |
| 90 | CoinPrePostsolveMatrix::colstat_. |
| 91 | */ |
| 92 | void presolve_check_reduced_costs(const CoinPostsolveMatrix *obj) ; |
| 93 | |
| 94 | /*! \relates CoinPostsolveMatrix |
| 95 | \brief Check the dual variables for consistency with row activity. |
| 96 | |
| 97 | The routine checks that the value of the dual variable is consistent |
| 98 | with the state of the constraint (loose, tight at lower bound, or tight at |
| 99 | upper bound). |
| 100 | */ |
| 101 | void presolve_check_duals(const CoinPostsolveMatrix *postObj) ; |
| 102 | |
| 103 | /*! \relates CoinPresolveMatrix |
| 104 | \brief Check primal solution and architectural variable status. |
| 105 | |
| 106 | The architectural variables can be checked for bogus values, feasibility, |
| 107 | and valid status. The row activity is checked for bogus values, accuracy, |
| 108 | and feasibility. By default, row activity is not checked (presolve is |
| 109 | sloppy about maintaining it). See the definitions in |
| 110 | CoinPresolvePsdebug.cpp for more information. |
| 111 | */ |
| 112 | void presolve_check_sol(const CoinPresolveMatrix *preObj, |
| 113 | int chkColSol = 2, int chkRowAct = 1, |
| 114 | int chkStatus = 1) ; |
| 115 | |
| 116 | /*! \relates CoinPostsolveMatrix |
| 117 | \brief Check primal solution and architectural variable status. |
| 118 | |
| 119 | The architectural variables can be checked for bogus values, feasibility, |
| 120 | and valid status. The row activity is checked for bogus values, accuracy, |
| 121 | and feasibility. See the definitions in CoinPresolvePsdebug.cpp for more |
| 122 | information. |
| 123 | */ |
| 124 | void presolve_check_sol(const CoinPostsolveMatrix *postObj, |
| 125 | int chkColSol = 2, int chkRowAct = 2, |
| 126 | int chkStatus = 1) ; |
| 127 | |
| 128 | /*! \relates CoinPresolveMatrix |
| 129 | \brief Check for the proper number of basic variables. |
| 130 | */ |
| 131 | void presolve_check_nbasic(const CoinPresolveMatrix *preObj) ; |
| 132 | |
| 133 | /*! \relates CoinPostsolveMatrix |
| 134 | \brief Check for the proper number of basic variables. |
| 135 | */ |
| 136 | void presolve_check_nbasic(const CoinPostsolveMatrix *postObj) ; |
| 137 | |
| 138 | //@} |
| 139 | |
| 140 | #endif |
| 141 | |