#include <CoinWarmStartBasis.hpp>
Inheritance diagram for CoinWarmStartBasis:
Public Types | |
typedef CoinTriple< int, int, int > | XferEntry |
Transfer vector entry for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*). | |
typedef std::vector< XferEntry > | XferVec |
Transfer vector for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*). | |
isFree = 0x00 | |
Nonbasic free variable. | |
basic = 0x01 | |
Basic variable. | |
atUpperBound = 0x02 | |
Nonbasic at upper bound. | |
atLowerBound = 0x03 | |
Nonbasic at lower bound. | |
enum | Status { isFree = 0x00, basic = 0x01, atUpperBound = 0x02, atLowerBound = 0x03 } |
Enum for status of variables. More... | |
Public Member Functions | |
Methods to get and set basis information. | |
The status of variables is kept in a pair of arrays, one for structural variables, and one for artificials (aka logicals and slacks). The status is coded using the values of the Status enum.
| |
int | getNumStructural () const |
Return the number of structural variables. | |
int | getNumArtificial () const |
Return the number of artificial variables. | |
int | numberBasicStructurals () const |
Return the number of basic structurals. | |
Status | getStructStatus (int i) const |
Return the status of the specified structural variable. | |
void | setStructStatus (int i, Status st) |
Set the status of the specified structural variable. | |
char * | getStructuralStatus () |
Return the status array for the structural variables. | |
const char * | getStructuralStatus () const |
const overload for getStructuralStatus() | |
char * | getArtificialStatus () |
As for getStructuralStatus , but returns the status array for the artificial variables. | |
Status | getArtifStatus (int i) const |
Return the status of the specified artificial variable. | |
void | setArtifStatus (int i, Status st) |
Set the status of the specified artificial variable. | |
const char * | getArtificialStatus () const |
const overload for getArtificialStatus() | |
Basis `diff' methods | |
virtual CoinWarmStartDiff * | generateDiff (const CoinWarmStart *const oldCWS) const |
Generate a `diff' that can convert the warm start basis passed as a parameter to the warm start basis specified by this . | |
virtual void | applyDiff (const CoinWarmStartDiff *const cwsdDiff) |
Apply diff to this basis. | |
Methods to modify the warm start object | |
virtual void | setSize (int ns, int na) |
Set basis capacity; existing basis is discarded. | |
virtual void | resize (int newNumberRows, int newNumberColumns) |
Set basis capacity; existing basis is maintained. | |
virtual void | compressRows (int tgtCnt, const int *tgts) |
Delete a set of rows from the basis. | |
virtual void | deleteRows (int rawTgtCnt, const int *rawTgts) |
Delete a set of rows from the basis. | |
virtual void | deleteColumns (int number, const int *which) |
Delete a set of columns from the basis. | |
virtual void | mergeBasis (const CoinWarmStartBasis *src, const XferVec *xferRows, const XferVec *xferCols) |
Merge entries from a source basis into this basis. | |
Constructors, destructors, and related functions | |
CoinWarmStartBasis () | |
Default constructor. | |
CoinWarmStartBasis (int ns, int na, const char *sStat, const char *aStat) | |
Constructs a warm start object with the specified status vectors. | |
CoinWarmStartBasis (const CoinWarmStartBasis &ws) | |
Copy constructor. | |
virtual CoinWarmStart * | clone () const |
`Virtual constructor' | |
virtual | ~CoinWarmStartBasis () |
Destructor. | |
virtual CoinWarmStartBasis & | operator= (const CoinWarmStartBasis &rhs) |
Assignment. | |
virtual void | assignBasisStatus (int ns, int na, char *&sStat, char *&aStat) |
Assign the status vectors to be the warm start information. | |
Miscellaneous methods | |
virtual void | print () const |
Prints in readable format (for debug). | |
Protected Attributes | |
Protected data members | |
int | numStructural_ |
The number of structural variables. | |
int | numArtificial_ |
The number of artificial variables. | |
int | maxSize_ |
The maximum sise (in ints - actually 4*char) (so resize does not need to do new). | |
char * | structuralStatus_ |
The status of the structural variables. | |
char * | artificialStatus_ |
The status of the artificial variables. | |
Related Functions | |
(Note that these are not member functions.) | |
CoinWarmStartBasis::Status | getStatus (const char *array, int i) |
Get the status of the specified variable in the given status array. | |
void | setStatus (char *array, int i, CoinWarmStartBasis::Status st) |
Set the status of the specified variable in the given status array. |
CoinWarmStartBasis provides for a warm start object which contains the status of each variable (structural and artificial).
Definition at line 38 of file CoinWarmStartBasis.hpp.
typedef CoinTriple<int,int,int> CoinWarmStartBasis::XferEntry |
Transfer vector entry for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*).
Definition at line 65 of file CoinWarmStartBasis.hpp.
typedef std::vector<XferEntry> CoinWarmStartBasis::XferVec |
Transfer vector for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*).
Definition at line 70 of file CoinWarmStartBasis.hpp.
Enum for status of variables.
Matches CoinPrePostsolveMatrix::Status, without superBasic. Most code that converts between CoinPrePostsolveMatrix::Status and CoinWarmStartBasis::Status will break if this correspondence is broken.
The status vectors are currently packed using two bits per status code, four codes per byte. The location of the status information for variable i
is in byte i>>2
and occupies bits 0:1 if i%4 == 0
, bits 2:3 if i%4 == 1
, etc. The non-member functions getStatus(const char*,int) and setStatus(char*,int,CoinWarmStartBasis::Status) are provided to hide details of the packing.
isFree | Nonbasic free variable. |
basic | Basic variable. |
atUpperBound | Nonbasic at upper bound. |
atLowerBound | Nonbasic at lower bound. |
Definition at line 55 of file CoinWarmStartBasis.hpp.
CoinWarmStartBasis::CoinWarmStartBasis | ( | ) |
Default constructor.
Creates a warm start object representing an empty basis (0 rows, 0 columns).
Referenced by clone().
CoinWarmStartBasis::CoinWarmStartBasis | ( | int | ns, | |
int | na, | |||
const char * | sStat, | |||
const char * | aStat | |||
) |
Constructs a warm start object with the specified status vectors.
The parameters are copied. Consider assignBasisStatus(int,int,char*&,char*&) if the object should assume ownership.
CoinWarmStartBasis::CoinWarmStartBasis | ( | const CoinWarmStartBasis & | ws | ) |
Copy constructor.
virtual CoinWarmStartBasis::~CoinWarmStartBasis | ( | ) | [virtual] |
Destructor.
int CoinWarmStartBasis::getNumStructural | ( | ) | const [inline] |
Return the number of structural variables.
Definition at line 85 of file CoinWarmStartBasis.hpp.
References numStructural_.
int CoinWarmStartBasis::getNumArtificial | ( | ) | const [inline] |
Return the number of artificial variables.
Definition at line 88 of file CoinWarmStartBasis.hpp.
References numArtificial_.
int CoinWarmStartBasis::numberBasicStructurals | ( | ) | const |
Return the number of basic structurals.
A fast test for an all-slack basis.
Status CoinWarmStartBasis::getStructStatus | ( | int | i | ) | const [inline] |
Return the status of the specified structural variable.
Definition at line 97 of file CoinWarmStartBasis.hpp.
References structuralStatus_.
void CoinWarmStartBasis::setStructStatus | ( | int | i, | |
Status | st | |||
) | [inline] |
Set the status of the specified structural variable.
Definition at line 103 of file CoinWarmStartBasis.hpp.
References structuralStatus_.
char* CoinWarmStartBasis::getStructuralStatus | ( | ) | [inline] |
Return the status array for the structural variables.
The status information is stored using the codes defined in the Status enum, 2 bits per variable, packed 4 variables per byte.
Definition at line 114 of file CoinWarmStartBasis.hpp.
References structuralStatus_.
const char* CoinWarmStartBasis::getStructuralStatus | ( | ) | const [inline] |
const
overload for getStructuralStatus()
Definition at line 121 of file CoinWarmStartBasis.hpp.
References structuralStatus_.
char* CoinWarmStartBasis::getArtificialStatus | ( | ) | [inline] |
As for getStructuralStatus , but returns the status array for the artificial variables.
Definition at line 126 of file CoinWarmStartBasis.hpp.
References artificialStatus_.
Status CoinWarmStartBasis::getArtifStatus | ( | int | i | ) | const [inline] |
Return the status of the specified artificial variable.
Definition at line 129 of file CoinWarmStartBasis.hpp.
References artificialStatus_.
void CoinWarmStartBasis::setArtifStatus | ( | int | i, | |
Status | st | |||
) | [inline] |
Set the status of the specified artificial variable.
Definition at line 135 of file CoinWarmStartBasis.hpp.
References artificialStatus_.
const char* CoinWarmStartBasis::getArtificialStatus | ( | ) | const [inline] |
const
overload for getArtificialStatus()
Definition at line 146 of file CoinWarmStartBasis.hpp.
References artificialStatus_.
virtual CoinWarmStartDiff* CoinWarmStartBasis::generateDiff | ( | const CoinWarmStart *const | oldCWS | ) | const [virtual] |
Generate a `diff' that can convert the warm start basis passed as a parameter to the warm start basis specified by this
.
The capabilities are limited: the basis passed as a parameter can be no larger than the basis pointed to by this
.
Reimplemented from CoinWarmStart.
Reimplemented in OsiDylpWarmStartBasis.
virtual void CoinWarmStartBasis::applyDiff | ( | const CoinWarmStartDiff *const | cwsdDiff | ) | [virtual] |
Apply diff
to this basis.
Update this basis by applying diff
. It's assumed that the allocated capacity of the basis is sufficiently large.
Reimplemented from CoinWarmStart.
Reimplemented in OsiDylpWarmStartBasis.
virtual void CoinWarmStartBasis::setSize | ( | int | ns, | |
int | na | |||
) | [virtual] |
Set basis capacity; existing basis is discarded.
After execution of this routine, the warm start object does not describe a valid basis: all structural and artificial variables have status isFree.
Reimplemented in OsiDylpWarmStartBasis.
virtual void CoinWarmStartBasis::resize | ( | int | newNumberRows, | |
int | newNumberColumns | |||
) | [virtual] |
Set basis capacity; existing basis is maintained.
After execution of this routine, the warm start object describes a valid basis: the status of new structural variables (added columns) is set to nonbasic at lower bound, and the status of new artificial variables (added rows) is set to basic. (The basis can be invalid if new structural variables do not have a finite lower bound.)
Reimplemented in OsiDylpWarmStartBasis.
virtual void CoinWarmStartBasis::compressRows | ( | int | tgtCnt, | |
const int * | tgts | |||
) | [virtual] |
Delete a set of rows from the basis.
The resulting basis is guaranteed valid only if all deleted constraints are slack (hence the associated logicals are basic).
Reimplemented in OsiDylpWarmStartBasis.
virtual void CoinWarmStartBasis::deleteRows | ( | int | rawTgtCnt, | |
const int * | rawTgts | |||
) | [virtual] |
Delete a set of rows from the basis.
Reimplemented in OsiDylpWarmStartBasis.
virtual void CoinWarmStartBasis::deleteColumns | ( | int | number, | |
const int * | which | |||
) | [virtual] |
Delete a set of columns from the basis.
virtual void CoinWarmStartBasis::mergeBasis | ( | const CoinWarmStartBasis * | src, | |
const XferVec * | xferRows, | |||
const XferVec * | xferCols | |||
) | [virtual] |
Merge entries from a source basis into this basis.
virtual CoinWarmStart* CoinWarmStartBasis::clone | ( | ) | const [inline, virtual] |
`Virtual constructor'
Implements CoinWarmStart.
Reimplemented in OsiDylpWarmStartBasis.
Definition at line 282 of file CoinWarmStartBasis.hpp.
References CoinWarmStartBasis().
virtual CoinWarmStartBasis& CoinWarmStartBasis::operator= | ( | const CoinWarmStartBasis & | rhs | ) | [virtual] |
Assignment.
virtual void CoinWarmStartBasis::assignBasisStatus | ( | int | ns, | |
int | na, | |||
char *& | sStat, | |||
char *& | aStat | |||
) | [virtual] |
Assign the status vectors to be the warm start information.
In this method the CoinWarmStartBasis object assumes ownership of the pointers and upon return the argument pointers will be NULL. If copying is desirable, use the array constructor or the assignment operator .
Reimplemented in OsiDylpWarmStartBasis.
virtual void CoinWarmStartBasis::print | ( | ) | const [virtual] |
CoinWarmStartBasis::Status getStatus | ( | const char * | array, | |
int | i | |||
) | [related] |
Get the status of the specified variable in the given status array.
Definition at line 345 of file CoinWarmStartBasis.hpp.
void setStatus | ( | char * | array, | |
int | i, | |||
CoinWarmStartBasis::Status | st | |||
) | [related] |
Set the status of the specified variable in the given status array.
Definition at line 354 of file CoinWarmStartBasis.hpp.
int CoinWarmStartBasis::numStructural_ [protected] |
The number of structural variables.
Definition at line 328 of file CoinWarmStartBasis.hpp.
Referenced by getNumStructural().
int CoinWarmStartBasis::numArtificial_ [protected] |
The number of artificial variables.
Definition at line 330 of file CoinWarmStartBasis.hpp.
Referenced by getNumArtificial().
int CoinWarmStartBasis::maxSize_ [protected] |
The maximum sise (in ints - actually 4*char) (so resize does not need to do new).
Definition at line 332 of file CoinWarmStartBasis.hpp.
char* CoinWarmStartBasis::structuralStatus_ [protected] |
The status of the structural variables.
Definition at line 334 of file CoinWarmStartBasis.hpp.
Referenced by getStructStatus(), getStructuralStatus(), and setStructStatus().
char* CoinWarmStartBasis::artificialStatus_ [protected] |
The status of the artificial variables.
Definition at line 336 of file CoinWarmStartBasis.hpp.
Referenced by getArtificialStatus(), getArtifStatus(), and setArtifStatus().