Loading...
Searching...
No Matches
AbcSimplexFactorization.hpp
Go to the documentation of this file.
/* $Id$ */
// Copyright (C) 2002, International Business Machines
// Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef AbcSimplexFactorization_H
#define AbcSimplexFactorization_H
#include "CoinPragma.hpp"
#include "CoinAbcCommon.hpp"
#include "CoinAbcFactorization.hpp"
#include "AbcMatrix.hpp"
//#include "CoinAbcAnyFactorization.hpp"
#include "AbcSimplex.hpp"
#ifndef ABC_USE_COIN_FACTORIZATION
class ClpFactorization;
class CoinFactorization;
#else
#include "ClpFactorization.hpp"
#include "CoinFactorization.hpp"
#endif
class AbcSimplexFactorization {
public:
int factorize(AbcSimplex *model, int solveType, bool valuesPass);
#ifdef EARLY_FACTORIZE
inline int factorize(AbcSimplex *model, CoinIndexedVector &stuff)
{
return coinAbcFactorization_->factorize(model, stuff);
}
#endif
AbcSimplexFactorization(int numberRows = 0);
~AbcSimplexFactorization();
AbcSimplexFactorization(const AbcSimplexFactorization &, int denseIfSmaller = 0);
AbcSimplexFactorization &operator=(const AbcSimplexFactorization &);
void setFactorization(AbcSimplexFactorization &rhs);
/* **** below here is so can use networkish basis */
inline
#ifdef ABC_LONG_FACTORIZATION
long
#endif
double
checkReplacePart1(CoinIndexedVector *regionSparse,
int pivotRow)
{
return coinAbcFactorization_->checkReplacePart1(regionSparse, pivotRow);
}
inline
#ifdef ABC_LONG_FACTORIZATION
long
#endif
double
checkReplacePart1(CoinIndexedVector *regionSparse,
CoinIndexedVector *partialUpdate,
int pivotRow)
{
return coinAbcFactorization_->checkReplacePart1(regionSparse, partialUpdate, pivotRow);
}
#ifdef MOVE_REPLACE_PART1A
inline void checkReplacePart1a(CoinIndexedVector *regionSparse,
int pivotRow)
{
coinAbcFactorization_->checkReplacePart1a(regionSparse, pivotRow);
}
inline double checkReplacePart1b(CoinIndexedVector *regionSparse,
int pivotRow)
{
return coinAbcFactorization_->checkReplacePart1b(regionSparse, pivotRow);
}
#endif
inline int checkReplacePart2(int pivotRow,
double btranAlpha,
double ftranAlpha,
#ifdef ABC_LONG_FACTORIZATION
long
#endif
double ftAlpha)
{
return coinAbcFactorization_->checkReplacePart2(pivotRow, btranAlpha, ftranAlpha, ftAlpha);
}
#ifdef ABC_LONG_FACTORIZATION
inline void clearHiddenArrays()
{
coinAbcFactorization_->clearHiddenArrays();
}
#endif
void replaceColumnPart3(const AbcSimplex *model,
CoinIndexedVector *regionSparse,
CoinIndexedVector *tableauColumn,
int pivotRow,
#ifdef ABC_LONG_FACTORIZATION
long
#endif
double alpha);
void replaceColumnPart3(const AbcSimplex *model,
CoinIndexedVector *regionSparse,
CoinIndexedVector *tableauColumn,
CoinIndexedVector *partialUpdate,
int pivotRow,
#ifdef ABC_LONG_FACTORIZATION
long
#endif
double alpha);
#ifdef EARLY_FACTORIZE
inline int replaceColumns(const AbcSimplex *model,
CoinIndexedVector &stuff,
int firstPivot, int lastPivot, bool cleanUp)
{
return coinAbcFactorization_->replaceColumns(model, stuff, firstPivot, lastPivot, cleanUp);
}
#endif
#if 0
int updateColumnFT ( CoinIndexedVector * regionSparse,
CoinIndexedVector * regionSparse2);
int updateColumn ( CoinIndexedVector * regionSparse,
CoinIndexedVector * regionSparse2) const;
int updateTwoColumnsFT ( CoinIndexedVector * regionSparse1,
CoinIndexedVector * regionSparse2,
CoinIndexedVector * regionSparse3) ;
int updateColumnTranspose ( CoinIndexedVector * regionSparse,
CoinIndexedVector * regionSparse2) const;
#endif
inline int updateColumnFT(CoinIndexedVector &regionSparseFT)
{
return coinAbcFactorization_->updateColumnFT(regionSparseFT);
}
inline int updateColumnFTPart1(CoinIndexedVector &regionSparseFT)
{
return coinAbcFactorization_->updateColumnFTPart1(regionSparseFT);
}
inline void updateColumnFTPart2(CoinIndexedVector &regionSparseFT)
{
coinAbcFactorization_->updateColumnFTPart2(regionSparseFT);
}
inline void updateColumnFT(CoinIndexedVector &regionSparseFT,
CoinIndexedVector &partialUpdate,
int which)
{
coinAbcFactorization_->updateColumnFT(regionSparseFT, partialUpdate, which);
}
inline int updateColumn(CoinIndexedVector &regionSparse) const
{
return coinAbcFactorization_->updateColumn(regionSparse);
}
inline int updateTwoColumnsFT(CoinIndexedVector &regionSparseFT,
CoinIndexedVector &regionSparseOther)
{
return coinAbcFactorization_->updateTwoColumnsFT(regionSparseFT, regionSparseOther);
}
inline int updateColumnTranspose(CoinIndexedVector &regionSparse) const
{
return coinAbcFactorization_->updateColumnTranspose(regionSparse);
}
inline void updateColumnCpu(CoinIndexedVector &regionSparse, int whichCpu) const
#ifndef ABC_USE_COIN_FACTORIZATION
{
coinAbcFactorization_->updateColumnCpu(regionSparse, whichCpu);
}
#else
{
coinAbcFactorization_->updateColumn(regionSparse);
}
#endif
inline void updateColumnTransposeCpu(CoinIndexedVector &regionSparse, int whichCpu) const
#ifndef ABC_USE_COIN_FACTORIZATION
{
coinAbcFactorization_->updateColumnTransposeCpu(regionSparse, whichCpu);
}
#else
{
coinAbcFactorization_->updateColumnTranspose(regionSparse);
}
#endif
inline void updateFullColumn(CoinIndexedVector &regionSparse) const
{
coinAbcFactorization_->updateFullColumn(regionSparse);
}
inline void updateFullColumnTranspose(CoinIndexedVector &regionSparse) const
{
coinAbcFactorization_->updateFullColumnTranspose(regionSparse);
}
void updateWeights(CoinIndexedVector &regionSparse) const
#ifndef ABC_USE_COIN_FACTORIZATION
{
coinAbcFactorization_->updateWeights(regionSparse);
}
#else
{
coinAbcFactorization_->updateColumn(regionSparse);
}
#endif
inline int numberElements() const
{
return coinAbcFactorization_->numberElements();
}
inline int maximumPivots() const
{
return coinAbcFactorization_->maximumPivots();
}
inline void maximumPivots(int value)
{
coinAbcFactorization_->maximumPivots(value);
}
inline bool usingFT() const
{
return !coinAbcFactorization_->wantsTableauColumn();
}
inline int pivots() const
{
return coinAbcFactorization_->pivots();
}
inline void setModel(AbcSimplex *model)
{
model_ = model;
}
inline void setPivots(int value) const
{
coinAbcFactorization_->setPivots(value);
}
inline double areaFactor() const
{
return coinAbcFactorization_->areaFactor();
}
inline void areaFactor(double value)
{
coinAbcFactorization_->areaFactor(value);
}
inline double zeroTolerance() const
{
return coinAbcFactorization_->zeroTolerance();
}
inline void zeroTolerance(double value)
{
coinAbcFactorization_->zeroTolerance(value);
}
void saferTolerances(double zeroTolerance, double pivotTolerance);
inline int status() const
{
return coinAbcFactorization_->status();
}
inline void setStatus(int value)
{
coinAbcFactorization_->setStatus(value);
}
#if ABC_PARALLEL == 2
inline void setParallelMode(int value)
{
coinAbcFactorization_->setParallelMode(value);
};
#endif
inline int numberDense() const
{
return coinAbcFactorization_->numberDense();
}
bool timeToRefactorize() const;
#if CLP_FACTORIZATION_NEW_TIMING > 1
void statsRefactor(char when) const;
#endif
inline void clearArrays()
{
coinAbcFactorization_->clearArrays();
}
inline int numberRows() const
{
return coinAbcFactorization_->numberRows();
}
inline int numberSlacks() const
{
return numberSlacks_;
}
inline double pivotTolerance() const
{
return coinAbcFactorization_->pivotTolerance();
}
inline void pivotTolerance(double value)
{
coinAbcFactorization_->pivotTolerance(value);
}
inline double minimumPivotTolerance() const
{
return coinAbcFactorization_->minimumPivotTolerance();
}
inline void minimumPivotTolerance(double value)
{
coinAbcFactorization_->minimumPivotTolerance(value);
}
inline double *pivotRegion() const
{
return coinAbcFactorization_->pivotRegion();
}
//inline void relaxAccuracyCheck(double /*value*/) {
//abort();
//}
inline void almostDestructor()
{
coinAbcFactorization_->clearArrays();
}
void setDenseThreshold(int number);
int getDenseThreshold() const;
void forceOtherFactorization(int which);
void goDenseOrSmall(int numberRows);
inline int goDenseThreshold() const
{
return goDenseThreshold_;
}
inline void setGoDenseThreshold(int value)
{
goDenseThreshold_ = value;
}
inline int goSmallThreshold() const
{
return goSmallThreshold_;
}
inline void setGoSmallThreshold(int value)
{
goSmallThreshold_ = value;
}
inline int goLongThreshold() const
{
return goLongThreshold_;
}
inline void setGoLongThreshold(int value)
{
goLongThreshold_ = value;
}
inline int typeOfFactorization() const
{
return forceB_;
}
void synchronize(const ClpFactorization *otherFactorization, const AbcSimplex *model);
void goSparse();
#ifndef NDEBUG
#ifndef ABC_USE_COIN_FACTORIZATION
inline void checkMarkArrays() const
{
coinAbcFactorization_->checkMarkArrays();
}
#else
inline void checkMarkArrays() const
{
}
#endif
#endif
inline bool needToReorder() const
{
abort();
return true;
}
#ifndef ABC_USE_COIN_FACTORIZATION
CoinAbcAnyFactorization *factorization() const
{
return coinAbcFactorization_;
}
#else
CoinFactorization *factorization() const
{
return coinAbcFactorization_;
}
#endif
private:
AbcSimplex *model_;
#ifndef ABC_USE_COIN_FACTORIZATION
CoinAbcAnyFactorization *coinAbcFactorization_;
#else
CoinFactorization *coinAbcFactorization_;
#endif
#ifdef CLP_FACTORIZATION_NEW_TIMING
mutable double shortestAverage_;
mutable double totalInR_;
mutable double totalInIncreasingU_;
mutable int endLengthU_;
mutable int lastNumberPivots_;
mutable int effectiveStartNumberU_;
#endif
int forceB_;
int goDenseThreshold_;
int goSmallThreshold_;
int goLongThreshold_;
int numberSlacks_;
};
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
AbcMatrix.hpp
AbcSimplex.hpp
AbcSimplex
#define AbcSimplex
Definition AbcWarmStart.hpp:16
ClpFactorization.hpp
CoinAbcCommon.hpp
CoinAbcFactorization.hpp
AbcSimplexFactorization::checkMarkArrays
void checkMarkArrays() const
Definition AbcSimplexFactorization.hpp:467
AbcSimplexFactorization::updateTwoColumnsFT
int updateTwoColumnsFT(CoinIndexedVector &regionSparseFT, CoinIndexedVector &regionSparseOther)
Updates one column (FTRAN) from regionFT Tries to do FT update number returned is negative if no room...
Definition AbcSimplexFactorization.hpp:227
AbcSimplexFactorization::AbcSimplexFactorization
AbcSimplexFactorization(const AbcSimplexFactorization &, int denseIfSmaller=0)
The copy constructor.
AbcSimplexFactorization::factorize
int factorize(AbcSimplex *model, int solveType, bool valuesPass)
When part of LP - given by basic variables.
AbcSimplexFactorization::zeroTolerance
void zeroTolerance(double value)
Set zero tolerance.
Definition AbcSimplexFactorization.hpp:334
AbcSimplexFactorization::goSmallThreshold_
int goSmallThreshold_
Switch to small if number rows <= this.
Definition AbcSimplexFactorization.hpp:523
AbcSimplexFactorization::goDenseThreshold
int goDenseThreshold() const
Get switch to dense if number rows <= this.
Definition AbcSimplexFactorization.hpp:423
AbcSimplexFactorization::almostDestructor
void almostDestructor()
Allows change of pivot accuracy check 1.0 == none >1.0 relaxed.
Definition AbcSimplexFactorization.hpp:411
AbcSimplexFactorization::pivotTolerance
void pivotTolerance(double value)
Set pivot tolerance.
Definition AbcSimplexFactorization.hpp:387
AbcSimplexFactorization::numberElements
int numberElements() const
Total number of elements in factorization.
Definition AbcSimplexFactorization.hpp:284
AbcSimplexFactorization::needToReorder
bool needToReorder() const
Says whether to redo pivot order.
Definition AbcSimplexFactorization.hpp:478
AbcSimplexFactorization::goLongThreshold_
int goLongThreshold_
Switch to long/ordered if number rows >= this.
Definition AbcSimplexFactorization.hpp:525
AbcSimplexFactorization::updateFullColumn
void updateFullColumn(CoinIndexedVector &regionSparse) const
Updates one full column (FTRAN).
Definition AbcSimplexFactorization.hpp:260
AbcSimplexFactorization::model_
AbcSimplex * model_
Pointer to model.
Definition AbcSimplexFactorization.hpp:502
AbcSimplexFactorization::numberSlacks
int numberSlacks() const
Number of slacks at last factorization.
Definition AbcSimplexFactorization.hpp:377
AbcSimplexFactorization::pivotRegion
double * pivotRegion() const
pivot region
Definition AbcSimplexFactorization.hpp:402
AbcSimplexFactorization::pivots
int pivots() const
Returns number of pivots since factorization.
Definition AbcSimplexFactorization.hpp:304
AbcSimplexFactorization::updateColumnFT
void updateColumnFT(CoinIndexedVector &regionSparseFT, CoinIndexedVector &partialUpdate, int which)
Updates one column (FTRAN) Tries to do FT update puts partial update in vector.
Definition AbcSimplexFactorization.hpp:212
AbcSimplexFactorization::typeOfFactorization
int typeOfFactorization() const
Returns type.
Definition AbcSimplexFactorization.hpp:453
AbcSimplexFactorization::coinAbcFactorization_
CoinAbcAnyFactorization * coinAbcFactorization_
Pointer to factorization.
Definition AbcSimplexFactorization.hpp:505
AbcSimplexFactorization::checkReplacePart1
double checkReplacePart1(CoinIndexedVector *regionSparse, CoinIndexedVector *partialUpdate, int pivotRow)
Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial...
Definition AbcSimplexFactorization.hpp:94
AbcSimplexFactorization::timeToRefactorize
bool timeToRefactorize() const
AbcSimplexFactorization::goSparse
void goSparse()
makes a row copy of L for speed and to allow very sparse problems
AbcSimplexFactorization::minimumPivotTolerance
double minimumPivotTolerance() const
Minimum pivot tolerance.
Definition AbcSimplexFactorization.hpp:392
AbcSimplexFactorization::synchronize
void synchronize(const ClpFactorization *otherFactorization, const AbcSimplex *model)
Synchronize stuff.
AbcSimplexFactorization::getDenseThreshold
int getDenseThreshold() const
AbcSimplexFactorization::numberRows
int numberRows() const
Number of Rows after factorization.
Definition AbcSimplexFactorization.hpp:372
AbcSimplexFactorization::saferTolerances
void saferTolerances(double zeroTolerance, double pivotTolerance)
Set tolerances to safer of existing and given.
AbcSimplexFactorization::updateColumnFTPart1
int updateColumnFTPart1(CoinIndexedVector &regionSparseFT)
Definition AbcSimplexFactorization.hpp:201
AbcSimplexFactorization::factorization
CoinAbcAnyFactorization * factorization() const
Pointer to factorization.
Definition AbcSimplexFactorization.hpp:485
AbcSimplexFactorization::replaceColumnPart3
void replaceColumnPart3(const AbcSimplex *model, CoinIndexedVector *regionSparse, CoinIndexedVector *tableauColumn, int pivotRow, double alpha)
Replaces one Column to basis, partial update already in U.
AbcSimplexFactorization::goDenseThreshold_
int goDenseThreshold_
Switch to dense if number rows <= this.
Definition AbcSimplexFactorization.hpp:521
AbcSimplexFactorization::AbcSimplexFactorization
AbcSimplexFactorization(int numberRows=0)
Default constructor.
AbcSimplexFactorization::pivotTolerance
double pivotTolerance() const
Pivot tolerance.
Definition AbcSimplexFactorization.hpp:382
AbcSimplexFactorization::setDenseThreshold
void setDenseThreshold(int number)
So we can temporarily switch off dense.
AbcSimplexFactorization::setPivots
void setPivots(int value) const
Sets number of pivots since factorization.
Definition AbcSimplexFactorization.hpp:314
AbcSimplexFactorization::maximumPivots
int maximumPivots() const
Maximum number of pivots between factorizations.
Definition AbcSimplexFactorization.hpp:289
AbcSimplexFactorization::forceB_
int forceB_
If nonzero force use of 1,dense 2,small 3,long.
Definition AbcSimplexFactorization.hpp:519
AbcSimplexFactorization::clearArrays
void clearArrays()
Get rid of all memory.
Definition AbcSimplexFactorization.hpp:367
AbcSimplexFactorization::updateFullColumnTranspose
void updateFullColumnTranspose(CoinIndexedVector &regionSparse) const
Updates one full column (BTRAN).
Definition AbcSimplexFactorization.hpp:265
AbcSimplexFactorization::setGoSmallThreshold
void setGoSmallThreshold(int value)
Set switch to small if number rows <= this.
Definition AbcSimplexFactorization.hpp:438
AbcSimplexFactorization::numberSlacks_
int numberSlacks_
Number of slacks at last factorization.
Definition AbcSimplexFactorization.hpp:527
AbcSimplexFactorization::areaFactor
void areaFactor(double value)
Set whether larger areas needed.
Definition AbcSimplexFactorization.hpp:324
AbcSimplexFactorization::updateColumnTranspose
int updateColumnTranspose(CoinIndexedVector &regionSparse) const
Updates one column (BTRAN).
Definition AbcSimplexFactorization.hpp:233
AbcSimplexFactorization::~AbcSimplexFactorization
~AbcSimplexFactorization()
Destructor.
AbcSimplexFactorization::areaFactor
double areaFactor() const
Whether larger areas needed.
Definition AbcSimplexFactorization.hpp:319
AbcSimplexFactorization::updateColumnFT
int updateColumnFT(CoinIndexedVector &regionSparseFT)
Updates one column (FTRAN) Tries to do FT update number returned is negative if no room.
Definition AbcSimplexFactorization.hpp:197
AbcSimplexFactorization::goSmallThreshold
int goSmallThreshold() const
Get switch to small if number rows <= this.
Definition AbcSimplexFactorization.hpp:433
AbcSimplexFactorization::updateColumnTransposeCpu
void updateColumnTransposeCpu(CoinIndexedVector &regionSparse, int whichCpu) const
Updates one column (BTRAN).
Definition AbcSimplexFactorization.hpp:249
AbcSimplexFactorization::goDenseOrSmall
void goDenseOrSmall(int numberRows)
Go over to dense code.
AbcSimplexFactorization::setGoLongThreshold
void setGoLongThreshold(int value)
Set switch to long/ordered if number rows >= this.
Definition AbcSimplexFactorization.hpp:448
AbcSimplexFactorization::forceOtherFactorization
void forceOtherFactorization(int which)
If nonzero force use of 1,dense 2,small 3,long.
AbcSimplexFactorization::zeroTolerance
double zeroTolerance() const
Zero tolerance.
Definition AbcSimplexFactorization.hpp:329
AbcSimplexFactorization::setGoDenseThreshold
void setGoDenseThreshold(int value)
Set switch to dense if number rows <= this.
Definition AbcSimplexFactorization.hpp:428
AbcSimplexFactorization::operator=
AbcSimplexFactorization & operator=(const AbcSimplexFactorization &)
AbcSimplexFactorization::setFactorization
void setFactorization(AbcSimplexFactorization &rhs)
Sets factorization.
AbcSimplexFactorization::replaceColumnPart3
void replaceColumnPart3(const AbcSimplex *model, CoinIndexedVector *regionSparse, CoinIndexedVector *tableauColumn, CoinIndexedVector *partialUpdate, int pivotRow, double alpha)
Replaces one Column to basis, partial update in vector.
AbcSimplexFactorization::goLongThreshold
int goLongThreshold() const
Get switch to long/ordered if number rows >= this.
Definition AbcSimplexFactorization.hpp:443
AbcSimplexFactorization::setModel
void setModel(AbcSimplex *model)
Sets model.
Definition AbcSimplexFactorization.hpp:309
AbcSimplexFactorization::checkReplacePart1
double checkReplacePart1(CoinIndexedVector *regionSparse, int pivotRow)
Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial...
Definition AbcSimplexFactorization.hpp:80
AbcSimplexFactorization::setStatus
void setStatus(int value)
Sets status.
Definition AbcSimplexFactorization.hpp:346
AbcSimplexFactorization::usingFT
bool usingFT() const
Returns true if doing FT.
Definition AbcSimplexFactorization.hpp:299
AbcSimplexFactorization::status
int status() const
Returns status.
Definition AbcSimplexFactorization.hpp:341
AbcSimplexFactorization::updateColumnCpu
void updateColumnCpu(CoinIndexedVector &regionSparse, int whichCpu) const
Updates one column (FTRAN).
Definition AbcSimplexFactorization.hpp:238
AbcSimplexFactorization::updateWeights
void updateWeights(CoinIndexedVector &regionSparse) const
Updates one column for dual steepest edge weights (FTRAN).
Definition AbcSimplexFactorization.hpp:270
AbcSimplexFactorization::maximumPivots
void maximumPivots(int value)
Set maximum number of pivots between factorizations.
Definition AbcSimplexFactorization.hpp:294
AbcSimplexFactorization::numberDense
int numberDense() const
Returns number of dense rows.
Definition AbcSimplexFactorization.hpp:358
AbcSimplexFactorization::updateColumnFTPart2
void updateColumnFTPart2(CoinIndexedVector &regionSparseFT)
Definition AbcSimplexFactorization.hpp:205
AbcSimplexFactorization::minimumPivotTolerance
void minimumPivotTolerance(double value)
Set minimum pivot tolerance.
Definition AbcSimplexFactorization.hpp:397
AbcSimplexFactorization::updateColumn
int updateColumn(CoinIndexedVector &regionSparse) const
Updates one column (FTRAN).
Definition AbcSimplexFactorization.hpp:219
AbcSimplexFactorization::checkReplacePart2
int checkReplacePart2(int pivotRow, double btranAlpha, double ftranAlpha, double ftAlpha)
Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular,...
Definition AbcSimplexFactorization.hpp:118
ClpFactorization
This just implements CoinFactorization when an ClpMatrixBase object is passed.
Definition ClpFactorization.hpp:38
CoinAbcAnyFactorization
Abstract base class which also has some scalars so can be used from Dense or Simp.
Definition CoinAbcDenseFactorization.hpp:23
CoinAbcAnyFactorization::updateColumn
virtual int updateColumn(CoinIndexedVector &regionSparse) const =0
This version has same effect as above with FTUpdate==false so number returned is always >=0.
CoinAbcAnyFactorization::checkReplacePart1a
virtual void checkReplacePart1a(CoinIndexedVector *, int)
Definition CoinAbcDenseFactorization.hpp:299
CoinAbcAnyFactorization::updateColumnTranspose
virtual int updateColumnTranspose(CoinIndexedVector &regionSparse) const =0
Updates one column (BTRAN) from unpacked regionSparse.