My Project
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{
34public:
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
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{
124public:
125
131 SparseVector(int number);
132
137 SparseVector();
138
144
150
155
160
164 double* values;
165
166}; //SparseVector
167
172{
173public:
174
181
187
193
199
204
211
215 int* values;
216
217}; //SparseIntVector
218
219
224{
225public:
231
237
242
247
252 int* starts;
253
259
264 double* values;
265
270 SparseMatrix();
271
280 SparseMatrix(bool isColumnMajor_, int startSize, int valueSize);
286
292 bool display(int secondaryDim);
293
294}; //SparseMatrix
295
296
301{
302public:
303
309
314
319
324 int* starts;
325
331
336
340 double* values;
341
347
355
361
362}; //SparseJacobianMatrix
363
364
365
377{
378public:
379
385
390
395
400
404 double* hessValues;
405
411
418 SparseHessianMatrix(int startSize, int valueSize);
419
425
426}; //SparseHessianMatrix
427
432{
433
434public:
435
441
446
451
456
462}; //QuadraticTerms
463
464
465
470{
471public:
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{
551public:
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{
611public:
612 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{
647public:
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
757public:
759 std::string unit;
760
762 std::string description;
763
765 double value;
766
777
782 bool IsEqual(StorageCapacity *that);
783
791 bool setRandom(double density, bool conformant);
792
798 bool deepCopyFrom(StorageCapacity *that);
799}; //StorageCapacity
800
813{
814
815public:
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
874public:
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
925{
926
927public:
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 *************************************************/
985inline 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
bool OSIsEqual(double x, double y)
Definition OSGeneral.h:985
bool OSIsnan(double x)
checks whether a given double is NaN
This file defines the OSnLNode class along with its derived classes.
a data structure to represent an LP basis on both input and output
Definition OSGeneral.h:646
bool IsEqual(BasisStatus *that)
A function to check for the equality of two objects.
IntVector * isFree
Definition OSGeneral.h:652
int getBasisDense(int *resultArray, int dim, bool flipIdx)
Get the entire array of basis status in dense form.
IntVector * atEquality
Definition OSGeneral.h:651
bool getIntVector(int status, int *i)
Get the entire array of indices for a particular status.
IntVector * unknown
Definition OSGeneral.h:654
bool addIdx(int status, int idx)
Add one index to a particular status.
bool setIntVector(int status, int *i, int ni)
Set the indices for a particular status.
int getNumberOfEl(int status)
Get the number of indices for a particular status.
IntVector * basic
Definition OSGeneral.h:648
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool deepCopyFrom(BasisStatus *that)
A function to make a deep copy of an instance of this class.
int getEl(int status, int j)
Get one entry in the array of indices for a particular status.
IntVector * atLower
Definition OSGeneral.h:649
IntVector * atUpper
Definition OSGeneral.h:650
IntVector * superbasic
Definition OSGeneral.h:653
the CPUNumber class.
Definition OSGeneral.h:872
bool deepCopyFrom(CPUNumber *that)
A function to make a deep copy of an instance of this class.
~CPUNumber()
Class destructor.
std::string description
additional description about the CPU
Definition OSGeneral.h:876
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
int value
the number of CPUs
Definition OSGeneral.h:879
bool IsEqual(CPUNumber *that)
A function to check for the equality of two objects.
CPUNumber()
Default constructor.
the CPUSpeed class.
Definition OSGeneral.h:813
bool deepCopyFrom(CPUSpeed *that)
A function to make a deep copy of an instance of this class.
CPUSpeed()
Default constructor.
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
std::string description
additional description about the CPU speed
Definition OSGeneral.h:820
~CPUSpeed()
Class destructor.
std::string unit
the unit in which CPU speed is measured
Definition OSGeneral.h:817
bool IsEqual(CPUSpeed *that)
A function to check for the equality of two objects.
double value
the CPU speed (expressed in multiples of unit)
Definition OSGeneral.h:823
a double vector data structure
Definition OSGeneral.h:610
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition OSGeneral.h:619
double * el
Definition OSGeneral.h:621
bool IsEqual(DoubleVector *that)
a data structure that holds general information about files that conform to one of the OSxL schemas
Definition OSGeneral.h:33
std::string getHeaderItem(std::string item)
A function to retrieve a data item contained in this class.
std::string fileCreator
name(s) of author(s) who created this file
Definition OSGeneral.h:55
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
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.
std::string source
used when the file or problem appeared in the literature (could be in BiBTeX format or similar)
Definition OSGeneral.h:45
~GeneralFileHeader()
Default destructor.
Definition OSGeneral.cpp:39
GeneralFileHeader()
Constructor.
Definition OSGeneral.cpp:30
std::string name
used to give a name to the file or the problem contained within it
Definition OSGeneral.h:39
bool deepCopyFrom(GeneralFileHeader *that)
A function to make a deep copy of an instance of this class.
bool IsEqual(GeneralFileHeader *that)
A function to check for the equality of two objects.
Definition OSGeneral.cpp:46
std::string description
further information about the file or the problem contained within it
Definition OSGeneral.h:50
std::string licence
licensing information if applicable
Definition OSGeneral.h:60
an integer Vector data structure
Definition OSGeneral.h:470
int getNumberOfEl()
get the dimension of an IntVector
int getEl(int j)
get an entry in the data array of an IntVector
bool setIntVector(int *i, int ni)
set values into an IntVector
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition OSGeneral.h:482
bool IsEqual(IntVector *that)
A method to compare two invectors.
int numberOfEl
Definition OSGeneral.h:483
bool extendIntVector(int i)
append a value to an IntVector
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool deepCopyFrom(IntVector *that)
A function to make a deep copy of an instance of this class.
int * el
Definition OSGeneral.h:484
std::string getValue()
Get the value for a particular level in an enumeration.
bool IsEqual(OtherOptionOrResultEnumeration *that)
A function to check for the equality of two objects.
bool setOtherOptionOrResultEnumeration(std::string value, std::string description, int *i, int ni)
Set the indices for a particular level in an enumeration.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool deepCopyFrom(OtherOptionOrResultEnumeration *that)
A function to make a deep copy of an instance of this class.
std::string getDescription()
Get the description for a particular level in an enumeration.
a data structure for holding quadratic terms
Definition OSGeneral.h:432
QuadraticTerms()
Default constructor.
int * varTwoIndexes
varTwoIndexes holds an integer array of the second variable indexes of all the quadratic terms.
Definition OSGeneral.h:450
int * rowIndexes
rowIndexes holds an integer array of row indexes of all the quadratic terms.
Definition OSGeneral.h:440
double * coefficients
coefficients holds a double array all the quadratic term coefficients.
Definition OSGeneral.h:455
int * varOneIndexes
varOneIndexes holds an integer array of the first variable indexes of all the quadratic terms.
Definition OSGeneral.h:445
The in-memory representation of a SparseHessianMatrix..
Definition OSGeneral.h:377
int * hessRowIdx
hessRowIdx is an integer array of row indices in the range 0, ..., n - 1.
Definition OSGeneral.h:394
SparseHessianMatrix(int startSize, int valueSize)
An Alternative Constructor.
int hessDimension
hessDimension is the number of nonzeros in each array.
Definition OSGeneral.h:389
double * hessValues
hessValues is a double array of the Hessian values.
Definition OSGeneral.h:404
int * hessColIdx
hessColIdx is an integer array of column indices in the range 0, ..., n - 1.
Definition OSGeneral.h:399
~SparseHessianMatrix()
Default destructor.
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition OSGeneral.h:384
SparseHessianMatrix()
Default constructor.
a sparse vector data structure for integer vectors
Definition OSGeneral.h:172
int * indexes
indexes holds an integer array of indexes whose corresponding values are listed in the same order in ...
Definition OSGeneral.h:210
SparseIntVector()
Default Constructor.
~SparseIntVector()
Default destructor.
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition OSGeneral.h:198
int number
number is the number of elements in the indexes and values arrays.
Definition OSGeneral.h:203
int * values
values holds an integer array of nonzero values.
Definition OSGeneral.h:215
a sparse Jacobian matrix data structure
Definition OSGeneral.h:301
int startSize
startSize is the dimension of the starts array – should equal number of rows + 1
Definition OSGeneral.h:313
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:308
~SparseJacobianMatrix()
Default destructor.
int valueSize
valueSize is the dimension of the values array
Definition OSGeneral.h:318
int * starts
starts holds an integer array of start elements, each start element points to the start of partials f...
Definition OSGeneral.h:324
int * conVals
conVals holds an integer array of integers, conVals[i] is the number of constant terms in the gradien...
Definition OSGeneral.h:330
SparseJacobianMatrix()
Default constructor.
double * values
values holds a double array of nonzero partial derivatives
Definition OSGeneral.h:340
a sparse matrix data structure
Definition OSGeneral.h:224
int * indexes
indexes holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix).
Definition OSGeneral.h:258
int valueSize
valueSize is the dimension of the indexes and values arrays
Definition OSGeneral.h:246
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition OSGeneral.h:230
int * starts
starts holds an integer array of start elements in coefMatrix (AMatrix), which points to the start of...
Definition OSGeneral.h:252
double * values
values holds a double array of value elements in coefMatrix (AMatrix), which contains nonzero element...
Definition OSGeneral.h:264
bool display(int secondaryDim)
This method displays data structure in the matrix format.
~SparseMatrix()
Default destructor.
bool isColumnMajor
isColumnMajor holds whether the coefMatrix (AMatrix) holding linear program data is stored by column.
Definition OSGeneral.h:236
SparseMatrix()
Default constructor.
int startSize
startSize is the dimension of the starts array
Definition OSGeneral.h:241
a sparse vector data structure
Definition OSGeneral.h:123
SparseVector()
Default Constructor.
double * values
values holds a double array of nonzero values.
Definition OSGeneral.h:164
int * indexes
indexes holds an integer array of indexes whose corresponding values are nonzero.
Definition OSGeneral.h:159
int number
number is the number of elements in the indexes and values arrays.
Definition OSGeneral.h:154
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default
Definition OSGeneral.h:149
~SparseVector()
Default destructor.
the StorageCapacity class.
Definition OSGeneral.h:755
bool deepCopyFrom(StorageCapacity *that)
A function to make a deep copy of an instance of this class.
std::string unit
the unit in which storage capacity is measured
Definition OSGeneral.h:759
StorageCapacity()
Default constructor.
~StorageCapacity()
Class destructor.
double value
the number of units of storage capacity
Definition OSGeneral.h:765
std::string description
additional description about the storage
Definition OSGeneral.h:762
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
bool IsEqual(StorageCapacity *that)
A function to check for the equality of two objects.
the TimeSpan class.
Definition OSGeneral.h:925
bool IsEqual(TimeSpan *that)
A function to check for the equality of two objects.
std::string unit
the unit in which time is measured
Definition OSGeneral.h:929
~TimeSpan()
Class destructor.
TimeSpan()
Default constructor.
double value
the number of units
Definition OSGeneral.h:932
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
bool deepCopyFrom(TimeSpan *that)
A function to make a deep copy of an instance of this class.
A commonly used structure holding an index-value pair.
Definition OSGeneral.h:631
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
double value
value is a double that holds the value of the entity
Definition OSGeneral.h:638