Loading...
Searching...
No Matches
OsiDylpWarmStartBasis.hpp
Go to the documentation of this file.
#ifndef OsiDylpWarmStartBasis_H
#define OsiDylpWarmStartBasis_H
/*
sccs: @(#)OsiDylpWarmStartBasis.hpp 1.5 09/16/04
cvs: $Id: OsiDylpWarmStartBasis.hpp 1408 2009-10-04 10:27:59Z stefan $
*/
#include "CoinWarmStartBasis.hpp"
class CoinMessageHandler;
#define DYLP_INTERNAL
extern "C" {
#include "dylp.h"
}
class OsiDylpWarmStartBasis : public CoinWarmStartBasis
{ public:
int numberActiveConstraints() const ;
inline Status getConStatus (int i) const
{ const int st = (constraintStatus_[i>>2] >> ((i&3)<<1)) & 3 ;
return (static_cast<CoinWarmStartBasis::Status>(st)) ; }
inline void setConStatus (int i, Status st)
{ char &st_byte = constraintStatus_[i>>2] ;
st_byte = static_cast<char>(st_byte & ~(3 << ((i&3)<<1))) ;
st_byte = static_cast<char>(st_byte | (st << ((i&3)<<1))) ; }
inline char *getConstraintStatus () { return (constraintStatus_) ; }
inline const char *getConstraintStatus () const
{ return (constraintStatus_) ; }
inline void setPhase (dyphase_enum phase) { phase_ = phase ; }
inline dyphase_enum getPhase () const { return (phase_) ; }
CoinWarmStartDiff *generateDiff (const CoinWarmStart *const oldCWS) const ;
void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ;
void setSize (int ns, int na) ;
void resize (int numRows, int numCols) ;
void compressRows (int tgtCnt, const int *tgts) ;
void deleteRows (int number, const int *which) ;
virtual void mergeBasis(const CoinWarmStartBasis *src,
const XferVec *xferRows,
const XferVec *xferCols) ;
OsiDylpWarmStartBasis () ;
OsiDylpWarmStartBasis (int ns, int na, const char *sStat,
const char *aStat, const char *cStat = 0) ;
OsiDylpWarmStartBasis (const CoinWarmStartBasis &cwsb) ;
OsiDylpWarmStartBasis (const OsiDylpWarmStartBasis &ws) ;
CoinWarmStart *clone () const ;
~OsiDylpWarmStartBasis () ;
OsiDylpWarmStartBasis& operator= (const OsiDylpWarmStartBasis &rhs) ;
void assignBasisStatus
(int ns, int na, char *&sStat, char *&aStat, char *&cStat) ;
void assignBasisStatus
(int ns, int na, char *&sStat, char *&aStat) ;
void print () const ;
void checkBasis (CoinMessageHandler* msghandler = NULL) const ;
private:
dyphase_enum phase_ ;
char *constraintStatus_ ;
} ;
class OsiDylpWarmStartBasisDiff : public CoinWarmStartBasisDiff
{ public:
virtual CoinWarmStartDiff *clone() const
{ OsiDylpWarmStartBasisDiff *odwsbd = new OsiDylpWarmStartBasisDiff(*this) ;
return (dynamic_cast<CoinWarmStartDiff *>(odwsbd)) ; }
virtual
OsiDylpWarmStartBasisDiff &operator= (const OsiDylpWarmStartBasisDiff &rhs) ;
virtual ~OsiDylpWarmStartBasisDiff()
{ delete[] condiffNdxs_ ;
delete[] condiffVals_ ; }
private:
friend CoinWarmStartDiff *OsiDylpWarmStartBasis::generateDiff
(const CoinWarmStart *const oldCWS) const ;
friend void OsiDylpWarmStartBasis::applyDiff
(const CoinWarmStartDiff *const diff) ;
OsiDylpWarmStartBasisDiff (int sze, const unsigned int *const diffNdxs,
const unsigned int *const diffVals,
const CoinWarmStartBasisDiff *const cwsbd) ;
OsiDylpWarmStartBasisDiff ()
: CoinWarmStartBasisDiff(),
consze_(0),
condiffNdxs_(0),
condiffVals_(0)
{ /* intentionally left blank */ }
OsiDylpWarmStartBasisDiff (const OsiDylpWarmStartBasisDiff &odwsbd) ;
/* Data members */
int consze_ ;
unsigned int *condiffNdxs_ ;
unsigned int *condiffVals_ ;
} ;
#endif // OsiDylpWarmStartBasis_H
OsiDylpWarmStartBasisDiff
A ‘diff’ between two OsiDylpWarmStartBasis objects.
Definition OsiDylpWarmStartBasis.hpp:267
OsiDylpWarmStartBasisDiff::operator=
virtual OsiDylpWarmStartBasisDiff & operator=(const OsiDylpWarmStartBasisDiff &rhs)
Assignment.
OsiDylpWarmStartBasisDiff::OsiDylpWarmStartBasisDiff
OsiDylpWarmStartBasisDiff()
Default constructor.
Definition OsiDylpWarmStartBasis.hpp:296
OsiDylpWarmStartBasisDiff::consze_
int consze_
Number of entries (and allocated capacity), in units of int.
Definition OsiDylpWarmStartBasis.hpp:314
OsiDylpWarmStartBasisDiff::clone
virtual CoinWarmStartDiff * clone() const
‘Virtual constructor’
Definition OsiDylpWarmStartBasis.hpp:270
OsiDylpWarmStartBasisDiff::OsiDylpWarmStartBasisDiff
OsiDylpWarmStartBasisDiff(const OsiDylpWarmStartBasisDiff &odwsbd)
Copy constructor.
OsiDylpWarmStartBasisDiff::condiffVals_
unsigned int * condiffVals_
Array of diff values for constraint status.
Definition OsiDylpWarmStartBasis.hpp:322
OsiDylpWarmStartBasisDiff::~OsiDylpWarmStartBasisDiff
virtual ~OsiDylpWarmStartBasisDiff()
Destructor.
Definition OsiDylpWarmStartBasis.hpp:279
OsiDylpWarmStartBasisDiff::condiffNdxs_
unsigned int * condiffNdxs_
Array of diff indices for constraint status.
Definition OsiDylpWarmStartBasis.hpp:318
OsiDylpWarmStartBasisDiff::OsiDylpWarmStartBasisDiff
OsiDylpWarmStartBasisDiff(int sze, const unsigned int *const diffNdxs, const unsigned int *const diffVals, const CoinWarmStartBasisDiff *const cwsbd)
Standard constructor.
OsiDylpWarmStartBasis
The dylp warm start class.
Definition OsiDylpWarmStartBasis.hpp:46
OsiDylpWarmStartBasis::OsiDylpWarmStartBasis
OsiDylpWarmStartBasis(const CoinWarmStartBasis &cwsb)
Construct an OsiDylpWarmStartBasis from a CoinWarmStartBasis.
OsiDylpWarmStartBasis::setPhase
void setPhase(dyphase_enum phase)
Set the lp phase for this basis.
Definition OsiDylpWarmStartBasis.hpp:96
OsiDylpWarmStartBasis::clone
CoinWarmStart * clone() const
‘Virtual constructor’
OsiDylpWarmStartBasis::getConStatus
Status getConStatus(int i) const
Return the status of the specified constraint.
Definition OsiDylpWarmStartBasis.hpp:64
OsiDylpWarmStartBasis::assignBasisStatus
void assignBasisStatus(int ns, int na, char *&sStat, char *&aStat, char *&cStat)
Assign the status vectors to be the warm start information.
OsiDylpWarmStartBasis::numberActiveConstraints
int numberActiveConstraints() const
Return the number of active constraints.
OsiDylpWarmStartBasis::getConstraintStatus
const char * getConstraintStatus() const
const overload for getConstraintStatus()
Definition OsiDylpWarmStartBasis.hpp:89
OsiDylpWarmStartBasis::getConstraintStatus
char * getConstraintStatus()
Return the status array for constraints.
Definition OsiDylpWarmStartBasis.hpp:81
OsiDylpWarmStartBasis::setSize
void setSize(int ns, int na)
Set basis capacity; existing basis is discarded.
OsiDylpWarmStartBasis::setConStatus
void setConStatus(int i, Status st)
Set the status of the specified constraint.
Definition OsiDylpWarmStartBasis.hpp:72
OsiDylpWarmStartBasis::deleteRows
void deleteRows(int number, const int *which)
Delete a set of rows from the basis.
OsiDylpWarmStartBasis::mergeBasis
virtual void mergeBasis(const CoinWarmStartBasis *src, const XferVec *xferRows, const XferVec *xferCols)
Merge entries from a source basis into this basis.
OsiDylpWarmStartBasis::OsiDylpWarmStartBasis
OsiDylpWarmStartBasis()
Default constructor (empty object)
OsiDylpWarmStartBasis::compressRows
void compressRows(int tgtCnt, const int *tgts)
Delete a set of rows from the basis.
OsiDylpWarmStartBasis::resize
void resize(int numRows, int numCols)
Set basis capacity; existing basis is maintained.
OsiDylpWarmStartBasis::applyDiff
void applyDiff(const CoinWarmStartDiff *const cwsdDiff)
Apply diff to this basis.
OsiDylpWarmStartBasis::assignBasisStatus
void assignBasisStatus(int ns, int na, char *&sStat, char *&aStat)
Assign the status vectors to be the warm start information.
OsiDylpWarmStartBasis::phase_
dyphase_enum phase_
dylp phase
Definition OsiDylpWarmStartBasis.hpp:233
OsiDylpWarmStartBasis::constraintStatus_
char * constraintStatus_
vector of constraint status information
Definition OsiDylpWarmStartBasis.hpp:235
OsiDylpWarmStartBasis::generateDiff
CoinWarmStartDiff * generateDiff(const CoinWarmStart *const oldCWS) const
Generate a ‘diff’ that can convert oldBasis to this basis.
OsiDylpWarmStartBasis::operator=
OsiDylpWarmStartBasis & operator=(const OsiDylpWarmStartBasis &rhs)
Assignment.
OsiDylpWarmStartBasis::getPhase
dyphase_enum getPhase() const
Get the lp phase for this basis.
Definition OsiDylpWarmStartBasis.hpp:100
OsiDylpWarmStartBasis::OsiDylpWarmStartBasis
OsiDylpWarmStartBasis(int ns, int na, const char *sStat, const char *aStat, const char *cStat=0)
Constructs a warm start object with the specified status arrays.
OsiDylpWarmStartBasis::OsiDylpWarmStartBasis
OsiDylpWarmStartBasis(const OsiDylpWarmStartBasis &ws)
Copy constructor.
OsiDylpWarmStartBasis::print
void print() const
Prints in readable format (for debug)
OsiDylpWarmStartBasis::checkBasis
void checkBasis(CoinMessageHandler *msghandler=NULL) const
Performs basis consistency checks (for debug)
OsiDylpWarmStartBasis::~OsiDylpWarmStartBasis
~OsiDylpWarmStartBasis()
Destructor.
dylp.h
dyphase_enum
dyphase_enum
Definition dylp.h:212