Scippy

SoPlex

Sequential object-oriented simPlex

SPxScaler Class Referenceabstract

LP scaler abstract base class.Instances of classes derived from SPxScaler may be loaded to SoPlex in order to scale LPs before solving them. SoPlex will load() itself to the SPxScaler and then call scale(). Generally any SPxLP can be loaded to a SPxScaler for scale()ing it. The scaling can be undone by calling unscale(). More...

#include <spxscaler.h>

Inheritance diagram for SPxScaler:

Public Member Functions

Construction / destruction
 SPxScaler (const char *name, bool colFirst=false, bool doBoth=true, SPxOut *spxout=NULL)
 constructor More...
 
 SPxScaler (const SPxScaler &)
 copy constructor More...
 
SPxScaleroperator= (const SPxScaler &)
 assignment operator More...
 
virtual ~SPxScaler ()
 destructor. More...
 
virtual SPxScalerclone () const =0
 clone function for polymorphism More...
 
Access / modification
virtual const char * getName () const
 get name of scaler. More...
 
virtual void setOrder (bool colFirst)
 set scaling order. More...
 
virtual void setBoth (bool both)
 set wether column and row scaling should be performed. More...
 
virtual void setOutstream (SPxOut &newOutstream)
 set message handler More...
 
Scaling
virtual void scale (SPxLP &lp)=0
 scale SPxLP. More...
 
virtual void unscalePrimal (Vector &x) const
 unscale dense primal solution vector given in x. More...
 
virtual void unscaleSlacks (Vector &s) const
 unscale dense slack vector given in s. More...
 
virtual void unscaleDual (Vector &pi) const
 unscale dense dual solution vector given in pi. More...
 
virtual void unscaleRedCost (Vector &r) const
 unscale dense reduced cost vector given in r. More...
 
virtual Real minAbsColscale () const
 absolute smallest column scaling factor More...
 
virtual Real maxAbsColscale () const
 absolute biggest column scaling factor More...
 
virtual Real minAbsRowscale () const
 absolute smallest row scaling factor More...
 
virtual Real maxAbsRowscale () const
 absolute biggest row scaling factor More...
 
virtual Real maxColRatio (const SPxLP &lp) const
 maximum ratio between absolute biggest and smallest element in any column. More...
 
virtual Real maxRowRatio (const SPxLP &lp) const
 maximum ratio between absolute biggest and smallest element in any row. More...
 
Debugging
virtual bool isConsistent () const
 consistency check More...
 

Protected Member Functions

Protected helpers
virtual void setup (SPxLP &lp)
 setup scale array for the LP. More...
 
virtual Real computeScale (Real mini, Real maxi) const
 computes scaling value for a minimum and maximum pair. More...
 
virtual Real computeScalingVecs (const SVSet *vecset, const DataArray< Real > &coScaleval, DataArray< Real > &scaleval)
 iterates through vecset and calls computeScale() for each vector. More...
 
virtual void applyScaling (SPxLP &lp)
 applies m_colscale and m_rowscale to the lp. More...
 

Protected Attributes

Data
const char * m_name
 Name of the scaler. More...
 
DataArray< Realm_colscale
 column scaling factors More...
 
DataArray< Realm_rowscale
 row scaling factors More...
 
bool m_colFirst
 do column scaling first More...
 
bool m_doBoth
 do columns and rows More...
 
SPxOutspxout
 message handler More...
 

Friends

std::ostream & operator<< (std::ostream &s, const SPxScaler &sc)
 

Detailed Description

LP scaler abstract base class.

Instances of classes derived from SPxScaler may be loaded to SoPlex in order to scale LPs before solving them. SoPlex will load() itself to the SPxScaler and then call scale(). Generally any SPxLP can be loaded to a SPxScaler for scale()ing it. The scaling can be undone by calling unscale().

Definition at line 39 of file spxscaler.h.

Constructor & Destructor Documentation

SPxScaler ( const char *  name,
bool  colFirst = false,
bool  doBoth = true,
SPxOut spxout = NULL 
)
explicit

constructor

Definition at line 51 of file spxscaler.cpp.

References SPxScaler::isConsistent().

SPxScaler ( const SPxScaler old)

copy constructor

Definition at line 64 of file spxscaler.cpp.

References SPxScaler::isConsistent().

~SPxScaler ( )
virtual

destructor.

Definition at line 75 of file spxscaler.cpp.

References SPxScaler::m_name.

Member Function Documentation

virtual SPxScaler* clone ( ) const
pure virtual

clone function for polymorphism

Implemented in SPxGeometSC, and SPxEquiliSC.

Referenced by SoPlexLegacy::operator=(), and SoPlexLegacy::SoPlexLegacy().

