- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/OS-2.3.5/OS/src/OSCommonInterfaces/OSGeneral.h

Go to the documentation of this file.

    00001 /* $Id: OSGeneral.h 3172 2010-02-05 04:59:24Z Gassmann $ */
    00016 #ifndef OSGENERAL_H
    00017 #define OSGENERAL_H
    00018
    00019
    00020 #ifdef HAVE_CSTDLIB
    00021 # include <cstdlib>
    00022 #else
    00023 # ifdef HAVE_STDLIB_H
    00024 #  include <stdlib.h>
    00025 # endif
    00026 #endif
    00027
    00028 #include "OSConfig.h"
    00029 #include "OSParameters.h"
    00030
    00031 #include <string>
    00032 #include <vector>
    00033
    00038 class GeneralFileHeader {
    00039         public:
    00040
    00044         std::string name;
    00045
    00050         std::string source;
    00051
    00055         std::string description;
    00056
    00060         std::string fileCreator;
    00061
    00065         std::string licence;
    00066
    00067
    00072         GeneralFileHeader();
    00073
    00078         ~GeneralFileHeader();
    00079
    00084         bool IsEqual(GeneralFileHeader *that);
    00085
    00093         bool setRandom(double density, bool conformant);
    00094
    00104         bool setHeader(std::string name, std::string source, std::string description,
    00105                            std::string fileCreator, std::string licence);
    00106
    00107 }; //GeneralFileHeader
    00108
    00109
    00113 class SparseVector{
    00114         public:
    00115
    00121         SparseVector(int number);
    00122
    00127         SparseVector();
    00128
    00133         ~SparseVector();
    00134
    00139         bool bDeleteArrays;
    00140
    00144         int number;
    00145
    00149         int* indexes;
    00150
    00154         double* values;
    00155
    00156 }; //SparseVector
    00157
    00158
    00162 class SparseMatrix {
    00163         public:
    00164
    00169         bool bDeleteArrays;
    00170
    00175         bool isColumnMajor;
    00176
    00180         int startSize;
    00181
    00185         int valueSize;
    00186
    00191         int* starts;
    00192
    00197         int* indexes;
    00198
    00203         double* values;
    00204
    00209         SparseMatrix();
    00210
    00219         SparseMatrix(bool isColumnMajor_, int startSize, int valueSize);
    00224         ~SparseMatrix();
    00225
    00231         bool display(int secondaryDim);
    00232
    00233 }; //SparseMatrix
    00234
    00235
    00239 class SparseJacobianMatrix {
    00240         public:
    00241
    00246         bool bDeleteArrays;
    00247
    00251         int startSize;
    00252
    00256         int valueSize;
    00257
    00262         int* starts;
    00263
    00268         int* conVals;
    00269
    00273         int* indexes;
    00274
    00278         double* values;
    00279
    00284         SparseJacobianMatrix();
    00285
    00292         SparseJacobianMatrix(int startSize, int valueSize);
    00293
    00298         ~SparseJacobianMatrix();
    00299
    00300 }; //SparseJacobianMatrix
    00301
    00302
    00303
    00304
    00305
    00316 class SparseHessianMatrix {
    00317         public:
    00318
    00323         bool bDeleteArrays;
    00324
    00328         int hessDimension;
    00329
    00333         int* hessRowIdx;
    00334
    00338         int* hessColIdx;
    00339
    00343         double* hessValues;
    00344
    00349         SparseHessianMatrix();
    00350
    00357         SparseHessianMatrix(int startSize, int valueSize);
    00358
    00363         ~SparseHessianMatrix();
    00364
    00365 }; //SparseHessianMatrix
    00366
    00370 class QuadraticTerms {
    00371
    00372         public:
    00373
    00378         int* rowIndexes;
    00379
    00383         int* varOneIndexes;
    00384
    00388         int* varTwoIndexes;
    00389
    00393         double* coefficients;
    00394
    00399         QuadraticTerms();
    00400         ~QuadraticTerms();
    00401 }; //QuadraticTerms
    00402
    00403
    00404
    00408 class IntVector{
    00409 public:
    00410         IntVector();
    00411         ~IntVector();
    00412
    00413         // alternate constructor
    00414         IntVector(int n);
    00415
    00420         bool bDeleteArrays;
    00421         int numberOfEl;
    00422         int *el;
    00423
    00427         bool IsEqual(IntVector *that);
    00428
    00438         bool setRandom(double density, bool conformant, int iMin, int iMax);
    00439
    00445         bool setIntVector(int *i, int ni);
    00446
    00451         bool extendIntVector(int i);
    00452
    00456         int getNumberOfEl();
    00457
    00462         int getEl(int j);
    00463
    00464
    00472         bool getEl(int *i);
    00473 };//class IntVector
    00474
    00475
    00481 class OtherOptionEnumeration : public IntVector{
    00482 public:
    00483         std::string value;
    00484         std::string description;
    00485
    00486         OtherOptionEnumeration();
    00487         ~OtherOptionEnumeration();
    00488
    00489         // alternate constructor
    00490         OtherOptionEnumeration(int n);
    00491
    00496         bool IsEqual(OtherOptionEnumeration *that);
    00497
    00507         bool setRandom(double density, bool conformant, int iMin, int iMax);
    00508
    00516         bool setOtherOptionEnumeration(std::string value, std::string description, int *i, int ni);
    00517
    00518
    00522         std::string getValue();
    00523
    00527         std::string getDescription();
    00528
    00529 };//class OtherOptionEnumeration
    00530
    00531
    00532
    00536 class DoubleVector{
    00537 public:
    00538         DoubleVector();
    00539         ~DoubleVector();
    00544         bool bDeleteArrays;
    00545         int numberOfEl;
    00546         double *el;
    00547
    00548         bool IsEqual(DoubleVector *that);
    00549 };//class DoubleVector
    00550
    00551
    00555 struct IndexValuePair{
    00559         int idx;
    00560
    00563         double value;
    00564
    00565 };
    00566
    00571 class BasisStatus{
    00572 public:
    00573         IntVector* basic;
    00574         IntVector* atLower;
    00575         IntVector* atUpper;
    00576         IntVector* isFree;
    00577         IntVector* superbasic;
    00578         IntVector* unknown;
    00579
    00580         BasisStatus();
    00581         ~BasisStatus();
    00582
    00587         bool IsEqual(BasisStatus *that);
    00588
    00598         bool setRandom(double density, bool conformant, int iMin, int iMax);
    00599
    00607         bool setIntVector(int status, int *i, int ni);
    00608
    00615         bool addIdx(int status, int idx);
    00616
    00623         int getNumberOfEl(int status);
    00624
    00625
    00633         int getEl(int status, int j);
    00634
    00644         bool getIntVector(int status, int *i);
    00645 };//class BasisStatus
    00646
    00656 class StorageCapacity {
    00657
    00658 public:
    00660         std::string unit;
    00661
    00663         std::string description;
    00664
    00666         double value;
    00667
    00672         StorageCapacity();
    00677         ~StorageCapacity();
    00678
    00683         bool IsEqual(StorageCapacity *that);
    00684
    00692         bool setRandom(double density, bool conformant);
    00693 }; //StorageCapacity
    00694
    00706 class CPUSpeed {
    00707
    00708 public:
    00710         std::string unit;
    00711
    00713         std::string description;
    00714
    00716         double value;
    00717
    00722         CPUSpeed();
    00727         ~CPUSpeed();
    00728
    00733         bool IsEqual(CPUSpeed *that);
    00734
    00742         bool setRandom(double density, bool conformant);
    00743 }; //CPUSpeed
    00744
    00756 class CPUNumber {
    00757
    00758 public:
    00760         std::string description;
    00761
    00763         int value;
    00764
    00769         CPUNumber();
    00774         ~CPUNumber();
    00775
    00780         bool IsEqual(CPUNumber *that);
    00781
    00789         bool setRandom(double density, bool conformant);
    00790 }; //CPUNumber
    00791
    00801 class TimeSpan {
    00802
    00803 public:
    00805         std::string unit;
    00806
    00808         double value;
    00809
    00814         TimeSpan();
    00819         ~TimeSpan();
    00820
    00825         bool IsEqual(TimeSpan *that);
    00826
    00834         bool setRandom(double density, bool conformant);
    00835 }; //TimeSpan
    00836
    00837
    00838
    00839 class OSGeneral{
    00840
    00841 };
    00842
    00843 /***************************************************************************************
    00844  * In the schemas there is a growing number of string elements that can only take
    00845  * a small number of values. One implementation in C++ uses enumerations, but the
    00846  * elements appear in the schemas as strings, so they must be stored internally
    00847  * as strings also. Below we list the enumerations and provide two utility methods
    00848  * that make working with them convenient:
    00849  * return...() functions that return the integer value associated with that enumeration
    00850  * verify...() functions that check that a string has a legal value for the enumeration
    00851  ***************************************************************************************/
    00852
    00853 enum ENUM_CPUSPEEDUNIT
    00854 {
    00855         ENUM_CPUSPEEDUNIT_hertz = 1,
    00856         ENUM_CPUSPEEDUNIT_kilohertz,
    00857         ENUM_CPUSPEEDUNIT_megahertz,
    00858         ENUM_CPUSPEEDUNIT_gigahertz,
    00859         ENUM_CPUSPEEDUNIT_terahertz,
    00860         ENUM_CPUSPEEDUNIT_flops,
    00861         ENUM_CPUSPEEDUNIT_kiloflops,
    00862         ENUM_CPUSPEEDUNIT_megaflops,
    00863         ENUM_CPUSPEEDUNIT_gigaflops,
    00864         ENUM_CPUSPEEDUNIT_teraflops,
    00865         ENUM_CPUSPEEDUNIT_petaflops
    00866 };
    00867
    00868 inline int returnCPUSpeedUnit(std::string unit)
    00869 {
    00870         if (unit == "hertz"    ) return ENUM_CPUSPEEDUNIT_hertz;
    00871         if (unit == "kilohertz") return ENUM_CPUSPEEDUNIT_kilohertz;
    00872         if (unit == "megahertz") return ENUM_CPUSPEEDUNIT_megahertz;
    00873         if (unit == "gigahertz") return ENUM_CPUSPEEDUNIT_gigahertz;
    00874         if (unit == "terahertz") return ENUM_CPUSPEEDUNIT_terahertz;
    00875         if (unit == "flops"    ) return ENUM_CPUSPEEDUNIT_flops;
    00876         if (unit == "kiloflops") return ENUM_CPUSPEEDUNIT_kiloflops;
    00877         if (unit == "megaflops") return ENUM_CPUSPEEDUNIT_megaflops;
    00878         if (unit == "gigaflops") return ENUM_CPUSPEEDUNIT_gigaflops;
    00879         if (unit == "teraflops") return ENUM_CPUSPEEDUNIT_teraflops;
    00880         if (unit == "petaflops") return ENUM_CPUSPEEDUNIT_petaflops;
    00881         return 0;
    00882 }//returnCPUSpeedUnit
    00883
    00884 inline bool verifyCPUSpeedUnit(std::string unit)
    00885 {
    00886         return (returnCPUSpeedUnit(unit) > 0);
    00887 }//verifyCPUSpeedUnit
    00888
    00889 enum ENUM_STORAGEUNIT
    00890 {
    00891         ENUM_STORAGEUNIT_byte = 1,
    00892         ENUM_STORAGEUNIT_kilobyte,
    00893         ENUM_STORAGEUNIT_megabyte,
    00894         ENUM_STORAGEUNIT_gigabyte,
    00895         ENUM_STORAGEUNIT_terabyte,
    00896         ENUM_STORAGEUNIT_petabyte,
    00897         ENUM_STORAGEUNIT_exabyte,
    00898         ENUM_STORAGEUNIT_zettabyte,
    00899         ENUM_STORAGEUNIT_yottabyte
    00900 };
    00901
    00902 inline int returnStorageUnit(std::string unit)
    00903 {
    00904         if (unit == "byte"     ) return ENUM_STORAGEUNIT_byte;
    00905         if (unit == "kilobyte" ) return ENUM_STORAGEUNIT_kilobyte;
    00906         if (unit == "megabyte" ) return ENUM_STORAGEUNIT_megabyte;
    00907         if (unit == "gigabyte" ) return ENUM_STORAGEUNIT_gigabyte;
    00908         if (unit == "terabyte" ) return ENUM_STORAGEUNIT_terabyte;
    00909         if (unit == "petabyte" ) return ENUM_STORAGEUNIT_petabyte;
    00910         if (unit == "exabyte"  ) return ENUM_STORAGEUNIT_exabyte;
    00911         if (unit == "zettabyte") return ENUM_STORAGEUNIT_zettabyte;
    00912         if (unit == "yottabyte") return ENUM_STORAGEUNIT_yottabyte;
    00913         return 0;
    00914 }//returnStorageUnit
    00915
    00916 inline bool verifyStorageUnit(std::string unit)
    00917 {
    00918         return (returnStorageUnit(unit) > 0);
    00919 }//verifyCPUSpeedUnit
    00920
    00921 enum ENUM_TIMEUNIT
    00922 {
    00923         ENUM_TIMEUNIT_tick = 1,
    00924         ENUM_TIMEUNIT_millisecond,
    00925         ENUM_TIMEUNIT_second,
    00926         ENUM_TIMEUNIT_minute,
    00927         ENUM_TIMEUNIT_hour,
    00928         ENUM_TIMEUNIT_day,
    00929         ENUM_TIMEUNIT_week,
    00930         ENUM_TIMEUNIT_month,
    00931         ENUM_TIMEUNIT_year
    00932 };
    00933
    00934 inline int returnTimeUnit(std::string unit)
    00935 {
    00936         if (unit == "tick"       ) return ENUM_TIMEUNIT_tick;
    00937         if (unit == "millisecond") return ENUM_TIMEUNIT_millisecond;
    00938         if (unit == "second"     ) return ENUM_TIMEUNIT_second;
    00939         if (unit == "minute"     ) return ENUM_TIMEUNIT_minute;
    00940         if (unit == "hour"       ) return ENUM_TIMEUNIT_hour;
    00941         if (unit == "day"        ) return ENUM_TIMEUNIT_day;
    00942         if (unit == "week"       ) return ENUM_TIMEUNIT_week;
    00943         if (unit == "month"      ) return ENUM_TIMEUNIT_month;
    00944         if (unit == "year"       ) return ENUM_TIMEUNIT_year;
    00945         return 0;
    00946 }//returnTimeUnit
    00947
    00948 inline bool verifyTimeUnit(std::string unit)
    00949 {
    00950         return (returnTimeUnit(unit) > 0);
    00951 }//verifyTimeUnit
    00952
    00953 enum ENUM_TIMETYPE
    00954 {
    00955         ENUM_TIMETYPE_cpuTime = 1,
    00956         ENUM_TIMETYPE_elapsedTime,
    00957         ENUM_TIMETYPE_other
    00958 };
    00959
    00960 inline int returnTimeType(std::string type)
    00961 {
    00962         if (type == "cpuTime"    ) return ENUM_TIMETYPE_cpuTime;
    00963         if (type == "elapsedTime") return ENUM_TIMETYPE_elapsedTime;
    00964         if (type == "other"      ) return ENUM_TIMETYPE_other;
    00965         return 0;
    00966 }//returnTimeType
    00967
    00968 inline bool verifyTimeType(std::string type)
    00969 {
    00970         return (returnTimeType(type) > 0);
    00971 }//verifyTimeType
    00972
    00973 enum ENUM_TIMECATEGORY
    00974 {
    00975         ENUM_TIMECATEGORY_total = 1,
    00976         ENUM_TIMECATEGORY_input,
    00977         ENUM_TIMECATEGORY_preprocessing,
    00978         ENUM_TIMECATEGORY_optimization,
    00979         ENUM_TIMECATEGORY_postprocessing,
    00980         ENUM_TIMECATEGORY_output,
    00981         ENUM_TIMECATEGORY_other
    00982 };
    00983
    00984 inline int returnTimeCategory(std::string category)
    00985 {
    00986         if (category == "total"         ) return ENUM_TIMECATEGORY_total;
    00987         if (category == "input"         ) return ENUM_TIMECATEGORY_input;
    00988         if (category == "preprocessing" ) return ENUM_TIMECATEGORY_preprocessing;
    00989         if (category == "optimization"  ) return ENUM_TIMECATEGORY_optimization;
    00990         if (category == "postprocessing") return ENUM_TIMECATEGORY_postprocessing;
    00991         if (category == "output"        ) return ENUM_TIMECATEGORY_output;
    00992         if (category == "other"         ) return ENUM_TIMECATEGORY_other;
    00993         return 0;
    00994 }//returnTimeCategory
    00995
    00996 inline bool verifyTimeCategory(std::string category)
    00997 {
    00998         return (returnTimeCategory(category) > 0);
    00999 }//verifyTimeCategory
    01000
    01001 enum ENUM_LOCATIONTYPE
    01002 {
    01003         ENUM_LOCATIONTYPE_local = 1,
    01004         ENUM_LOCATIONTYPE_http,
    01005         ENUM_LOCATIONTYPE_ftp
    01006 };
    01007
    01008 inline int returnLocationType(std::string type)
    01009 {
    01010         if (type == "local") return ENUM_LOCATIONTYPE_local;
    01011         if (type == "http" ) return ENUM_LOCATIONTYPE_http;
    01012         if (type == "ftp"  ) return ENUM_LOCATIONTYPE_ftp;
    01013         return 0;
    01014 }//returnLocationType
    01015
    01016 inline bool verifyLocationType(std::string type)
    01017 {
    01018         return (returnLocationType(type) > 0);
    01019 }//verifyLocationType
    01020
    01021 enum ENUM_TRANSPORT_TYPE
    01022 {
    01023         ENUM_TRANSPORT_TYPE_osp = 1,
    01024         ENUM_TRANSPORT_TYPE_http,
    01025         ENUM_TRANSPORT_TYPE_smtp,
    01026         ENUM_TRANSPORT_TYPE_ftp,
    01027         ENUM_TRANSPORT_TYPE_other
    01028 };
    01029
    01030 inline int returnTransportType(std::string type)
    01031 {
    01032         if (type == "osp"  ) return ENUM_TRANSPORT_TYPE_osp;
    01033         if (type == "http" ) return ENUM_TRANSPORT_TYPE_http;
    01034         if (type == "smtp" ) return ENUM_TRANSPORT_TYPE_smtp;
    01035         if (type == "ftp"  ) return ENUM_TRANSPORT_TYPE_ftp;
    01036         if (type == "other") return ENUM_TRANSPORT_TYPE_other;
    01037         return 0;
    01038 }//returnTransportType
    01039
    01040 inline bool verifyTransportType(std::string type)
    01041 {
    01042         return (returnTransportType(type) > 0);
    01043 }//verifyTransportType
    01044
    01045 enum ENUM_SERVICE_TYPE
    01046 {
    01047         ENUM_SERVICE_TYPE_analyzer = 1,
    01048         ENUM_SERVICE_TYPE_solver,
    01049         ENUM_SERVICE_TYPE_scheduler,
    01050         ENUM_SERVICE_TYPE_modeler,
    01051         ENUM_SERVICE_TYPE_registry,
    01052         ENUM_SERVICE_TYPE_agent,
    01053         ENUM_SERVICE_TYPE_simulations
    01054 };
    01055
    01056 inline int returnServiceType(std::string type)
    01057 {
    01058         if (type == "analyzer"   ) return ENUM_SERVICE_TYPE_analyzer;
    01059         if (type == "solver"     ) return ENUM_SERVICE_TYPE_solver;
    01060         if (type == "scheduler"  ) return ENUM_SERVICE_TYPE_scheduler;
    01061         if (type == "modeler"    ) return ENUM_SERVICE_TYPE_modeler;
    01062         if (type == "registry"   ) return ENUM_SERVICE_TYPE_registry;
    01063         if (type == "agent"      ) return ENUM_SERVICE_TYPE_agent;
    01064         if (type == "simulations") return ENUM_SERVICE_TYPE_simulations;
    01065         return 0;
    01066 }//returnServiceType
    01067
    01068 inline bool verifyServiceType(std::string type)
    01069 {
    01070         return (returnServiceType(type) > 0);
    01071 }//verifyServiceType
    01072
    01073 enum ENUM_GENERAL_RESULT_STATUS
    01074 {
    01075         ENUM_GENERAL_RESULT_STATUS_error = 1,
    01076         ENUM_GENERAL_RESULT_STATUS_warning,
    01077         ENUM_GENERAL_RESULT_STATUS_normal
    01078 };
    01079
    01080 inline int returnGeneralResultStatus(std::string status)
    01081 {
    01082         if (status == "error"  ) return ENUM_GENERAL_RESULT_STATUS_error;
    01083         if (status == "warning") return ENUM_GENERAL_RESULT_STATUS_warning;
    01084         if (status == "normal" ) return ENUM_GENERAL_RESULT_STATUS_normal;
    01085         return 0;
    01086 }//returnGeneralResultStatus
    01087
    01088 inline bool verifyGeneralResultStatus(std::string status)
    01089 {
    01090         return (returnGeneralResultStatus(status) > 0);
    01091 }//verifyGeneralResultStatus
    01092
    01093 enum ENUM_SYSTEM_CURRENT_STATE
    01094 {
    01095         ENUM_SYSTEM_CURRENT_STATE_busy = 1,
    01096         ENUM_SYSTEM_CURRENT_STATE_busyButAccepting,
    01097         ENUM_SYSTEM_CURRENT_STATE_idle,
    01098         ENUM_SYSTEM_CURRENT_STATE_idleButNotAccepting,
    01099         ENUM_SYSTEM_CURRENT_STATE_noResponse
    01100 };
    01101
    01102 inline int returnSystemCurrentState(std::string status)
    01103 {
    01104         if (status == "busy"               ) return ENUM_SYSTEM_CURRENT_STATE_busy;
    01105         if (status == "busyButAccepting"   ) return ENUM_SYSTEM_CURRENT_STATE_busyButAccepting;
    01106         if (status == "idle"               ) return ENUM_SYSTEM_CURRENT_STATE_idle;
    01107         if (status == "idleButNotAccepting") return ENUM_SYSTEM_CURRENT_STATE_idleButNotAccepting;
    01108         if (status == "noResponse"         ) return ENUM_SYSTEM_CURRENT_STATE_noResponse;
    01109         return 0;
    01110 }//returnSystemCurrentState
    01111
    01112 inline bool verifySystemCurrentState(std::string status)
    01113 {
    01114         return (returnSystemCurrentState(status) > 0);
    01115 }//verifySystemCurrentState
    01116
    01117 enum ENUM_JOB_STATUS
    01118 {
    01119         ENUM_JOB_STATUS_waiting = 1,
    01120         ENUM_JOB_STATUS_running,
    01121         ENUM_JOB_STATUS_killed,
    01122         ENUM_JOB_STATUS_finished,
    01123         ENUM_JOB_STATUS_unknown
    01124 };
    01125
    01126 inline int returnJobStatus(std::string status)
    01127 {
    01128         if (status == "waiting" ) return ENUM_JOB_STATUS_waiting;
    01129         if (status == "running" ) return ENUM_JOB_STATUS_running;
    01130         if (status == "killed"  ) return ENUM_JOB_STATUS_killed;
    01131         if (status == "finished") return ENUM_JOB_STATUS_finished;
    01132         if (status == "unknown" ) return ENUM_JOB_STATUS_unknown;
    01133         return 0;
    01134 }//returnJobStatus
    01135
    01136 inline bool verifyJobStatus(std::string status)
    01137 {
    01138         return (returnJobStatus(status) > 0);
    01139 }//verifyJobStatus
    01140
    01141
    01142 enum ENUM_BASIS_STATUS
    01143 {
    01144         ENUM_BASIS_STATUS_basic = 1,
    01145         ENUM_BASIS_STATUS_atLower,
    01146         ENUM_BASIS_STATUS_atUpper,
    01147         ENUM_BASIS_STATUS_isFree,
    01148         ENUM_BASIS_STATUS_superbasic,
    01149         ENUM_BASIS_STATUS_unknown
    01150 };
    01151
    01152 inline int returnBasisStatus(std::string status)
    01153 {
    01154         if (status == "basic"     ) return ENUM_BASIS_STATUS_basic;
    01155         if (status == "atLower"   ) return ENUM_BASIS_STATUS_atLower;
    01156         if (status == "atUpper"   ) return ENUM_BASIS_STATUS_atUpper;
    01157         if (status == "isFree"    ) return ENUM_BASIS_STATUS_isFree;
    01158         if (status == "superBasic") return ENUM_BASIS_STATUS_superbasic;
    01159         if (status == "unknown"   ) return ENUM_BASIS_STATUS_unknown;
    01160         return 0;
    01161 }//returnBasisStatus
    01162
    01163 inline bool verifyBasisStatus(std::string status)
    01164 {
    01165         return (returnBasisStatus(status) > 0);
    01166 }//verifyBasisStatus
    01167
    01168 enum ENUM_SOLUTION_STATUS
    01169 {
    01170         ENUM_SOLUTION_STATUS_unbounded = 1,
    01171         ENUM_SOLUTION_STATUS_globallyOptimal,
    01172         ENUM_SOLUTION_STATUS_locallyOptimal,
    01173         ENUM_SOLUTION_STATUS_optimal,
    01174         ENUM_SOLUTION_STATUS_bestSoFar,
    01175         ENUM_SOLUTION_STATUS_feasible,
    01176         ENUM_SOLUTION_STATUS_infeasible,
    01177         ENUM_SOLUTION_STATUS_unsure,
    01178         ENUM_SOLUTION_STATUS_error,
    01179         ENUM_SOLUTION_STATUS_other
    01180 };
    01181
    01182 inline int returnSolutionStatus(std::string status)
    01183 {
    01184         if (status == "unbounded"      ) return ENUM_SOLUTION_STATUS_unbounded;
    01185         if (status == "globallyOptimal") return ENUM_SOLUTION_STATUS_globallyOptimal;
    01186         if (status == "locallyOptimal" ) return ENUM_SOLUTION_STATUS_locallyOptimal;
    01187         if (status == "optimal"        ) return ENUM_SOLUTION_STATUS_optimal;
    01188         if (status == "bestSoFar"      ) return ENUM_SOLUTION_STATUS_bestSoFar;
    01189         if (status == "feasible"       ) return ENUM_SOLUTION_STATUS_feasible;
    01190         if (status == "infeasible"     ) return ENUM_SOLUTION_STATUS_infeasible;
    01191         if (status == "unsure"         ) return ENUM_SOLUTION_STATUS_unsure;
    01192         if (status == "error"          ) return ENUM_SOLUTION_STATUS_error;
    01193         if (status == "other"          ) return ENUM_SOLUTION_STATUS_other;
    01194         return 0;
    01195 }//returnSolutionStatus
    01196
    01197 inline bool verifySolutionStatus(std::string status)
    01198 {
    01199         return (returnSolutionStatus(status) > 0);
    01200 }//verifySolutionStatus
    01201
    01202 enum ENUM_SOLUTION_SUBSTATUSTYPE
    01203 {
    01204         ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByLimit = 1,
    01205         ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByBounds,
    01206         ENUM_SOLUTION_SUBSTATUSTYPE_other
    01207 };
    01208
    01209 inline int returnSolutionSubstatusType(std::string type)
    01210 {
    01211         if (type == "stoppedByLimit" ) return ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByLimit;
    01212         if (type == "stoppedByBounds") return ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByBounds;
    01213         if (type == "other"          ) return ENUM_SOLUTION_SUBSTATUSTYPE_other;
    01214         return 0;
    01215 }//returnSolutionSubstatusType
    01216
    01217 inline bool verifySolutionSubstatusType(std::string type)
    01218 {
    01219         return (returnSolutionSubstatusType(type) > 0);
    01220 }//verifySolutionSubstatusType
    01221
    01222 enum ENUM_PROBLEM_COMPONENT
    01223 {
    01224         ENUM_PROBLEM_COMPONENT_variables = 1,
    01225         ENUM_PROBLEM_COMPONENT_objectives,
    01226         ENUM_PROBLEM_COMPONENT_constraints
    01227 };
    01228
    01229 enum ENUM_VARTYPE
    01230 {
    01231         ENUM_VARTYPE_CONTINUOUS = 1,
    01232         ENUM_VARTYPE_INTEGER,
    01233         ENUM_VARTYPE_BINARY,
    01234         ENUM_VARTYPE_SEMICONTINUOUS,
    01235         ENUM_VARTYPE_SEMIINTEGER,
    01236         ENUM_VARTYPE_STRING
    01237 };
    01238
    01239 inline int returnVarType(char vt)
    01240 {
    01241         if (vt == 'C') return ENUM_VARTYPE_CONTINUOUS;
    01242         if (vt == 'B') return ENUM_VARTYPE_BINARY;
    01243         if (vt == 'I') return ENUM_VARTYPE_INTEGER;
    01244         if (vt == 'S') return ENUM_VARTYPE_STRING;
    01245         if (vt == 'D') return ENUM_VARTYPE_SEMICONTINUOUS;
    01246         if (vt == 'J') return ENUM_VARTYPE_SEMIINTEGER;
    01247         return 0;
    01248 }//returnVarType
    01249
    01250 inline bool verifyVarType(char vt)
    01251 {
    01252         return (returnVarType(vt) > 0);
    01253 }//verifyVarType
    01254
    01255
    01256 enum ENUM_PATHPAIR
    01257 {
    01258
    01259         ENUM_PATHPAIR_input_dir = 1,
    01260         ENUM_PATHPAIR_input_file,
    01261         ENUM_PATHPAIR_output_file,
    01262         ENUM_PATHPAIR_output_dir
    01263 };
    01264
    01265 /*************************************************
    01266  *
    01267  * A function to test equality of two doubles
    01268  * This is needed to check equality of objects
    01269  * when members can have NaN as a possible value
    01270  *
    01271 *************************************************/
    01272 inline bool isEqual(double x, double y)
    01273 {
    01274         if (OSIsnan(x))
    01275         {
    01276                 if (OSIsnan(y)) return true;
    01277                 else            return false;
    01278         }
    01279         else
    01280         {
    01281                 if (x == y)     return true;
    01282                 else            return false;
    01283         }
    01284         return true;
    01285 }
    01286
    01287
    01288 #endif