The default COIN simplex (basis-oriented) warm start class. More...
#include <CoinWarmStartBasis.hpp>
Public Types | |
enum | Status { isFree = 0x00, basic = 0x01, atUpperBound = 0x02, atLowerBound = 0x03 } |
Enum for status of variables. More... | |
typedef CoinTriple< int, int, int > | XferEntry |
Transfer vector entry for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*) More... | |
typedef std::vector< XferEntry > | XferVec |
Transfer vector for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*) 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. More... | |
int | getNumArtificial () const |
Return the number of artificial variables. More... | |
int | numberBasicStructurals () const |
Return the number of basic structurals. More... | |
Status | getStructStatus (int i) const |
Return the status of the specified structural variable. More... | |
void | setStructStatus (int i, Status st) |
Set the status of the specified structural variable. More... | |
char * | getStructuralStatus () |
Return the status array for the structural variables. More... | |
const char * | getStructuralStatus () const |
const overload for getStructuralStatus() More... | |
char * | getArtificialStatus () |
As for getStructuralStatus , but returns the status array for the artificial variables. More... | |
Status | getArtifStatus (int i) const |
Return the status of the specified artificial variable. More... | |
void | setArtifStatus (int i, Status st) |
Set the status of the specified artificial variable. More... | |
const char * | getArtificialStatus () const |
const overload for getArtificialStatus() More... | |
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 . More... | |
virtual void | applyDiff (const CoinWarmStartDiff *const cwsdDiff) |
Apply diff to this basis. More... | |
Methods to modify the warm start object | |
virtual void | setSize (int ns, int na) |
Set basis capacity; existing basis is discarded. More... | |
virtual void | resize (int newNumberRows, int newNumberColumns) |
Set basis capacity; existing basis is maintained. More... | |
virtual void | compressRows (int tgtCnt, const int *tgts) |
Delete a set of rows from the basis. More... | |
virtual void | deleteRows (int rawTgtCnt, const int *rawTgts) |
Delete a set of rows from the basis. More... | |
virtual void | deleteColumns (int number, const int *which) |
Delete a set of columns from the basis. More... | |
virtual void | mergeBasis (const CoinWarmStartBasis *src, const XferVec *xferRows, const XferVec *xferCols) |
Merge entries from a source basis into this basis. More... | |
Constructors, destructors, and related functions | |
CoinWarmStartBasis () | |
Default constructor. More... | |
CoinWarmStartBasis (int ns, int na, const char *sStat, const char *aStat) | |
Constructs a warm start object with the specified status vectors. More... | |
CoinWarmStartBasis (const CoinWarmStartBasis &ws) | |
Copy constructor. More... | |
virtual CoinWarmStart * | clone () const |
`Virtual constructor' More... | |
virtual | ~CoinWarmStartBasis () |
Destructor. More... | |
virtual CoinWarmStartBasis & | operator= (const CoinWarmStartBasis &rhs) |
Assignment. More... | |
virtual void | assignBasisStatus (int ns, int na, char *&sStat, char *&aStat) |
Assign the status vectors to be the warm start information. More... | |
Miscellaneous methods | |
virtual void | print () const |
Prints in readable format (for debug) More... | |
bool | fullBasis () const |
Returns true if full basis (for debug) More... | |
bool | fixFullBasis () |
Returns true if full basis and fixes up (for debug) More... | |
![]() | |
virtual | ~CoinWarmStart () |
Abstract destructor. More... | |
Protected Attributes | |
Protected data members | |
| |
int | numStructural_ |
The number of structural variables. More... | |
int | numArtificial_ |
The number of artificial variables. More... | |
int | maxSize_ |
The maximum sise (in ints - actually 4*char) (so resize does not need to do new) More... | |
char * | structuralStatus_ |
The status of the structural variables. More... | |
char * | artificialStatus_ |
The status of the artificial variables. More... | |
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. More... | |
void | setStatus (char *array, int i, CoinWarmStartBasis::Status st) |
Set the status of the specified variable in the given status array. More... | |
const char * | statusName (CoinWarmStartBasis::Status status) |
Generate a print string for a status code. More... | |
The default COIN simplex (basis-oriented) warm start class.
CoinWarmStartBasis provides for a warm start object which contains the status of each variable (structural and artificial).
Definition at line 40 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 67 of file CoinWarmStartBasis.hpp.
typedef std::vector<XferEntry> CoinWarmStartBasis::XferVec |
Transfer vector for mergeBasis(const CoinWarmStartBasis*,const XferVec*,const XferVec*)
Definition at line 72 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.
Enumerator | |
---|---|
isFree |
Nonbasic free variable. |
basic |
Basic variable. |
atUpperBound |
Nonbasic at upper bound. |
atLowerBound |
Nonbasic at lower bound. |
Definition at line 57 of file CoinWarmStartBasis.hpp.
CoinWarmStartBasis::CoinWarmStartBasis | ( | ) |
Default constructor.
Creates a warm start object representing an empty basis (0 rows, 0 columns).
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 |
Destructor.
|
inline |
Return the number of structural variables.
Definition at line 87 of file CoinWarmStartBasis.hpp.
|
inline |
Return the number of artificial variables.
Definition at line 90 of file CoinWarmStartBasis.hpp.
int CoinWarmStartBasis::numberBasicStructurals | ( | ) | const |
Return the number of basic structurals.
A fast test for an all-slack basis.
|
inline |
Return the status of the specified structural variable.
Definition at line 99 of file CoinWarmStartBasis.hpp.
Set the status of the specified structural variable.
Definition at line 105 of file CoinWarmStartBasis.hpp.
|
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 116 of file CoinWarmStartBasis.hpp.
|
inline |
const
overload for getStructuralStatus()
Definition at line 123 of file CoinWarmStartBasis.hpp.
|
inline |
As for getStructuralStatus , but returns the status array for the artificial variables.
Definition at line 128 of file CoinWarmStartBasis.hpp.
|
inline |
Return the status of the specified artificial variable.
Definition at line 131 of file CoinWarmStartBasis.hpp.
Set the status of the specified artificial variable.
Definition at line 137 of file CoinWarmStartBasis.hpp.
|
inline |
const
overload for getArtificialStatus()
Definition at line 148 of file CoinWarmStartBasis.hpp.
|
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.
|
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.
|
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 AbcWarmStart.
|
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 AbcWarmStart.
|
virtual |
Delete a set of rows from the basis.
Removal of a tight constraint with a nonbasic logical implies that some basic variable must be made nonbasic. This correction is left to the client.
Reimplemented in AbcWarmStart.
|
virtual |
Delete a set of rows from the basis.
Removal of a tight constraint with a nonbasic logical implies that some basic variable must be made nonbasic. This correction is left to the client.
Reimplemented in AbcWarmStart.
|
virtual |
Delete a set of columns from the basis.
Removal of a basic variable implies that some nonbasic variable must be made basic. This correction is left to the client.
Reimplemented in AbcWarmStart.
|
virtual |
Merge entries from a source basis into this basis.
The vector xferCols (xferRows) specifies runs of entries to be taken from the source basis and placed in this basis. Each entry is a CoinTriple, with first specifying the starting source index of a run, second specifying the starting destination index, and third specifying the run length.
|
inlinevirtual |
`Virtual constructor'
Implements CoinWarmStart.
Reimplemented in AbcWarmStart.
Definition at line 284 of file CoinWarmStartBasis.hpp.
|
virtual |
Assignment.
|
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 AbcWarmStart.
|
virtual |
Prints in readable format (for debug)
bool CoinWarmStartBasis::fullBasis | ( | ) | const |
Returns true if full basis (for debug)
bool CoinWarmStartBasis::fixFullBasis | ( | ) |
Returns true if full basis and fixes up (for debug)
|
related |
Get the status of the specified variable in the given status array.
Definition at line 351 of file CoinWarmStartBasis.hpp.
|
related |
Set the status of the specified variable in the given status array.
Definition at line 360 of file CoinWarmStartBasis.hpp.
|
related |
Generate a print string for a status code.
|
protected |
The number of structural variables.
Definition at line 334 of file CoinWarmStartBasis.hpp.
|
protected |
The number of artificial variables.
Definition at line 336 of file CoinWarmStartBasis.hpp.
|
protected |
The maximum sise (in ints - actually 4*char) (so resize does not need to do new)
Definition at line 338 of file CoinWarmStartBasis.hpp.
|
protected |
The status of the structural variables.
Definition at line 340 of file CoinWarmStartBasis.hpp.
|
protected |
The status of the artificial variables.
Definition at line 342 of file CoinWarmStartBasis.hpp.