Real computeScale ( Real  mini,
Real  maxi 
) const
protectedvirtual

computes scaling value for a minimum and maximum pair.

This function is used by computeScaleVecs and has to be overridden.

Reimplemented in SPxEquiliSC, and SPxGeometSC.

Definition at line 134 of file spxscaler.cpp.

Referenced by SPxScaler::computeScalingVecs().

Real computeScalingVecs ( const SVSet vecset,
const DataArray< Real > &  coScaleval,
DataArray< Real > &  scaleval 
)
protectedvirtual

iterates through vecset and calls computeScale() for each vector.

Returns
maximum ratio between absolute biggest and smallest element for any vector.

Definition at line 140 of file spxscaler.cpp.

References SPxScaler::computeScale(), SVectorBase< R >::index(), soplex::infinity, soplex::isZero(), SVSetBase< R >::num(), SVectorBase< R >::size(), soplex::spxAbs(), and SVectorBase< R >::value().

Referenced by SPxEquiliSC::scale(), and SPxGeometSC::scale().

const char * getName ( ) const
virtual

get name of scaler.

Definition at line 97 of file spxscaler.cpp.

References SPxScaler::m_name.

Referenced by SoPlex::getScalerName(), main(), and soplex::operator<<().

bool isConsistent ( ) const
virtual
Real maxAbsColscale ( ) const
virtual

absolute biggest column scaling factor

Definition at line 346 of file spxscaler.cpp.

References SPxScaler::m_colscale, DataArray< T >::size(), soplex::spxAbs(), soplex::spxFrexp(), and soplex::spxLdexp().

Referenced by SPxEquiliSC::scale(), SPxGeometSC::scale(), and SPxScaler::setOutstream().

Real maxAbsRowscale ( ) const
virtual
Real maxColRatio ( const SPxLP lp) const
virtual

maximum ratio between absolute biggest and smallest element in any column.

$\max_{j\in\mbox{ cols}} \left(\frac{\max_{i\in\mbox{ rows}}|a_ij|} {\min_{i\in\mbox{ rows}}|a_ij|}\right)$

Definition at line 399 of file spxscaler.cpp.

References SPxLPBase< R >::colVector(), soplex::infinity, SPxLPBase< R >::nCols(), SVectorBase< R >::size(), soplex::spxAbs(), and SVectorBase< R >::value().

Referenced by SPxEquiliSC::scale(), SPxGeometSC::scale(), and SPxScaler::setOutstream().

Real maxRowRatio ( const SPxLP lp) const
virtual

maximum ratio between absolute biggest and smallest element in any row.

$\max_{i\in\mbox{ rows}} \left(\frac{\max_{j\in\mbox{ cols}}|a_ij|} {\min_{j\in\mbox{ cols}}|a_ij|}\right)$

Definition at line 431 of file spxscaler.cpp.

References soplex::infinity, SPxLPBase< R >::nRows(), SPxLPBase< R >::rowVector(), SVectorBase< R >::size(), soplex::spxAbs(), and SVectorBase< R >::value().

Referenced by SPxEquiliSC::scale(), SPxGeometSC::scale(), and SPxScaler::setOutstream().

Real minAbsColscale ( ) const
virtual
Real minAbsRowscale ( ) const
virtual
virtual void scale ( SPxLP lp)
pure virtual
void setBoth ( bool  both)
virtual

set wether column and row scaling should be performed.

Definition at line 109 of file spxscaler.cpp.

References SPxScaler::m_doBoth.

void setOrder ( bool  colFirst)
virtual

set scaling order.

Definition at line 103 of file spxscaler.cpp.

References SPxScaler::m_colFirst.

void setup ( SPxLP lp)
protectedvirtual

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const SPxScaler sc 
)
friend

Definition at line 35 of file spxscaler.cpp.

Member Data Documentation

bool m_colFirst
protected

do column scaling first

Definition at line 49 of file spxscaler.h.

Referenced by SPxScaler::operator=(), and SPxScaler::setOrder().

bool m_doBoth
protected

do columns and rows

Definition at line 50 of file spxscaler.h.

Referenced by SPxScaler::operator=(), SPxEquiliSC::scale(), and SPxScaler::setBoth().

const char* m_name
protected

Name of the scaler.

Definition at line 46 of file spxscaler.h.

Referenced by SPxScaler::getName(), SPxScaler::operator=(), and SPxScaler::~SPxScaler().

SPxOut* spxout
protected

message handler

Definition at line 51 of file spxscaler.h.

Referenced by SPxScaler::operator=(), SPxEquiliSC::scale(), and SPxGeometSC::scale().