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 
79  bool IsEqual(GeneralFileHeader *that);
80 
88  bool setRandom(double density, bool conformant);
89 
95  bool deepCopyFrom(GeneralFileHeader *that);
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 
131  SparseVector(int number);
132 
137  SparseVector();
138 
143  ~SparseVector();
144 
150 
154  int number;
155 
159  int* indexes;
160 
164  double* values;
165 
166 }; //SparseVector
167 
172 {
173 public:
174 
180  SparseIntVector(int number);
181 
186  SparseIntVector();
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 
270  SparseMatrix();
271 
280  SparseMatrix(bool isColumnMajor_, int startSize, int valueSize);
285  ~SparseMatrix();
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 
460  QuadraticTerms();
461  ~QuadraticTerms();
462 }; //QuadraticTerms
463 
464 
465 
470 {
471 public:
472  IntVector();
473  ~IntVector();
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 
524  int getNumberOfEl();
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:
612  DoubleVector();
613  ~DoubleVector();
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 
656  BasisStatus();
657  ~BasisStatus();
658 
662  bool IsEqual(BasisStatus *that);
663 
672  bool setRandom(double density, bool conformant, int iMin, int iMax);
673 
679  bool deepCopyFrom(BasisStatus *that);
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 
771  StorageCapacity();
777 
782  bool IsEqual(StorageCapacity *that);
783 
791  bool setRandom(double density, bool conformant);
792 
798  bool deepCopyFrom(StorageCapacity *that);
799 }; //StorageCapacity
800 
812 class CPUSpeed
813 {
814 
815 public:
817  std::string unit;
818 
820  std::string description;
821 
823  double value;
824 
829  CPUSpeed();
834  ~CPUSpeed();
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 
885  CPUNumber();
890  ~CPUNumber();
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 
938  TimeSpan();
943  ~TimeSpan();
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
a data structure for holding quadratic terms
Definition: OSGeneral.h:431
std::string unit
the unit in which CPU speed is measured
Definition: OSGeneral.h:817
IntVector * atUpper
Definition: OSGeneral.h:650
~SparseJacobianMatrix()
Default destructor.
Definition: OSGeneral.cpp:328
bool isColumnMajor
isColumnMajor holds whether the coefMatrix (AMatrix) holding linear program data is stored by column...
Definition: OSGeneral.h:236
This file defines the OSnLNode class along with its derived classes.
std::string description
additional description about the storage
Definition: OSGeneral.h:762
bool deepCopyFrom(BasisStatus *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1301
double value
value is a double that holds the value of the entity
Definition: OSGeneral.h:638
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1511
std::string getDescription()
Get the description for a particular level in an enumeration.
Definition: OSGeneral.cpp:633
double * values
values holds a double array of nonzero partial derivatives
Definition: OSGeneral.h:340
bool IsEqual(OtherOptionOrResultEnumeration *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:639
bool display(int secondaryDim)
This method displays data structure in the matrix format.
Definition: OSGeneral.cpp:258
bool setIntVector(int *i, int ni)
set values into an IntVector
Definition: OSGeneral.cpp:437
bool IsEqual(CPUSpeed *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1462
bool IsEqual(GeneralFileHeader *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:46
IntVector * superbasic
Definition: OSGeneral.h:653
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1415
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:619
A commonly used structure holding an index-value pair.
Definition: OSGeneral.h:630
IntVector * basic
Definition: OSGeneral.h:648
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:482
int numberOfEl
Definition: OSGeneral.h:483
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:198
std::string description
further information about the file or the problem contained within it
Definition: OSGeneral.h:50
bool deepCopyFrom(OtherOptionOrResultEnumeration *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:698
std::string fileCreator
name(s) of author(s) who created this file
Definition: OSGeneral.h:55
bool deepCopyFrom(CPUNumber *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1611
std::string getHeaderItem(std::string item)
A function to retrieve a data item contained in this class.
Definition: OSGeneral.cpp:123
bool IsEqual(BasisStatus *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1213
double value
the number of units
Definition: OSGeneral.h:932
int startSize
startSize is the dimension of the starts array – should equal number of rows + 1
Definition: OSGeneral.h:313
~GeneralFileHeader()
Default destructor.
Definition: OSGeneral.cpp:39
int value
the number of CPUs
Definition: OSGeneral.h:879
~CPUSpeed()
Class destructor.
Definition: OSGeneral.cpp:1455
bool getIntVector(int status, int *i)
Get the entire array of indices for a particular status.
Definition: OSGeneral.cpp:950
IntVector * isFree
Definition: OSGeneral.h:652
std::string name
used to give a name to the file or the problem contained within it
Definition: OSGeneral.h:39
IntVector * atLower
Definition: OSGeneral.h:649
std::string description
additional description about the CPU speed
Definition: OSGeneral.h:820
IntVector * atEquality
Definition: OSGeneral.h:651
int * hessColIdx
hessColIdx is an integer array of column indices in the range 0, ..., n - 1.
Definition: OSGeneral.h:399
int getBasisDense(int *resultArray, int dim, bool flipIdx)
Get the entire array of basis status in dense form.
Definition: OSGeneral.cpp:1091
SparseHessianMatrix()
Default constructor.
Definition: OSGeneral.cpp:350
CPUSpeed()
Default constructor.
Definition: OSGeneral.cpp:1448
int * hessRowIdx
hessRowIdx is an integer array of row indices in the range 0, ..., n - 1.
Definition: OSGeneral.h:394
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:554
bool IsEqual(DoubleVector *that)
Definition: OSGeneral.cpp:736
a data structure that holds general information about files that conform to one of the OSxL schemas ...
Definition: OSGeneral.h:32
SparseVector()
Default Constructor.
Definition: OSGeneral.cpp:156
int startSize
startSize is the dimension of the starts array
Definition: OSGeneral.h:241
static char * j
Definition: OSdtoa.cpp:3622
int numberOfEl
Definition: OSGeneral.h:620
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.
Definition: OSGeneral.cpp:133
int * indexes
indexes holds an integer array of indexes whose corresponding values are listed in the same order in ...
Definition: OSGeneral.h:210
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:100
int * indexes
indexes holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix).
Definition: OSGeneral.h:258
bool deepCopyFrom(GeneralFileHeader *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:110
bool IsEqual(CPUNumber *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1556
int getNumberOfEl()
get the dimension of an IntVector
Definition: OSGeneral.cpp:476
bool setIntVector(int status, int *i, int ni)
Set the indices for a particular status.
Definition: OSGeneral.cpp:854
int getEl(int status, int j)
Get one entry in the array of indices for a particular status.
Definition: OSGeneral.cpp:1040
std::string description
additional description about the CPU
Definition: OSGeneral.h:876
int valueSize
valueSize is the dimension of the values array
Definition: OSGeneral.h:318
a double vector data structure
Definition: OSGeneral.h:609
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:384
int valueSize
valueSize is the dimension of the indexes and values arrays
Definition: OSGeneral.h:246
~SparseMatrix()
Default destructor.
Definition: OSGeneral.cpp:241
int * indexes
indexes holds an integer array of variable indices.
Definition: OSGeneral.h:335
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:149
a sparse matrix data structure
Definition: OSGeneral.h:223
IntVector * unknown
Definition: OSGeneral.h:654
~SparseHessianMatrix()
Default destructor.
Definition: OSGeneral.cpp:361
the CPUSpeed class.
Definition: OSGeneral.h:812
int * values
values holds an integer array of nonzero values.
Definition: OSGeneral.h:215
int hessDimension
hessDimension is the number of nonzeros in each array.
Definition: OSGeneral.h:389
int * varOneIndexes
varOneIndexes holds an integer array of the first variable indexes of all the quadratic terms...
Definition: OSGeneral.h:445
bool extendIntVector(int i)
append a value to an IntVector
Definition: OSGeneral.cpp:451
~SparseIntVector()
Default destructor.
Definition: OSGeneral.cpp:197
a sparse vector data structure for integer vectors
Definition: OSGeneral.h:171
int getNumberOfEl(int status)
Get the number of indices for a particular status.
Definition: OSGeneral.cpp:995
a sparse vector data structure
Definition: OSGeneral.h:122
double * hessValues
hessValues is a double array of the Hessian values.
Definition: OSGeneral.h:404
std::string unit
the unit in which storage capacity is measured
Definition: OSGeneral.h:759
bool deepCopyFrom(CPUSpeed *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1532
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
bool addIdx(int status, int idx)
Add one index to a particular status.
Definition: OSGeneral.cpp:905
TimeSpan()
Default constructor.
Definition: OSGeneral.cpp:1622
double * values
values holds a double array of value elements in coefMatrix (AMatrix), which contains nonzero element...
Definition: OSGeneral.h:264
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1604
the CPUNumber class.
Definition: OSGeneral.h:871
~TimeSpan()
Class destructor.
Definition: OSGeneral.cpp:1628
SparseIntVector()
Default Constructor.
Definition: OSGeneral.cpp:190
a sparse Jacobian matrix data structure
Definition: OSGeneral.h:300
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:308
SparseJacobianMatrix()
Default constructor.
Definition: OSGeneral.cpp:304
an integer Vector data structure
Definition: OSGeneral.h:469
int number
number is the number of elements in the indexes and values arrays.
Definition: OSGeneral.h:154
int * starts
starts holds an integer array of start elements, each start element points to the start of partials f...
Definition: OSGeneral.h:324
double value
the CPU speed (expressed in multiples of unit)
Definition: OSGeneral.h:823
std::string source
used when the file or problem appeared in the literature (could be in BiBTeX format or similar) ...
Definition: OSGeneral.h:45
bool deepCopyFrom(TimeSpan *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1704
bool IsEqual(IntVector *that)
A method to compare two invectors.
Definition: OSGeneral.cpp:495
bool setOtherOptionOrResultEnumeration(std::string value, std::string description, int *i, int ni)
Set the indices for a particular level in an enumeration.
Definition: OSGeneral.cpp:621
bool OSIsEqual(double x, double y)
Definition: OSGeneral.h:985
int * rowIndexes
rowIndexes holds an integer array of row indexes of all the quadratic terms.
Definition: OSGeneral.h:440
int * starts
starts holds an integer array of start elements in coefMatrix (AMatrix), which points to the start of...
Definition: OSGeneral.h:252
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1257
double * values
values holds a double array of nonzero values.
Definition: OSGeneral.h:164
the TimeSpan class.
Definition: OSGeneral.h:924
bool OSIsnan(double x)
checks whether a given double is NaN
bool deepCopyFrom(StorageCapacity *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1437
double * el
Definition: OSGeneral.h:621
int getEl(int j)
get an entry in the data array of an IntVector
Definition: OSGeneral.cpp:481
CPUNumber()
Default constructor.
Definition: OSGeneral.cpp:1543
std::string getValue()
Get the value for a particular level in an enumeration.
Definition: OSGeneral.cpp:628
int * indexes
indexes holds an integer array of indexes whose corresponding values are nonzero. ...
Definition: OSGeneral.h:159
bool IsEqual(TimeSpan *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1635
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:230
int number
number is the number of elements in the indexes and values arrays.
Definition: OSGeneral.h:203
SparseMatrix()
Default constructor.
Definition: OSGeneral.cpp:215
bool IsEqual(StorageCapacity *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1366
int * conVals
conVals holds an integer array of integers, conVals[i] is the number of constant terms in the gradien...
Definition: OSGeneral.h:330
double * coefficients
coefficients holds a double array all the quadratic term coefficients.
Definition: OSGeneral.h:455
int * varTwoIndexes
varTwoIndexes holds an integer array of the second variable indexes of all the quadratic terms...
Definition: OSGeneral.h:450
The in-memory representation of a SparseHessianMatrix..
Definition: OSGeneral.h:376
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:686
void fint * n
~StorageCapacity()
Class destructor.
Definition: OSGeneral.cpp:1359
int * el
Definition: OSGeneral.h:484
a data structure to represent an LP basis on both input and output
Definition: OSGeneral.h:645
the StorageCapacity class.
Definition: OSGeneral.h:754
~CPUNumber()
Class destructor.
Definition: OSGeneral.cpp:1549
GeneralFileHeader()
Constructor.
Definition: OSGeneral.cpp:30
std::string unit
the unit in which time is measured
Definition: OSGeneral.h:929
double value
the number of units of storage capacity
Definition: OSGeneral.h:765
StorageCapacity()
Default constructor.
Definition: OSGeneral.cpp:1352
void fint fint fint real fint real * x
~SparseVector()
Default destructor.
Definition: OSGeneral.cpp:163
QuadraticTerms()
Default constructor.
Definition: OSGeneral.cpp:379
bool deepCopyFrom(IntVector *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:573
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1683
std::string licence
licensing information if applicable
Definition: OSGeneral.h:60