Loading...
Searching...
No Matches
ClpPrimalColumnSteepest.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 ClpPrimalColumnSteepest_H
#define ClpPrimalColumnSteepest_H
#include "ClpPrimalColumnPivot.hpp"
#include <bitset>
//#############################################################################
class CoinIndexedVector;
class ClpPrimalColumnSteepest : public ClpPrimalColumnPivot {
public:
virtual int pivotColumn(CoinIndexedVector *updates,
CoinIndexedVector *spareRow1,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
int pivotColumnOldMethod(CoinIndexedVector *updates,
CoinIndexedVector *spareRow1,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
void justDjs(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
int partialPricing(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
int numberWanted,
int numberLook);
void djsAndDevex(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
void djsAndSteepest(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
void djsAndDevex2(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
void djsAndSteepest2(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
void justDevex(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
void justSteepest(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1,
CoinIndexedVector *spareColumn2);
int transposeTimes2(const CoinIndexedVector *pi1, CoinIndexedVector *dj1,
const CoinIndexedVector *pi2, CoinIndexedVector *dj2,
CoinIndexedVector *spare, double scaleFactor);
virtual void updateWeights(CoinIndexedVector *input);
void checkAccuracy(int sequence, double relativeTolerance,
CoinIndexedVector *rowArray1,
CoinIndexedVector *rowArray2);
void initializeWeights();
virtual void saveWeights(ClpSimplex *model, int mode);
void redoInfeasibilities();
virtual void unrollWeights();
virtual void clearArrays();
virtual bool looksOptimal() const;
virtual void maximumPivotsChanged();
inline int mode() const
{
return mode_;
}
inline void setMode(int mode)
{
mode_ = mode;
}
inline CoinIndexedVector *infeasible() const
{
return infeasible_;
}
inline const double *weights() const
{
return weights_;
}
inline CoinIndexedVector *alternateWeights() const
{
return alternateWeights_;
}
virtual int numberSprintColumns(int &numberIterations) const;
virtual void switchOffSprint();
enum Persistence {
normal = 0x00, // create (if necessary) and destroy
keep = 0x01 // create (if necessary) and leave
};
ClpPrimalColumnSteepest(int mode = 3);
ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest &rhs);
ClpPrimalColumnSteepest &operator=(const ClpPrimalColumnSteepest &rhs);
virtual ~ClpPrimalColumnSteepest();
virtual ClpPrimalColumnPivot *clone(bool copyData = true) const;
inline bool reference(int i) const
{
return ((reference_[i >> 5] >> (i & 31)) & 1) != 0;
}
inline void setReference(int i, bool trueFalse)
{
unsigned int &value = reference_[i >> 5];
int bit = i & 31;
if (trueFalse)
value |= (1 << bit);
else
value &= ~(1 << bit);
}
inline void setPersistence(Persistence life)
{
persistence_ = life;
}
inline Persistence persistence() const
{
return persistence_;
}
//---------------------------------------------------------------------------
protected:
// Update weight
double devex_;
double *weights_;
CoinIndexedVector *infeasible_;
CoinIndexedVector *alternateWeights_;
double *savedWeights_;
// Array for exact devex to say what is in reference framework
unsigned int *reference_;
int state_;
int mode_;
/* Infeasibility state i.e. array of infeasibilities and sequenceIn-
0 - correct
1 - needs correcting
2 - not known but column sequence has been chosen
*/
int infeasibilitiesState_;
Persistence persistence_;
int numberSwitched_;
// This is pivot row (or pivot sequence round re-factorization)
int pivotSequence_;
// This is saved pivot sequence
int savedPivotSequence_;
// This is saved outgoing variable
int savedSequenceOut_;
// Iteration when last rectified
int lastRectified_;
// Size of factorization at invert (used to decide algorithm)
int sizeFactorization_;
};
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
ClpPrimalColumnPivot.hpp
ClpPrimalColumnPivot::model
ClpSimplex * model()
Returns model.
Definition ClpPrimalColumnPivot.hpp:117
ClpPrimalColumnPivot::ClpPrimalColumnPivot
ClpPrimalColumnPivot()
Default Constructor.
ClpPrimalColumnSteepest::pivotColumnOldMethod
int pivotColumnOldMethod(CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
For quadratic or funny nonlinearities.
ClpPrimalColumnSteepest::alternateWeights_
CoinIndexedVector * alternateWeights_
alternate weight array (so we can unroll)
Definition ClpPrimalColumnSteepest.hpp:231
ClpPrimalColumnSteepest::updateWeights
virtual void updateWeights(CoinIndexedVector *input)
Updates weights - part 1 - also checks accuracy.
ClpPrimalColumnSteepest::clone
virtual ClpPrimalColumnPivot * clone(bool copyData=true) const
Clone.
ClpPrimalColumnSteepest::reference
bool reference(int i) const
reference would be faster using ClpSimplex's status_, but I prefer to keep modularity.
Definition ClpPrimalColumnSteepest.hpp:196
ClpPrimalColumnSteepest::operator=
ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest &rhs)
Assignment operator.
ClpPrimalColumnSteepest::savedPivotSequence_
int savedPivotSequence_
Definition ClpPrimalColumnSteepest.hpp:268
ClpPrimalColumnSteepest::justDevex
void justDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update weights for Devex.
ClpPrimalColumnSteepest::reference_
unsigned int * reference_
Definition ClpPrimalColumnSteepest.hpp:235
ClpPrimalColumnSteepest::looksOptimal
virtual bool looksOptimal() const
Returns true if would not find any column.
ClpPrimalColumnSteepest::~ClpPrimalColumnSteepest
virtual ~ClpPrimalColumnSteepest()
Destructor.
ClpPrimalColumnSteepest::clearArrays
virtual void clearArrays()
Gets rid of all arrays.
ClpPrimalColumnSteepest::djsAndSteepest
void djsAndSteepest(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Steepest using djs sets best sequence (possibly).
ClpPrimalColumnSteepest::numberSwitched_
int numberSwitched_
Number of times switched from partial dantzig to 0/2.
Definition ClpPrimalColumnSteepest.hpp:264
ClpPrimalColumnSteepest::mode_
int mode_
0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 and 2 depending on f...
Definition ClpPrimalColumnSteepest.hpp:254
ClpPrimalColumnSteepest::justDjs
void justDjs(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Just update djs.
ClpPrimalColumnSteepest::numberSprintColumns
virtual int numberSprintColumns(int &numberIterations) const
Returns number of extra columns for sprint algorithm - 0 means off.
ClpPrimalColumnSteepest::infeasible
CoinIndexedVector * infeasible() const
square of infeasibility array (just for infeasible columns)
Definition ClpPrimalColumnSteepest.hpp:136
ClpPrimalColumnSteepest::pivotSequence_
int pivotSequence_
Definition ClpPrimalColumnSteepest.hpp:266
ClpPrimalColumnSteepest::alternateWeights
CoinIndexedVector * alternateWeights() const
alternate weight array
Definition ClpPrimalColumnSteepest.hpp:146
ClpPrimalColumnSteepest::justSteepest
void justSteepest(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update weights for Steepest.
ClpPrimalColumnSteepest::transposeTimes2
int transposeTimes2(const CoinIndexedVector *pi1, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *dj2, CoinIndexedVector *spare, double scaleFactor)
Updates two arrays for steepest.
ClpPrimalColumnSteepest::switchOffSprint
virtual void switchOffSprint()
Switch off sprint idea.
ClpPrimalColumnSteepest::saveWeights
virtual void saveWeights(ClpSimplex *model, int mode)
Save weights - this may initialize weights as well mode is - 1) before factorization 2) after factori...
ClpPrimalColumnSteepest::djsAndDevex2
void djsAndDevex2(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Devex using pivot row.
ClpPrimalColumnSteepest::setPersistence
void setPersistence(Persistence life)
Set/ get persistence.
Definition ClpPrimalColumnSteepest.hpp:210
ClpPrimalColumnSteepest::sizeFactorization_
int sizeFactorization_
Definition ClpPrimalColumnSteepest.hpp:274
ClpPrimalColumnSteepest::setMode
void setMode(int mode)
Set mode.
Definition ClpPrimalColumnSteepest.hpp:131
ClpPrimalColumnSteepest::maximumPivotsChanged
virtual void maximumPivotsChanged()
Called when maximum pivots changes.
ClpPrimalColumnSteepest::ClpPrimalColumnSteepest
ClpPrimalColumnSteepest(int mode=3)
Default Constructor 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 ...
ClpPrimalColumnSteepest::weights_
double * weights_
weight array
Definition ClpPrimalColumnSteepest.hpp:227
ClpPrimalColumnSteepest::savedWeights_
double * savedWeights_
save weight array (so we can use checkpoint)
Definition ClpPrimalColumnSteepest.hpp:233
ClpPrimalColumnSteepest::djsAndSteepest2
void djsAndSteepest2(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Steepest using pivot row.
ClpPrimalColumnSteepest::setReference
void setReference(int i, bool trueFalse)
Definition ClpPrimalColumnSteepest.hpp:200
ClpPrimalColumnSteepest::state_
int state_
Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number.
Definition ClpPrimalColumnSteepest.hpp:241
ClpPrimalColumnSteepest::persistence_
Persistence persistence_
Life of weights.
Definition ClpPrimalColumnSteepest.hpp:262
ClpPrimalColumnSteepest::weights
const double * weights() const
Weights.
Definition ClpPrimalColumnSteepest.hpp:141
ClpPrimalColumnSteepest::persistence
Persistence persistence() const
Definition ClpPrimalColumnSteepest.hpp:214
ClpPrimalColumnSteepest::infeasible_
CoinIndexedVector * infeasible_
square of infeasibility array (just for infeasible columns)
Definition ClpPrimalColumnSteepest.hpp:229
ClpPrimalColumnSteepest::mode
int mode() const
Mode.
Definition ClpPrimalColumnSteepest.hpp:126
ClpPrimalColumnSteepest::savedSequenceOut_
int savedSequenceOut_
Definition ClpPrimalColumnSteepest.hpp:270
ClpPrimalColumnSteepest::infeasibilitiesState_
int infeasibilitiesState_
Definition ClpPrimalColumnSteepest.hpp:260
ClpPrimalColumnSteepest::initializeWeights
void initializeWeights()
Initialize weights.
ClpPrimalColumnSteepest::partialPricing
int partialPricing(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, int numberWanted, int numberLook)
Update djs doing partial pricing (dantzig).
ClpPrimalColumnSteepest::redoInfeasibilities
void redoInfeasibilities()
redo infeasibilities
ClpPrimalColumnSteepest::devex_
double devex_
Definition ClpPrimalColumnSteepest.hpp:225
ClpPrimalColumnSteepest::checkAccuracy
void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector *rowArray1, CoinIndexedVector *rowArray2)
Checks accuracy - just for debug.
ClpPrimalColumnSteepest::unrollWeights
virtual void unrollWeights()
Gets rid of last update.
ClpPrimalColumnSteepest::ClpPrimalColumnSteepest
ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest &rhs)
Copy constructor.
ClpPrimalColumnSteepest::lastRectified_
int lastRectified_
Definition ClpPrimalColumnSteepest.hpp:272
ClpPrimalColumnSteepest::Persistence
Persistence
enums for persistence
Definition ClpPrimalColumnSteepest.hpp:161
ClpPrimalColumnSteepest::keep
@ keep
Definition ClpPrimalColumnSteepest.hpp:163
ClpPrimalColumnSteepest::normal
@ normal
Definition ClpPrimalColumnSteepest.hpp:162
ClpPrimalColumnSteepest::pivotColumn
virtual int pivotColumn(CoinIndexedVector *updates, CoinIndexedVector *spareRow1, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Returns pivot column, -1 if none.
ClpPrimalColumnSteepest::djsAndDevex
void djsAndDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1, CoinIndexedVector *spareColumn2)
Update djs, weights for Devex using djs.
ClpSimplex
This solves LPs using the simplex method.
Definition ClpSimplex.hpp:106