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

Protected Member Functions

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

Protected Attributes

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

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

consistency check

Definition at line 459 of file spxscaler.cpp.

References DataArray< T >::isConsistent(), SPxScaler::m_colscale, and SPxScaler::m_rowscale.

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

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(), and SPxGeometSC::scale().

Real maxAbsRowscale ( ) const
virtual

absolute biggest row scaling factor

Definition at line 379 of file spxscaler.cpp.

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

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

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(), and SPxGeometSC::scale().

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(), and SPxGeometSC::scale().

Real minAbsColscale ( ) const
virtual

absolute smallest column scaling factor

Definition at line 330 of file spxscaler.cpp.

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

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

Real minAbsRowscale ( ) const
virtual

absolute smallest row scaling factor

Definition at line 363 of file spxscaler.cpp.

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

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

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.

virtual void setOutstream ( SPxOut newOutstream)
virtual

set message handler

Definition at line 100 of file spxscaler.h.

References SPxScaler::spxout.

Referenced by SoPlex::operator=(), SoPlexLegacy::setPostScaler(), SoPlexLegacy::setPreScaler(), and SoPlex::SoPlex().

void setup ( SPxLP lp)
protectedvirtual
void unscaleRedCost ( Vector r) const
virtual
void unscaleSlacks ( Vector s) const
virtual

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(), SPxGeometSC::scale(), and SPxScaler::setOutstream().