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 spxleastsqsc.h 26 * @brief LP least squares scaling. 27 */ 28 #ifndef _SPXLEASTSQSC_H_ 29 #define _SPXLEASTSQSC_H_ 30 31 #include <assert.h> 32 #include "soplex/spxsolver.h" 33 #include "soplex/spxscaler.h" 34 #include "soplex/spxlp.h" 35 36 37 namespace soplex 38 { 39 40 /**@brief Least squares scaling. 41 @ingroup Algo 42 43 This SPxScaler implementation performs least squares scaling as suggested by Curtis and Reid in: 44 On the Automatic Scaling of Matrices for Gaussian Elimination (1972). 45 */ 46 template <class R> 47 class SPxLeastSqSC : public SPxScaler<R> 48 { 49 public: 50 //------------------------------------- 51 /**@name Construction / destruction */ 52 ///@{ 53 /// default constructor (this scaler makes no use of inherited member m_colFirst) 54 explicit SPxLeastSqSC(); 55 /// copy constructor 56 SPxLeastSqSC(const SPxLeastSqSC& old); 57 /// assignment operator 58 SPxLeastSqSC& operator=(const SPxLeastSqSC&); 59 /// destructor 60 virtual ~SPxLeastSqSC() 61 {} 62 /// clone function for polymorphism 63 inline virtual SPxScaler<R>* clone() const override 64 { 65 return new SPxLeastSqSC(*this); 66 } 67 ///@} 68 69 //------------------------------------- 70 /**@name Access / modification */ 71 ///@{ 72 /// set Real param (conjugate gradient accuracy) 73 virtual void setRealParam(R param, const char* name) override; 74 /// set int param (maximal conjugate gradient rounds) 75 virtual void setIntParam(int param, const char* name) override; 76 ///@} 77 78 //------------------------------------- 79 /**@name Scaling */ 80 ///@{ 81 /// Scale the loaded SPxLP. 82 virtual void scale(SPxLPBase<R>& lp, bool persistent = true) override; 83 84 85 private: 86 R acrcydivisor = R(1000.0); 87 int maxrounds = 20; 88 89 }; 90 } // namespace soplex 91 92 // For the general templated files 93 #include "spxleastsqsc.hpp" 94 95 #endif // _SPXLEASTSQSC_H_ 96 97