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  spxequilisc.h
26   	 * @brief LP equilibrium scaling.
27   	 */
28   	#ifndef _SPXEQUILISC_H_
29   	#define _SPXEQUILISC_H_
30   	
31   	#include <assert.h>
32   	
33   	#include "soplex/spxdefines.h"
34   	#include "soplex/spxscaler.h"
35   	
36   	namespace soplex
37   	{
38   	/**@brief Equilibrium row/column scaling.
39   	   @ingroup Algo
40   	
41   	   This SPxScaler implementation performs equilibrium scaling of the
42   	   LPs rows and columns.
43   	*/
44   	template <class R>
45   	class SPxEquiliSC : public SPxScaler<R>
46   	{
47   	public:
48   	   /// compute equilibrium scaling vector rounded to power of two
49   	   static void computeEquiExpVec(const SVSetBase<R>* vecset, const DataArray<int>& coScaleExp,
50   	                                 DataArray<int>& scaleExp, R epsilon);
51   	
52   	   /// compute equilibrium scaling vector rounded to power of two
53   	   static void computeEquiExpVec(const SVSetBase<R>* vecset, const std::vector<R>& coScaleVal,
54   	                                 DataArray<int>& scaleExp, R epsilon);
55   	
56   	   /// compute equilibrium scaling rounded to power of 2 for existing R scaling factors (preRowscale, preColscale)
57   	   static void computePostequiExpVecs(const SPxLPBase<R>& lp, const std::vector<R>& preRowscale,
58   	                                      const std::vector<R>& preColscale,
59   	                                      DataArray<int>& rowscaleExp, DataArray<int>& colscaleExp, R epsilon);
60   	   //-------------------------------------
61   	   /**@name Construction / destruction */
62   	   ///@{
63   	   /// default constructor (this scaler makes no use of inherited member m_colFirst)
64   	   explicit SPxEquiliSC(bool doBoth = true);
65   	   /// copy constructor
66   	   SPxEquiliSC(const SPxEquiliSC& old);
67   	   /// assignment operator
68   	   SPxEquiliSC& operator=(const SPxEquiliSC&);
69   	   /// destructor
70   	   virtual ~SPxEquiliSC()
71   	   {}
72   	   /// clone function for polymorphism
73   	   inline virtual SPxScaler<R>* clone() const override
74   	   {
75   	      return new SPxEquiliSC<R>(*this);
76   	   }
77   	   ///@}
78   	
79   	   //-------------------------------------
80   	   /**@name Scaling */
81   	   ///@{
82   	   /// Scale the loaded SPxLP.
83   	   virtual void scale(SPxLPBase<R>& lp, bool persistent = false) override;
84   	   ///@}
85   	};
86   	} // namespace soplex
87   	
88   	#include "spxequilisc.hpp"
89   	
90   	#endif // _SPXEQUILISC_H_
91