| 1 | /* $Id: CoinPresolveForcing.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 CoinPresolveForcing_H |
| 7 | #define CoinPresolveForcing_H |
| 8 | |
| 9 | #include "CoinPresolveMatrix.hpp" |
| 10 | |
| 11 | /*! |
| 12 | \file |
| 13 | */ |
| 14 | |
| 15 | #define IMPLIED_BOUND 7 |
| 16 | |
| 17 | /*! \class forcing_constraint_action |
| 18 | \brief Detect and process forcing constraints and useless constraints |
| 19 | |
| 20 | A constraint is useless if the bounds on the variables prevent the constraint |
| 21 | from ever being violated. |
| 22 | |
| 23 | A constraint is a forcing constraint if the bounds on the constraint force |
| 24 | the value of an involved variable to one of its bounds. A constraint can |
| 25 | force more than one variable. |
| 26 | */ |
| 27 | class forcing_constraint_action : public CoinPresolveAction { |
| 28 | forcing_constraint_action(); |
| 29 | forcing_constraint_action(const forcing_constraint_action& rhs); |
| 30 | forcing_constraint_action& operator=(const forcing_constraint_action& rhs); |
| 31 | public: |
| 32 | struct action { |
| 33 | const int *rowcols; |
| 34 | const double *bounds; |
| 35 | int row; |
| 36 | int nlo; |
| 37 | int nup; |
| 38 | }; |
| 39 | private: |
| 40 | const int nactions_; |
| 41 | // actions_ is owned by the class and must be deleted at destruction |
| 42 | const action *const actions_; |
| 43 | |
| 44 | public: |
| 45 | forcing_constraint_action(int nactions, |
| 46 | const action *actions, |
| 47 | const CoinPresolveAction *next) : |
| 48 | CoinPresolveAction(next), |
| 49 | nactions_(nactions), actions_(actions) {} |
| 50 | |
| 51 | const char *name() const override; |
| 52 | |
| 53 | static const CoinPresolveAction *presolve(CoinPresolveMatrix * prob, |
| 54 | const CoinPresolveAction *next); |
| 55 | |
| 56 | void postsolve(CoinPostsolveMatrix *prob) const override; |
| 57 | |
| 58 | ~forcing_constraint_action(); |
| 59 | }; |
| 60 | |
| 61 | #endif |
| 62 | |