| 1 | /* $Id: CoinPresolveDoubleton.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 CoinPresolveDoubleton_H |
| 7 | #define CoinPresolveDoubleton_H |
| 8 | |
| 9 | #define DOUBLETON 5 |
| 10 | |
| 11 | /*! \class doubleton_action |
| 12 | \brief Solve ax+by=c for y and substitute y out of the problem. |
| 13 | |
| 14 | This moves the bounds information for y onto x, making y free and allowing |
| 15 | us to substitute it away. |
| 16 | \verbatim |
| 17 | a x + b y = c |
| 18 | l1 <= x <= u1 |
| 19 | l2 <= y <= u2 ==> |
| 20 | |
| 21 | l2 <= (c - a x) / b <= u2 |
| 22 | b/-a > 0 ==> (b l2 - c) / -a <= x <= (b u2 - c) / -a |
| 23 | b/-a < 0 ==> (b u2 - c) / -a <= x <= (b l2 - c) / -a |
| 24 | \endverbatim |
| 25 | */ |
| 26 | class doubleton_action : public CoinPresolveAction { |
| 27 | public: |
| 28 | struct action { |
| 29 | |
| 30 | double clox; |
| 31 | double cupx; |
| 32 | double costx; |
| 33 | |
| 34 | double costy; |
| 35 | |
| 36 | double rlo; |
| 37 | |
| 38 | double coeffx; |
| 39 | double coeffy; |
| 40 | |
| 41 | double *colel; |
| 42 | |
| 43 | int icolx; |
| 44 | int icoly; |
| 45 | int row; |
| 46 | int ncolx; |
| 47 | int ncoly; |
| 48 | }; |
| 49 | |
| 50 | const int nactions_; |
| 51 | const action *const actions_; |
| 52 | |
| 53 | private: |
| 54 | doubleton_action(int nactions, |
| 55 | const action *actions, |
| 56 | const CoinPresolveAction *next) : |
| 57 | CoinPresolveAction(next), |
| 58 | nactions_(nactions), actions_(actions) |
| 59 | {} |
| 60 | |
| 61 | public: |
| 62 | const char *name() const { return ("doubleton_action" ); } |
| 63 | |
| 64 | static const CoinPresolveAction *presolve(CoinPresolveMatrix *, |
| 65 | const CoinPresolveAction *next); |
| 66 | |
| 67 | void postsolve(CoinPostsolveMatrix *prob) const; |
| 68 | |
| 69 | ~doubleton_action(); |
| 70 | }; |
| 71 | #endif |
| 72 | |