Loading...
Searching...
No Matches
AbcPrimalColumnSteepest.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 AbcPrimalColumnSteepest_H
#define AbcPrimalColumnSteepest_H
#include "AbcPrimalColumnPivot.hpp"
#include <bitset>
//#############################################################################
class CoinIndexedVector;
class AbcPrimalColumnSteepest : public AbcPrimalColumnPivot {
public:
virtual int pivotColumn(CoinPartitionedVector *updates,
CoinPartitionedVector *spareRow2,
CoinPartitionedVector *spareColumn1);
void justDjs(CoinIndexedVector *updates,
CoinIndexedVector *spareColumn1);
int partialPricing(CoinIndexedVector *updates,
int numberWanted,
int numberLook);
void djsAndDevex(CoinIndexedVector *updates,
CoinIndexedVector *spareRow2,
CoinIndexedVector *spareColumn1);
void djsAndDevex2(CoinIndexedVector *updates,
CoinIndexedVector *spareColumn1);
void justDevex(CoinIndexedVector *updates,
CoinIndexedVector *spareColumn1);
int doSteepestWork(CoinPartitionedVector *updates,
CoinPartitionedVector *spareRow2,
CoinPartitionedVector *spareColumn1,
int type);
virtual void updateWeights(CoinIndexedVector *input);
void checkAccuracy(int sequence, double relativeTolerance,
CoinIndexedVector *rowArray1);
void initializeWeights();
virtual void saveWeights(AbcSimplex *model, int mode);
virtual void unrollWeights();
virtual void clearArrays();
virtual bool looksOptimal() const;
virtual void maximumPivotsChanged();
inline int mode() const
{
return mode_;
}
enum Persistence {
normal = 0x00, // create (if necessary) and destroy
keep = 0x01 // create (if necessary) and leave
};
AbcPrimalColumnSteepest(int mode = 3);
AbcPrimalColumnSteepest(const AbcPrimalColumnSteepest &rhs);
AbcPrimalColumnSteepest &operator=(const AbcPrimalColumnSteepest &rhs);
virtual ~AbcPrimalColumnSteepest();
virtual AbcPrimalColumnPivot *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_;
}
//---------------------------------------------------------------------------
private:
// 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_;
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
*/
AbcPrimalColumnPivot.hpp
AbcSimplex
#define AbcSimplex
Definition AbcWarmStart.hpp:16
AbcPrimalColumnPivot::model
AbcSimplex * model()
Returns model.
Definition AbcPrimalColumnPivot.hpp:116
AbcPrimalColumnPivot::AbcPrimalColumnPivot
AbcPrimalColumnPivot()
Default Constructor.
AbcPrimalColumnPivot::type
int type()
Returns type (above 63 is extra information).
Definition AbcPrimalColumnPivot.hpp:127
AbcPrimalColumnSteepest::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 AbcPrimalColumnSteepest.hpp:199
AbcPrimalColumnSteepest::initializeWeights
void initializeWeights()
Initialize weights.
AbcPrimalColumnSteepest::djsAndDevex
void djsAndDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1)
Update djs, weights for Devex using djs.
AbcPrimalColumnSteepest::setPersistence
void setPersistence(Persistence life)
Set/ get persistence.
Definition AbcPrimalColumnSteepest.hpp:155
AbcPrimalColumnSteepest::reference
bool reference(int i) const
reference would be faster using AbcSimplex's status_, but I prefer to keep modularity.
Definition AbcPrimalColumnSteepest.hpp:141
AbcPrimalColumnSteepest::doSteepestWork
int doSteepestWork(CoinPartitionedVector *updates, CoinPartitionedVector *spareRow2, CoinPartitionedVector *spareColumn1, int type)
Does steepest work type - 0 - just djs 1 - just steepest 2 - both using scaleFactor 3 - both using ex...
AbcPrimalColumnSteepest::AbcPrimalColumnSteepest
AbcPrimalColumnSteepest(const AbcPrimalColumnSteepest &rhs)
Copy constructor.
AbcPrimalColumnSteepest::updateWeights
virtual void updateWeights(CoinIndexedVector *input)
Updates weights - part 1 - also checks accuracy.
AbcPrimalColumnSteepest::justDevex
void justDevex(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Update weights for Devex.
AbcPrimalColumnSteepest::persistence_
Persistence persistence_
Life of weights.
Definition AbcPrimalColumnSteepest.hpp:201
AbcPrimalColumnSteepest::justDjs
void justDjs(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Just update djs.
AbcPrimalColumnSteepest::lastRectified_
int lastRectified_
Definition AbcPrimalColumnSteepest.hpp:211
AbcPrimalColumnSteepest::infeasible_
CoinIndexedVector * infeasible_
square of infeasibility array (just for infeasible columns)
Definition AbcPrimalColumnSteepest.hpp:174
AbcPrimalColumnSteepest::sizeFactorization_
int sizeFactorization_
Definition AbcPrimalColumnSteepest.hpp:213
AbcPrimalColumnSteepest::numberSwitched_
int numberSwitched_
Number of times switched from partial dantzig to 0/2.
Definition AbcPrimalColumnSteepest.hpp:203
AbcPrimalColumnSteepest::pivotSequence_
int pivotSequence_
Definition AbcPrimalColumnSteepest.hpp:205
AbcPrimalColumnSteepest::savedSequenceOut_
int savedSequenceOut_
Definition AbcPrimalColumnSteepest.hpp:209
AbcPrimalColumnSteepest::unrollWeights
virtual void unrollWeights()
Gets rid of last update.
AbcPrimalColumnSteepest::savedPivotSequence_
int savedPivotSequence_
Definition AbcPrimalColumnSteepest.hpp:207
AbcPrimalColumnSteepest::checkAccuracy
void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector *rowArray1)
Checks accuracy - just for debug.
AbcPrimalColumnSteepest::savedWeights_
double * savedWeights_
save weight array (so we can use checkpoint)
Definition AbcPrimalColumnSteepest.hpp:178
AbcPrimalColumnSteepest::clone
virtual AbcPrimalColumnPivot * clone(bool copyData=true) const
Clone.
AbcPrimalColumnSteepest::~AbcPrimalColumnSteepest
virtual ~AbcPrimalColumnSteepest()
Destructor.
AbcPrimalColumnSteepest::maximumPivotsChanged
virtual void maximumPivotsChanged()
Called when maximum pivots changes.
AbcPrimalColumnSteepest::operator=
AbcPrimalColumnSteepest & operator=(const AbcPrimalColumnSteepest &rhs)
Assignment operator.
AbcPrimalColumnSteepest::djsAndDevex2
void djsAndDevex2(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Update djs, weights for Devex using pivot row.
AbcPrimalColumnSteepest::clearArrays
virtual void clearArrays()
Gets rid of all arrays.
AbcPrimalColumnSteepest::saveWeights
virtual void saveWeights(AbcSimplex *model, int mode)
Save weights - this may initialize weights as well mode is - 1) before factorization 2) after factori...
AbcPrimalColumnSteepest::reference_
unsigned int * reference_
Definition AbcPrimalColumnSteepest.hpp:180
AbcPrimalColumnSteepest::mode
int mode() const
Mode.
Definition AbcPrimalColumnSteepest.hpp:98
AbcPrimalColumnSteepest::alternateWeights_
CoinIndexedVector * alternateWeights_
alternate weight array (so we can unroll)
Definition AbcPrimalColumnSteepest.hpp:176
AbcPrimalColumnSteepest::partialPricing
int partialPricing(CoinIndexedVector *updates, int numberWanted, int numberLook)
Update djs doing partial pricing (dantzig).
AbcPrimalColumnSteepest::setReference
void setReference(int i, bool trueFalse)
Definition AbcPrimalColumnSteepest.hpp:145
AbcPrimalColumnSteepest::AbcPrimalColumnSteepest
AbcPrimalColumnSteepest(int mode=3)
Default Constructor 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 ...
AbcPrimalColumnSteepest::Persistence
Persistence
enums for persistence
Definition AbcPrimalColumnSteepest.hpp:106
AbcPrimalColumnSteepest::keep
@ keep
Definition AbcPrimalColumnSteepest.hpp:108
AbcPrimalColumnSteepest::normal
@ normal
Definition AbcPrimalColumnSteepest.hpp:107
AbcPrimalColumnSteepest::state_
int state_
Status 0) Normal -1) Needs initialization 1) Weights are stored by sequence number.
Definition AbcPrimalColumnSteepest.hpp:186
AbcPrimalColumnSteepest::persistence
Persistence persistence() const
Definition AbcPrimalColumnSteepest.hpp:159
AbcPrimalColumnSteepest::pivotColumn
virtual int pivotColumn(CoinPartitionedVector *updates, CoinPartitionedVector *spareRow2, CoinPartitionedVector *spareColumn1)
Returns pivot column, -1 if none.
AbcPrimalColumnSteepest::devex_
double devex_
Definition AbcPrimalColumnSteepest.hpp:170
AbcPrimalColumnSteepest::looksOptimal
virtual bool looksOptimal() const
Returns true if would not find any column.
AbcPrimalColumnSteepest::weights_
double * weights_
weight array
Definition AbcPrimalColumnSteepest.hpp:172