OS  2.10.2
OSGeneral.h
Go to the documentation of this file.
1 /* $Id: OSGeneral.h 3172 2010-02-05 04:59:24Z Gassmann $ */
15 #ifndef OSGENERAL_H
16 #define OSGENERAL_H
17 
18 #include "OSConfig.h"
19 #include "OSParameters.h"
20 #include "OSnLNode.h"
21 #include "OSExpressionTree.h"
22 
23 #include <string>
24 #include <vector>
25 
26 
27 
33 {
34 public:
35 
39  std::string name;
40 
45  std::string source;
46 
50  std::string description;
51 
55  std::string fileCreator;
56 
60  std::string licence;
61 
62 
68 
74 
80 
88  bool setRandom(double density, bool conformant);
89 
96 
102  std::string getHeaderItem(std::string item);
103 
113  bool setHeader(std::string name, std::string source, std::string description,
114  std::string fileCreator, std::string licence);
115 
116 }; //GeneralFileHeader
117 
118 
123 {
124 public:
125 
132 
138 
144 
150 
154  int number;
155 
159  int* indexes;
160 
164  double* values;
165 
166 }; //SparseVector
167 
172 {
173 public:
174 
181 
187 
193 
199 
203  int number;
204 
210  int* indexes;
211 
215  int* values;
216 
217 }; //SparseIntVector
218 
219 
224 {
225 public:
231 
237 
242 
247 
252  int* starts;
253 
258  int* indexes;
259 
264  double* values;
265 
271 
280  SparseMatrix(bool isColumnMajor_, int startSize, int valueSize);
286 
292  bool display(int secondaryDim);
293 
294 }; //SparseMatrix
295 
296 
301 {
302 public:
303 
309 
314 
319 
324  int* starts;
325 
330  int* conVals;
331 
335  int* indexes;
336 
340  double* values;
341 
347 
355 
361 
362 }; //SparseJacobianMatrix
363 
364 
365 
377 {
378 public:
379 
385 
390 
395 
400 
404  double* hessValues;
405 
411 
418  SparseHessianMatrix(int startSize, int valueSize);
419 
425 
426 }; //SparseHessianMatrix
427 
432 {
433 
434 public:
435 
441 
446 
451 
455  double* coefficients;
456 
462 }; //QuadraticTerms
463 
464 
465 
470 {
471 public:
474 
476  IntVector(int n);
477 
484  int *el;
485 
489  bool IsEqual(IntVector *that);
490 
499  bool setRandom(double density, bool conformant, int iMin, int iMax);
500 
506  bool deepCopyFrom(IntVector *that);
507 
513  bool setIntVector(int *i, int ni);
514 
519  bool extendIntVector(int i);
520 
525 
530  int getEl(int j);
531 
532 
540  bool getEl(int *i);
541 };//class IntVector
542 
543 
550 {
551 public:
552  std::string value;
553  std::string description;
554 
557 
560 
565 
574  bool setRandom(double density, bool conformant, int iMin, int iMax);
575 
582 
590  bool setOtherOptionOrResultEnumeration(std::string value, std::string description, int *i, int ni);
591 
592 
596  std::string getValue();
597 
601  std::string getDescription();
602 
603 };//class OtherOptionOrResultEnumeration
604 
605 
610 {
611 public:
614 
621  double *el;
622 
623  bool IsEqual(DoubleVector *that);
624 };//class DoubleVector
625 
626 
631 {
635  int idx;
636 
638  double value;
639 };
640 
646 {
647 public:
655 
658 
662  bool IsEqual(BasisStatus *that);
663 
672  bool setRandom(double density, bool conformant, int iMin, int iMax);
673 
680 
688  bool setIntVector(int status, int *i, int ni);
689 
696  bool addIdx(int status, int idx);
697 
704  int getNumberOfEl(int status);
705 
706 
714  int getEl(int status, int j);
715 
725  bool getIntVector(int status, int *i);
726 
740  int getBasisDense(int *resultArray, int dim, bool flipIdx);
741 };//class BasisStatus
742 
743 
755 {
756 
757 public:
759  std::string unit;
760 
762  std::string description;
763 
765  double value;
766 
777 
783 
791  bool setRandom(double density, bool conformant);
792 
799 }; //StorageCapacity
800 
812 class CPUSpeed
813 {
814 
815 public:
817  std::string unit;
818 
820  std::string description;
821 
823  double value;
824 
835 
840  bool IsEqual(CPUSpeed *that);
841 
850  bool setRandom(double density, bool conformant);
851 
857  bool deepCopyFrom(CPUSpeed *that);
858 }; //CPUSpeed
859 
872 {
873 
874 public:
876  std::string description;
877 
879  int value;
880 
891 
896  bool IsEqual(CPUNumber *that);
897 
905  bool setRandom(double density, bool conformant);
906 
912  bool deepCopyFrom(CPUNumber *that);
913 }; //CPUNumber
914 
924 class TimeSpan
925 {
926 
927 public:
929  std::string unit;
930 
932  double value;
933 
944 
949  bool IsEqual(TimeSpan *that);
950 
958  bool setRandom(double density, bool conformant);
959 
965  bool deepCopyFrom(TimeSpan *that);
966 }; //TimeSpan
967 
968 
970 {
971 
972 };
973 
974 
975 /*************************************************
976  *
977  * A function to test equality of two doubles.
978  * This is needed to check equality of objects
979  * when members can have NaN as a possible value
980  * since ordinary rules evaluate NaN as different
981  * from any other value --- even another NaN
982  * We sometimes want (NaN == NaN) to evaluate to true
983  *
984  *************************************************/
985 inline bool OSIsEqual(double x, double y)
986 {
987  if (OSIsnan(x) && OSIsnan(y)) return true;
988  if (x == y) return true;
989  return false;
990 }
991 
992 
993 #endif
IntVector::IsEqual
bool IsEqual(IntVector *that)
A method to compare two invectors.
OSConfig.h
OSExpressionTree.h
CPUNumber
the CPUNumber class.
Definition: OSGeneral.h:872
OtherOptionOrResultEnumeration::~OtherOptionOrResultEnumeration
~OtherOptionOrResultEnumeration()
OtherOptionOrResultEnumeration::getDescription
std::string getDescription()
Get the description for a particular level in an enumeration.
QuadraticTerms
a data structure for holding quadratic terms
Definition: OSGeneral.h:432
BasisStatus::setRandom
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
SparseJacobianMatrix::bDeleteArrays
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition: OSGeneral.h:308
IntVector::extendIntVector
bool extendIntVector(int i)
append a value to an IntVector
SparseMatrix::startSize
int startSize
startSize is the dimension of the starts array
Definition: OSGeneral.h:241
SparseVector::SparseVector
SparseVector()
Default Constructor.
GeneralFileHeader::IsEqual
bool IsEqual(GeneralFileHeader *that)
A function to check for the equality of two objects.
BasisStatus::addIdx
bool addIdx(int status, int idx)
Add one index to a particular status.
SparseMatrix::SparseMatrix
SparseMatrix(bool isColumnMajor_, int startSize, int valueSize)
Constructor.
SparseMatrix::bDeleteArrays
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition: OSGeneral.h:230
GeneralFileHeader
a data structure that holds general information about files that conform to one of the OSxL schemas
Definition: OSGeneral.h:33
QuadraticTerms::~QuadraticTerms
~QuadraticTerms()
SparseHessianMatrix::hessValues
double * hessValues
hessValues is a double array of the Hessian values.
Definition: OSGeneral.h:404
BasisStatus::getBasisDense
int getBasisDense(int *resultArray, int dim, bool flipIdx)
Get the entire array of basis status in dense form.
IntVector::deepCopyFrom
bool deepCopyFrom(IntVector *that)
A function to make a deep copy of an instance of this class.
CPUSpeed::unit
std::string unit
the unit in which CPU speed is measured
Definition: OSGeneral.h:817
BasisStatus::setIntVector
bool setIntVector(int status, int *i, int ni)
Set the indices for a particular status.
StorageCapacity::setRandom
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
SparseMatrix::values
double * values
values holds a double array of value elements in coefMatrix (AMatrix), which contains nonzero element...
Definition: OSGeneral.h:264
TimeSpan::IsEqual
bool IsEqual(TimeSpan *that)
A function to check for the equality of two objects.
SparseHessianMatrix::hessDimension
int hessDimension
hessDimension is the number of nonzeros in each array.
Definition: OSGeneral.h:389
CPUSpeed::value
double value
the CPU speed (expressed in multiples of unit)
Definition: OSGeneral.h:823
DoubleVector::bDeleteArrays
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition: OSGeneral.h:619
SparseIntVector::bDeleteArrays
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition: OSGeneral.h:198
BasisStatus::~BasisStatus
~BasisStatus()
OtherOptionOrResultEnumeration::deepCopyFrom
bool deepCopyFrom(OtherOptionOrResultEnumeration *that)
A function to make a deep copy of an instance of this class.
SparseMatrix
a sparse matrix data structure
Definition: OSGeneral.h:224
DoubleVector::numberOfEl
int numberOfEl
Definition: OSGeneral.h:620
BasisStatus::atUpper
IntVector * atUpper
Definition: OSGeneral.h:650
SparseMatrix::isColumnMajor
bool isColumnMajor
isColumnMajor holds whether the coefMatrix (AMatrix) holding linear program data is stored by column.
Definition: OSGeneral.h:236
StorageCapacity::~StorageCapacity
~StorageCapacity()
Class destructor.
DoubleVector
a double vector data structure
Definition: OSGeneral.h:610
SparseJacobianMatrix::startSize
int startSize
startSize is the dimension of the starts array – should equal number of rows + 1
Definition: OSGeneral.h:313
SparseIntVector::SparseIntVector
SparseIntVector()
Default Constructor.
QuadraticTerms::varOneIndexes
int * varOneIndexes
varOneIndexes holds an integer array of the first variable indexes of all the quadratic terms.
Definition: OSGeneral.h:445
OtherOptionOrResultEnumeration::OtherOptionOrResultEnumeration
OtherOptionOrResultEnumeration()
TimeSpan::deepCopyFrom
bool deepCopyFrom(TimeSpan *that)
A function to make a deep copy of an instance of this class.
IntVector::el
int * el
Definition: OSGeneral.h:484
IntVector::getEl
int getEl(int j)
get an entry in the data array of an IntVector
CPUSpeed::IsEqual
bool IsEqual(CPUSpeed *that)
A function to check for the equality of two objects.
SparseJacobianMatrix::starts
int * starts
starts holds an integer array of start elements, each start element points to the start of partials f...
Definition: OSGeneral.h:324
OtherOptionOrResultEnumeration::setRandom
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
BasisStatus::unknown
IntVector * unknown
Definition: OSGeneral.h:654
SparseVector::indexes
int * indexes
indexes holds an integer array of indexes whose corresponding values are nonzero.
Definition: OSGeneral.h:159
SparseHessianMatrix::SparseHessianMatrix
SparseHessianMatrix(int startSize, int valueSize)
An Alternative Constructor.
CPUSpeed
the CPUSpeed class.
Definition: OSGeneral.h:813
IndexValuePair::idx
int idx
idx holds the index of an entity (such as a variable, constraint, objective) that is part of a sparse...
Definition: OSGeneral.h:635
OtherOptionOrResultEnumeration::getValue
std::string getValue()
Get the value for a particular level in an enumeration.
SparseIntVector::SparseIntVector
SparseIntVector(int number)
Constructor.
IntVector::bDeleteArrays
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition: OSGeneral.h:482
TimeSpan::~TimeSpan
~TimeSpan()
Class destructor.
QuadraticTerms::QuadraticTerms
QuadraticTerms()
Default constructor.
CPUSpeed::description
std::string description
additional description about the CPU speed
Definition: OSGeneral.h:820
GeneralFileHeader::name
std::string name
used to give a name to the file or the problem contained within it
Definition: OSGeneral.h:39
SparseJacobianMatrix::values
double * values
values holds a double array of nonzero partial derivatives
Definition: OSGeneral.h:340
SparseJacobianMatrix::SparseJacobianMatrix
SparseJacobianMatrix(int startSize, int valueSize)
Constructor.
IntVector::~IntVector
~IntVector()
GeneralFileHeader::licence
std::string licence
licensing information if applicable
Definition: OSGeneral.h:60
SparseJacobianMatrix::SparseJacobianMatrix
SparseJacobianMatrix()
Default constructor.
CPUSpeed::CPUSpeed
CPUSpeed()
Default constructor.
IntVector
an integer Vector data structure
Definition: OSGeneral.h:470
SparseHessianMatrix::~SparseHessianMatrix
~SparseHessianMatrix()
Default destructor.
SparseJacobianMatrix::indexes
int * indexes
indexes holds an integer array of variable indices.
Definition: OSGeneral.h:335
TimeSpan::setRandom
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
GeneralFileHeader::GeneralFileHeader
GeneralFileHeader()
Constructor.
CPUNumber::IsEqual
bool IsEqual(CPUNumber *that)
A function to check for the equality of two objects.
SparseHessianMatrix::hessColIdx
int * hessColIdx
hessColIdx is an integer array of column indices in the range 0, ..., n - 1.
Definition: OSGeneral.h:399
SparseMatrix::starts
int * starts
starts holds an integer array of start elements in coefMatrix (AMatrix), which points to the start of...
Definition: OSGeneral.h:252
GeneralFileHeader::setRandom
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
StorageCapacity::StorageCapacity
StorageCapacity()
Default constructor.
BasisStatus::superbasic
IntVector * superbasic
Definition: OSGeneral.h:653
BasisStatus::getIntVector
bool getIntVector(int status, int *i)
Get the entire array of indices for a particular status.
GeneralFileHeader::fileCreator
std::string fileCreator
name(s) of author(s) who created this file
Definition: OSGeneral.h:55
GeneralFileHeader::setHeader
bool setHeader(std::string name, std::string source, std::string description, std::string fileCreator, std::string licence)
A function to populate an instance of this class.
SparseHessianMatrix
The in-memory representation of a SparseHessianMatrix..
Definition: OSGeneral.h:377
CPUSpeed::~CPUSpeed
~CPUSpeed()
Class destructor.
OtherOptionOrResultEnumeration::setOtherOptionOrResultEnumeration
bool setOtherOptionOrResultEnumeration(std::string value, std::string description, int *i, int ni)
Set the indices for a particular level in an enumeration.
DoubleVector::~DoubleVector
~DoubleVector()
GeneralFileHeader::deepCopyFrom
bool deepCopyFrom(GeneralFileHeader *that)
A function to make a deep copy of an instance of this class.
GeneralFileHeader::~GeneralFileHeader
~GeneralFileHeader()
Default destructor.
CPUNumber::deepCopyFrom
bool deepCopyFrom(CPUNumber *that)
A function to make a deep copy of an instance of this class.
SparseMatrix::display
bool display(int secondaryDim)
This method displays data structure in the matrix format.
OtherOptionOrResultEnumeration::IsEqual
bool IsEqual(OtherOptionOrResultEnumeration *that)
A function to check for the equality of two objects.
StorageCapacity::IsEqual
bool IsEqual(StorageCapacity *that)
A function to check for the equality of two objects.
TimeSpan
the TimeSpan class.
Definition: OSGeneral.h:925
StorageCapacity::description
std::string description
additional description about the storage
Definition: OSGeneral.h:762
CPUNumber::~CPUNumber
~CPUNumber()
Class destructor.
SparseHessianMatrix::bDeleteArrays
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition: OSGeneral.h:384
SparseVector::bDeleteArrays
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition: OSGeneral.h:149
TimeSpan::unit
std::string unit
the unit in which time is measured
Definition: OSGeneral.h:929
BasisStatus::basic
IntVector * basic
Definition: OSGeneral.h:648
CPUSpeed::deepCopyFrom
bool deepCopyFrom(CPUSpeed *that)
A function to make a deep copy of an instance of this class.
SparseMatrix::SparseMatrix
SparseMatrix()
Default constructor.
IndexValuePair::value
double value
value is a double that holds the value of the entity
Definition: OSGeneral.h:638
SparseIntVector
a sparse vector data structure for integer vectors
Definition: OSGeneral.h:172
CPUNumber::description
std::string description
additional description about the CPU
Definition: OSGeneral.h:876
OSIsEqual
bool OSIsEqual(double x, double y)
Definition: OSGeneral.h:985
BasisStatus
a data structure to represent an LP basis on both input and output
Definition: OSGeneral.h:646
CPUNumber::value
int value
the number of CPUs
Definition: OSGeneral.h:879
BasisStatus::deepCopyFrom
bool deepCopyFrom(BasisStatus *that)
A function to make a deep copy of an instance of this class.
GeneralFileHeader::source
std::string source
used when the file or problem appeared in the literature (could be in BiBTeX format or similar)
Definition: OSGeneral.h:45
SparseVector
a sparse vector data structure
Definition: OSGeneral.h:123
SparseJacobianMatrix::~SparseJacobianMatrix
~SparseJacobianMatrix()
Default destructor.
QuadraticTerms::coefficients
double * coefficients
coefficients holds a double array all the quadratic term coefficients.
Definition: OSGeneral.h:455
BasisStatus::isFree
IntVector * isFree
Definition: OSGeneral.h:652
OtherOptionOrResultEnumeration
Definition: OSGeneral.h:550
SparseIntVector::values
int * values
values holds an integer array of nonzero values.
Definition: OSGeneral.h:215
TimeSpan::TimeSpan
TimeSpan()
Default constructor.
OtherOptionOrResultEnumeration::OtherOptionOrResultEnumeration
OtherOptionOrResultEnumeration(int n)
alternate constructor
BasisStatus::getNumberOfEl
int getNumberOfEl(int status)
Get the number of indices for a particular status.
DoubleVector::IsEqual
bool IsEqual(DoubleVector *that)
SparseIntVector::number
int number
number is the number of elements in the indexes and values arrays.
Definition: OSGeneral.h:203
QuadraticTerms::rowIndexes
int * rowIndexes
rowIndexes holds an integer array of row indexes of all the quadratic terms.
Definition: OSGeneral.h:440
IntVector::IntVector
IntVector(int n)
alternate constructor
StorageCapacity
the StorageCapacity class.
Definition: OSGeneral.h:755
BasisStatus::atLower
IntVector * atLower
Definition: OSGeneral.h:649
SparseVector::SparseVector
SparseVector(int number)
Constructor.
SparseVector::~SparseVector
~SparseVector()
Default destructor.
SparseVector::number
int number
number is the number of elements in the indexes and values arrays.
Definition: OSGeneral.h:154
SparseHessianMatrix::SparseHessianMatrix
SparseHessianMatrix()
Default constructor.
StorageCapacity::unit
std::string unit
the unit in which storage capacity is measured
Definition: OSGeneral.h:759
OSIsnan
bool OSIsnan(double x)
checks whether a given double is NaN
IndexValuePair
A commonly used structure holding an index-value pair.
Definition: OSGeneral.h:631
SparseJacobianMatrix::valueSize
int valueSize
valueSize is the dimension of the values array
Definition: OSGeneral.h:318
IntVector::setRandom
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
GeneralFileHeader::description
std::string description
further information about the file or the problem contained within it
Definition: OSGeneral.h:50
SparseJacobianMatrix::conVals
int * conVals
conVals holds an integer array of integers, conVals[i] is the number of constant terms in the gradien...
Definition: OSGeneral.h:330
IntVector::getNumberOfEl
int getNumberOfEl()
get the dimension of an IntVector
OtherOptionOrResultEnumeration::description
std::string description
Definition: OSGeneral.h:553
SparseIntVector::~SparseIntVector
~SparseIntVector()
Default destructor.
IntVector::setIntVector
bool setIntVector(int *i, int ni)
set values into an IntVector
OSGeneral
Definition: OSGeneral.h:970
SparseVector::values
double * values
values holds a double array of nonzero values.
Definition: OSGeneral.h:164
OtherOptionOrResultEnumeration::value
std::string value
Definition: OSGeneral.h:552
CPUNumber::setRandom
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
CPUSpeed::setRandom
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
TimeSpan::value
double value
the number of units
Definition: OSGeneral.h:932
CPUNumber::CPUNumber
CPUNumber()
Default constructor.
SparseMatrix::valueSize
int valueSize
valueSize is the dimension of the indexes and values arrays
Definition: OSGeneral.h:246
GeneralFileHeader::getHeaderItem
std::string getHeaderItem(std::string item)
A function to retrieve a data item contained in this class.
SparseMatrix::indexes
int * indexes
indexes holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix).
Definition: OSGeneral.h:258
DoubleVector::el
double * el
Definition: OSGeneral.h:621
SparseHessianMatrix::hessRowIdx
int * hessRowIdx
hessRowIdx is an integer array of row indices in the range 0, ..., n - 1.
Definition: OSGeneral.h:394
IntVector::numberOfEl
int numberOfEl
Definition: OSGeneral.h:483
IntVector::getEl
bool getEl(int *i)
Get the integer data array of an IntVector.
OSParameters.h
BasisStatus::BasisStatus
BasisStatus()
StorageCapacity::deepCopyFrom
bool deepCopyFrom(StorageCapacity *that)
A function to make a deep copy of an instance of this class.
SparseJacobianMatrix
a sparse Jacobian matrix data structure
Definition: OSGeneral.h:301
SparseIntVector::indexes
int * indexes
indexes holds an integer array of indexes whose corresponding values are listed in the same order in ...
Definition: OSGeneral.h:210
QuadraticTerms::varTwoIndexes
int * varTwoIndexes
varTwoIndexes holds an integer array of the second variable indexes of all the quadratic terms.
Definition: OSGeneral.h:450
BasisStatus::getEl
int getEl(int status, int j)
Get one entry in the array of indices for a particular status.
DoubleVector::DoubleVector
DoubleVector()
StorageCapacity::value
double value
the number of units of storage capacity
Definition: OSGeneral.h:765
SparseMatrix::~SparseMatrix
~SparseMatrix()
Default destructor.
BasisStatus::IsEqual
bool IsEqual(BasisStatus *that)
A function to check for the equality of two objects.
IntVector::IntVector
IntVector()
BasisStatus::atEquality
IntVector * atEquality
Definition: OSGeneral.h:651
OSnLNode.h
This file defines the OSnLNode class along with its derived classes.