Loading...
Searching...
No Matches
ClpPresolve.hpp
Go to the documentation of this file.
/* $Id$ */
// Copyright (C) 2002, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef ClpPresolve_H
#define ClpPresolve_H
#include "ClpSimplex.hpp"
class CoinPresolveAction;
#include "CoinPresolveMatrix.hpp"
class ClpPresolve {
public:
ClpPresolve();
virtual ~ClpPresolve();
ClpSimplex *presolvedModel(ClpSimplex &si,
double feasibilityTolerance = 0.0,
bool keepIntegers = true,
int numberPasses = 5,
bool dropNames = false,
bool doRowObjective = false,
const char *prohibitedRows = NULL,
const char *prohibitedColumns = NULL);
#ifndef CLP_NO_STD
int presolvedModelToFile(ClpSimplex &si, std::string fileName,
double feasibilityTolerance = 0.0,
bool keepIntegers = true,
int numberPasses = 5,
bool dropNames = false,
bool doRowObjective = false);
#endif
ClpSimplex *model() const;
ClpSimplex *originalModel() const;
void setOriginalModel(ClpSimplex *model);
const int *originalColumns() const;
const int *originalRows() const;
inline void setNonLinearValue(double value)
{
nonLinearValue_ = value;
}
inline double nonLinearValue() const
{
return nonLinearValue_;
}
inline bool doDual() const
{
return (presolveActions_ & 1) == 0;
}
inline void setDoDual(bool doDual)
{
if (doDual)
presolveActions_ &= ~1;
else
presolveActions_ |= 1;
}
inline bool doSingleton() const
{
return (presolveActions_ & 2) == 0;
}
inline void setDoSingleton(bool doSingleton)
{
if (doSingleton)
presolveActions_ &= ~2;
else
presolveActions_ |= 2;
}
inline bool doDoubleton() const
{
return (presolveActions_ & 4) == 0;
}
inline void setDoDoubleton(bool doDoubleton)
{
if (doDoubleton)
presolveActions_ &= ~4;
else
presolveActions_ |= 4;
}
inline bool doTripleton() const
{
return (presolveActions_ & 8) == 0;
}
inline void setDoTripleton(bool doTripleton)
{
if (doTripleton)
presolveActions_ &= ~8;
else
presolveActions_ |= 8;
}
inline bool doTighten() const
{
return (presolveActions_ & 16) == 0;
}
inline void setDoTighten(bool doTighten)
{
if (doTighten)
presolveActions_ &= ~16;
else
presolveActions_ |= 16;
}
inline bool doForcing() const
{
return (presolveActions_ & 32) == 0;
}
inline void setDoForcing(bool doForcing)
{
if (doForcing)
presolveActions_ &= ~32;
else
presolveActions_ |= 32;
}
inline bool doImpliedFree() const
{
return (presolveActions_ & 64) == 0;
}
inline void setDoImpliedFree(bool doImpliedfree)
{
if (doImpliedfree)
presolveActions_ &= ~64;
else
presolveActions_ |= 64;
}
inline bool doDupcol() const
{
return (presolveActions_ & 128) == 0;
}
inline void setDoDupcol(bool doDupcol)
{
if (doDupcol)
presolveActions_ &= ~128;
else
presolveActions_ |= 128;
}
inline bool doDuprow() const
{
return (presolveActions_ & 256) == 0;
}
inline void setDoDuprow(bool doDuprow)
{
if (doDuprow)
presolveActions_ &= ~256;
else
presolveActions_ |= 256;
}
inline bool doDependency() const
{
return (presolveActions_ & 32768) != 0;
}
inline void setDoDependency(bool doDependency)
{
if (doDependency)
presolveActions_ |= 32768;
else
presolveActions_ &= ~32768;
}
inline bool doTransfer() const
{
return (presolveActions_ & 65536) != 0;
}
inline void setDoTransfer(bool doTransfer)
{
if (doTransfer)
presolveActions_ |= 65536;
else
presolveActions_ &= ~65536;
}
inline bool doSingletonColumn() const
{
return (presolveActions_ & 512) == 0;
}
inline void setDoSingletonColumn(bool doSingleton)
{
if (doSingleton)
presolveActions_ &= ~512;
else
presolveActions_ |= 512;
}
inline bool doGubrow() const
{
return (presolveActions_ & 1024) == 0;
}
inline void setDoGubrow(bool doGubrow)
{
if (doGubrow)
presolveActions_ &= ~1024;
else
presolveActions_ |= 1024;
}
inline bool doTwoxTwo() const
{
return (presolveActions_ & 2048) != 0;
}
inline void setDoTwoxtwo(bool doTwoxTwo)
{
if (!doTwoxTwo)
presolveActions_ &= ~2048;
else
presolveActions_ |= 2048;
}
inline bool doIntersection() const
{
return (presolveActions_ & 4096) != 0;
}
inline void setDoIntersection(bool doIntersection)
{
if (doIntersection)
presolveActions_ &= ~4096;
else
presolveActions_ |= 4096;
}
inline int zeroSmall() const
{
return (presolveActions_ & (8192 | 16384)) >> 13;
}
inline void setZeroSmall(int value)
{
presolveActions_ &= ~(8192 | 16384);
presolveActions_ |= value << 13;
}
inline int presolveActions() const
{
return presolveActions_ & 0xffffff;
}
inline void setPresolveActions(int action)
{
presolveActions_ = (presolveActions_ & 0xff000000) | (action & 0xffffff);
}
inline void setSubstitution(int value)
{
substitution_ = value;
}
inline void statistics()
{
presolveActions_ |= 0x80000000;
}
int presolveStatus() const;
virtual void postsolve(bool updateStatus = true);
void destroyPresolve();
private:
ClpSimplex *originalModel_;
ClpSimplex *presolvedModel_;
double nonLinearValue_;
int *originalColumn_;
int *originalRow_;
double *rowObjective_;
const CoinPresolveAction *paction_;
int ncols_;
int nrows_;
CoinBigIndex nelems_;
int numberPasses_;
int substitution_;
#ifndef CLP_NO_STD
std::string saveFile_;
#endif
int presolveActions_;
protected:
virtual const CoinPresolveAction *presolve(CoinPresolveMatrix *prob);
virtual void postsolve(CoinPostsolveMatrix &prob);
virtual ClpSimplex *gutsOfPresolvedModel(ClpSimplex *originalModel,
double feasibilityTolerance,
bool keepIntegers,
int numberPasses,
bool dropNames,
bool doRowObjective,
const char *prohibitedRows = NULL,
const char *prohibitedColumns = NULL);
};
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
ClpSimplex.hpp
ClpPresolve::doTwoxTwo
bool doTwoxTwo() const
Whether we want to do twoxtwo part of presolve.
Definition ClpPresolve.hpp:241
ClpPresolve::originalColumns
const int * originalColumns() const
return pointer to original columns
ClpPresolve::setDoDependency
void setDoDependency(bool doDependency)
Definition ClpPresolve.hpp:197
ClpPresolve::setDoTripleton
void setDoTripleton(bool doTripleton)
Definition ClpPresolve.hpp:125
ClpPresolve::setDoForcing
void setDoForcing(bool doForcing)
Definition ClpPresolve.hpp:149
ClpPresolve::setDoTwoxtwo
void setDoTwoxtwo(bool doTwoxTwo)
Definition ClpPresolve.hpp:245
ClpPresolve::setDoDuprow
void setDoDuprow(bool doDuprow)
Definition ClpPresolve.hpp:185
ClpPresolve::doDupcol
bool doDupcol() const
Whether we want to do dupcol part of presolve.
Definition ClpPresolve.hpp:169
ClpPresolve::statistics
void statistics()
Asks for statistics.
Definition ClpPresolve.hpp:290
ClpPresolve::doTighten
bool doTighten() const
Whether we want to do tighten part of presolve.
Definition ClpPresolve.hpp:133
ClpPresolve::ncols_
*The postsolved problem will expand back to its former size *as postsolve transformations are applied *It is efficient to allocate data structures for the final size *of the problem rather than expand them as needed *These fields give the size of the original problem int ncols_
Definition ClpPresolve.hpp:337
ClpPresolve::doSingletonColumn
bool doSingletonColumn() const
Whether we want to do singleton column part of presolve.
Definition ClpPresolve.hpp:217
ClpPresolve::setPresolveActions
void setPresolveActions(int action)
Definition ClpPresolve.hpp:280
ClpPresolve::setDoTighten
void setDoTighten(bool doTighten)
Definition ClpPresolve.hpp:137
ClpPresolve::doIntersection
bool doIntersection() const
Whether we want to allow duplicate intersections.
Definition ClpPresolve.hpp:253
ClpPresolve::numberPasses_
*Number of major passes int numberPasses_
Definition ClpPresolve.hpp:341
ClpPresolve::ClpPresolve
ClpPresolve()
Default constructor.
ClpPresolve::presolveStatus
int presolveStatus() const
Return presolve status (0,1,2).
ClpPresolve::presolvedModelToFile
int presolvedModelToFile(ClpSimplex &si, std::string fileName, double feasibilityTolerance=0.0, bool keepIntegers=true, int numberPasses=5, bool dropNames=false, bool doRowObjective=false)
This version saves data in a file.
ClpPresolve::doDependency
bool doDependency() const
Whether we want to do dependency part of presolve.
Definition ClpPresolve.hpp:193
ClpPresolve::setDoDupcol
void setDoDupcol(bool doDupcol)
Definition ClpPresolve.hpp:173
ClpPresolve::setZeroSmall
void setZeroSmall(int value)
Definition ClpPresolve.hpp:270
ClpPresolve::doSingleton
bool doSingleton() const
Whether we want to do singleton part of presolve.
Definition ClpPresolve.hpp:97
ClpPresolve::nrows_
int nrows_
Definition ClpPresolve.hpp:338
ClpPresolve::setDoDoubleton
void setDoDoubleton(bool doDoubleton)
Definition ClpPresolve.hpp:113
ClpPresolve::doTransfer
bool doTransfer() const
Whether we want to do transfer part of presolve.
Definition ClpPresolve.hpp:205
ClpPresolve::paction_
*The list of transformations applied const CoinPresolveAction * paction_
Definition ClpPresolve.hpp:330
ClpPresolve::originalModel
ClpSimplex * originalModel() const
Return pointer to original model.
ClpPresolve::setDoTransfer
void setDoTransfer(bool doTransfer)
Definition ClpPresolve.hpp:209
ClpPresolve::presolvedModel_
*ClpPresolved model up to user to destroy by deleteClpPresolvedModel ClpSimplex * presolvedModel_
Definition ClpPresolve.hpp:316
ClpPresolve::setDoIntersection
void setDoIntersection(bool doIntersection)
Definition ClpPresolve.hpp:257
ClpPresolve::doDoubleton
bool doDoubleton() const
Whether we want to do doubleton part of presolve.
Definition ClpPresolve.hpp:109
ClpPresolve::setDoImpliedFree
void setDoImpliedFree(bool doImpliedfree)
Definition ClpPresolve.hpp:161
ClpPresolve::gutsOfPresolvedModel
virtual ClpSimplex * gutsOfPresolvedModel(ClpSimplex *originalModel, double feasibilityTolerance, bool keepIntegers, int numberPasses, bool dropNames, bool doRowObjective, const char *prohibitedRows=NULL, const char *prohibitedColumns=NULL)
This is main part of Presolve.
ClpPresolve::originalRows
const int * originalRows() const
return pointer to original rows
ClpPresolve::originalRow_
*Original row numbers int * originalRow_
Definition ClpPresolve.hpp:326
ClpPresolve::setSubstitution
void setSubstitution(int value)
Substitution level.
Definition ClpPresolve.hpp:285
ClpPresolve::doImpliedFree
bool doImpliedFree() const
Whether we want to do impliedfree part of presolve.
Definition ClpPresolve.hpp:157
ClpPresolve::setOriginalModel
void setOriginalModel(ClpSimplex *model)
Set pointer to original model.
ClpPresolve::doDuprow
bool doDuprow() const
Whether we want to do duprow part of presolve.
Definition ClpPresolve.hpp:181
ClpPresolve::nonLinearValue_
double nonLinearValue_
"Magic" number.
Definition ClpPresolve.hpp:322
ClpPresolve::zeroSmall
int zeroSmall() const
How much we want to zero small values from aggregation - ratio 0 - 1.0e-12, 1 1.0e-11,...
Definition ClpPresolve.hpp:266
ClpPresolve::setDoSingleton
void setDoSingleton(bool doSingleton)
Definition ClpPresolve.hpp:101
ClpPresolve::presolve
*If you want to apply the individual presolve routines *or perhaps add your own to the *define a derived class and override this method virtual const CoinPresolveAction * presolve(CoinPresolveMatrix *prob)
ClpPresolve::postsolve
just apply the transformations *in reverse order *You will probably only be interested in overriding this method *if you want to add code to test for consistency *while debugging new presolve virtual techniques void postsolve(CoinPostsolveMatrix &prob)
ClpPresolve::nonLinearValue
double nonLinearValue() const
Definition ClpPresolve.hpp:80
ClpPresolve::presolveActions_
int presolveActions_
Whether we want to skip dual part of presolve etc.
Definition ClpPresolve.hpp:352
ClpPresolve::originalColumn_
*Original column numbers int * originalColumn_
Definition ClpPresolve.hpp:324
ClpPresolve::doGubrow
bool doGubrow() const
Whether we want to do gubrow part of presolve.
Definition ClpPresolve.hpp:229
ClpPresolve::substitution_
*Substitution level int substitution_
Definition ClpPresolve.hpp:343
ClpPresolve::setNonLinearValue
void setNonLinearValue(double value)
"Magic" number.
Definition ClpPresolve.hpp:76
ClpPresolve::setDoSingletonColumn
void setDoSingletonColumn(bool doSingleton)
Definition ClpPresolve.hpp:221
ClpPresolve::originalModel_
*Original model must not be destroyed before postsolve ClpSimplex * originalModel_
Definition ClpPresolve.hpp:313
ClpPresolve::~ClpPresolve
virtual ~ClpPresolve()
Virtual destructor.
ClpPresolve::presolvedModel
ClpSimplex * presolvedModel(ClpSimplex &si, double feasibilityTolerance=0.0, bool keepIntegers=true, int numberPasses=5, bool dropNames=false, bool doRowObjective=false, const char *prohibitedRows=NULL, const char *prohibitedColumns=NULL)
ClpPresolve::setDoDual
void setDoDual(bool doDual)
Definition ClpPresolve.hpp:89
ClpPresolve::doForcing
bool doForcing() const
Whether we want to do forcing part of presolve.
Definition ClpPresolve.hpp:145
ClpPresolve::doTripleton
bool doTripleton() const
Whether we want to do tripleton part of presolve.
Definition ClpPresolve.hpp:121
ClpPresolve::model
ClpSimplex * model() const
Return pointer to presolved model, Up to user to destroy.
ClpPresolve::saveFile_
*Name of saved model file std::string saveFile_
Definition ClpPresolve.hpp:346
ClpPresolve::doDual
bool doDual() const
Whether we want to do dual part of presolve.
Definition ClpPresolve.hpp:85
ClpPresolve::setDoGubrow
void setDoGubrow(bool doGubrow)
Definition ClpPresolve.hpp:233
ClpPresolve::presolveActions
int presolveActions() const
Set whole group.
Definition ClpPresolve.hpp:276
ClpPresolve::nelems_
CoinBigIndex nelems_
Definition ClpPresolve.hpp:339
ClpPresolve::rowObjective_
*Row objective double * rowObjective_
Definition ClpPresolve.hpp:328
ClpSimplex
This solves LPs using the simplex method.
Definition ClpSimplex.hpp:106