1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 /* */ 3 /* This file is part of the class library */ 4 /* SoPlex --- the Sequential object-oriented simPlex. */ 5 /* */ 6 /* Copyright (c) 1996-2023 Zuse Institute Berlin (ZIB) */ 7 /* */ 8 /* Licensed under the Apache License, Version 2.0 (the "License"); */ 9 /* you may not use this file except in compliance with the License. */ 10 /* You may obtain a copy of the License at */ 11 /* */ 12 /* http://www.apache.org/licenses/LICENSE-2.0 */ 13 /* */ 14 /* Unless required by applicable law or agreed to in writing, software */ 15 /* distributed under the License is distributed on an "AS IS" BASIS, */ 16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ 17 /* See the License for the specific language governing permissions and */ 18 /* limitations under the License. */ 19 /* */ 20 /* You should have received a copy of the Apache-2.0 license */ 21 /* along with SoPlex; see the file LICENSE. If not email to soplex@zib.de. */ 22 /* */ 23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 24 25 /**@file spxparmultpr.h 26 * @brief Partial multiple pricing. 27 */ 28 #ifndef _SPXPARMULTPR_H_ 29 #define _SPXPARMULTPR_H_ 30 31 #include <assert.h> 32 33 #include "soplex/spxdefines.h" 34 #include "soplex/spxpricer.h" 35 #include "soplex/dataarray.h" 36 #include "soplex/array.h" 37 #include "soplex/ssvector.h" 38 39 namespace soplex 40 { 41 42 /**@brief Partial multiple pricing. 43 @ingroup Algo 44 45 Class SPxParMultPr is an implementation class for SPxPricer implementing 46 Dantzig's default pricing strategy with partial multiple pricing. 47 Partial multiple pricing applies to the entering Simplex only. A set of 48 #partialSize eligible pivot indices is selected (partial pricing). In the 49 following Simplex iterations pricing is restricted to these indices 50 (multiple pricing) until no more eliiable pivots are available. Partial 51 multiple pricing significantly reduces the computation time for computing 52 the matrix-vector-product in the Simplex algorithm. 53 54 See SPxPricer for a class documentation. 55 */ 56 template <class R> 57 class SPxParMultPR : public SPxPricer<R> 58 { 59 private: 60 61 //------------------------------------- 62 /**@name Private types */ 63 ///@{ 64 /// Helper structure. 65 struct SPxParMultPr_Tmp 66 { 67 /// 68 SPxId id; 69 /// 70 R test; 71 }; 72 ///@} 73 74 //------------------------------------- 75 /**@name Helper data */ 76 ///@{ 77 /// 78 Array < SPxParMultPr_Tmp > pricSet; 79 /// 80 int multiParts; 81 /// 82 int used; 83 /// 84 int min; 85 /// 86 int last; 87 /// Set size for partial pricing. 88 int partialSize; 89 ///@} 90 91 public: 92 93 //------------------------------------- 94 /**@name Construction / destruction */ 95 ///@{ 96 /// default constructor 97 SPxParMultPR() 98 : SPxPricer<R>("ParMult") 99 , multiParts(0) 100 , used(0) 101 , min(0) 102 , last(0) 103 , partialSize(17) 104 {} 105 /// copy constructor 106 SPxParMultPR(const SPxParMultPR& old) 107 : SPxPricer<R>(old) 108 , pricSet(old.pricSet) 109 , multiParts(old.multiParts) 110 , used(old.used) 111 , min(old.min) 112 , last(old.last) 113 , partialSize(old.partialSize) 114 {} 115 /// assignment operator 116 SPxParMultPR& operator=(const SPxParMultPR& rhs) 117 { 118 if(this != &rhs) 119 { 120 SPxPricer<R>::operator=(rhs); 121 pricSet = rhs.pricSet; 122 multiParts = rhs.multiParts; 123 used = rhs.used; 124 min = rhs.min; 125 last = rhs.last; 126 partialSize = rhs.partialSize; 127 } 128 129 return *this; 130 } 131 /// destructor 132 virtual ~SPxParMultPR() 133 {} 134 /// clone function for polymorphism 135 inline virtual SPxPricer<R>* clone() const 136 { 137 return new SPxParMultPR(*this); 138 } 139 ///@} 140 141 //------------------------------------- 142 /**@name Interface */ 143 ///@{ 144 /// set the solver 145 virtual void load(SPxSolverBase<R>* solver); 146 /// set entering or leaving algorithm 147 virtual void setType(typename SPxSolverBase<R>::Type tp); 148 /// 149 virtual int selectLeave(); 150 /// 151 virtual SPxId selectEnter(); 152 ///@} 153 154 }; 155 156 } // namespace soplex 157 158 #include "spxparmultpr.hpp" 159 #endif // _SPXPARMULTPRR_H_ 160