/home/coin/SVN-release/OS-2.4.1/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 #include "OSConfig.h"
00020 #include "OSParameters.h"
00021 
00022 #include <string>
00023 #include <vector>
00024 
00029 class GeneralFileHeader
00030 {
00031 public:
00032 
00036     std::string name;
00037 
00042     std::string source;
00043 
00047     std::string description;
00048 
00052     std::string fileCreator;
00053 
00057     std::string licence;
00058 
00059 
00064     GeneralFileHeader();
00065 
00070     ~GeneralFileHeader();
00071 
00076     bool IsEqual(GeneralFileHeader *that);
00077 
00085     bool setRandom(double density, bool conformant);
00086 
00096     bool setHeader(std::string name, std::string source, std::string description,
00097                    std::string fileCreator, std::string licence);
00098 
00099 }; //GeneralFileHeader
00100 
00101 
00105 class SparseVector
00106 {
00107 public:
00108 
00114     SparseVector(int number);
00115 
00120     SparseVector();
00121 
00126     ~SparseVector();
00127 
00132     bool bDeleteArrays;
00133 
00137     int number;
00138 
00142     int* indexes;
00143 
00147     double* values;
00148 
00149 }; //SparseVector
00150 
00151 
00155 class SparseMatrix
00156 {
00157 public:
00158 
00163     bool bDeleteArrays;
00164 
00169     bool isColumnMajor;
00170 
00174     int startSize;
00175 
00179     int valueSize;
00180 
00185     int* starts;
00186 
00191     int* indexes;
00192 
00197     double* values;
00198 
00203     SparseMatrix();
00204 
00213     SparseMatrix(bool isColumnMajor_, int startSize, int valueSize);
00218     ~SparseMatrix();
00219 
00225     bool display(int secondaryDim);
00226 
00227 }; //SparseMatrix
00228 
00229 
00233 class SparseJacobianMatrix
00234 {
00235 public:
00236 
00241     bool bDeleteArrays;
00242 
00246     int startSize;
00247 
00251     int valueSize;
00252 
00257     int* starts;
00258 
00263     int* conVals;
00264 
00268     int* indexes;
00269 
00273     double* values;
00274 
00279     SparseJacobianMatrix();
00280 
00287     SparseJacobianMatrix(int startSize, int valueSize);
00288 
00293     ~SparseJacobianMatrix();
00294 
00295 }; //SparseJacobianMatrix
00296 
00297 
00298 
00299 
00300 
00311 class SparseHessianMatrix
00312 {
00313 public:
00314 
00319     bool bDeleteArrays;
00320 
00324     int hessDimension;
00325 
00329     int* hessRowIdx;
00330 
00334     int* hessColIdx;
00335 
00339     double* hessValues;
00340 
00345     SparseHessianMatrix();
00346 
00353     SparseHessianMatrix(int startSize, int valueSize);
00354 
00359     ~SparseHessianMatrix();
00360 
00361 }; //SparseHessianMatrix
00362 
00366 class QuadraticTerms
00367 {
00368 
00369 public:
00370 
00375     int* rowIndexes;
00376 
00380     int* varOneIndexes;
00381 
00385     int* varTwoIndexes;
00386 
00390     double* coefficients;
00391 
00396     QuadraticTerms();
00397     ~QuadraticTerms();
00398 }; //QuadraticTerms
00399 
00400 
00401 
00405 class IntVector
00406 {
00407 public:
00408     IntVector();
00409     ~IntVector();
00410 
00411     // alternate constructor
00412     IntVector(int n);
00413 
00418     bool bDeleteArrays;
00419     int numberOfEl;
00420     int *el;
00421 
00425     bool IsEqual(IntVector *that);
00426 
00436     bool setRandom(double density, bool conformant, int iMin, int iMax);
00437 
00443     bool setIntVector(int *i, int ni);
00444 
00449     bool extendIntVector(int i);
00450 
00454     int getNumberOfEl();
00455 
00460     int getEl(int j);
00461 
00462 
00470     bool getEl(int *i);
00471 };//class IntVector
00472 
00473 
00479 class OtherOptionEnumeration : public IntVector
00480 {
00481 public:
00482     std::string value;
00483     std::string description;
00484 
00485     OtherOptionEnumeration();
00486     ~OtherOptionEnumeration();
00487 
00488     // alternate constructor
00489     OtherOptionEnumeration(int n);
00490 
00495     bool IsEqual(OtherOptionEnumeration *that);
00496 
00506     bool setRandom(double density, bool conformant, int iMin, int iMax);
00507 
00515     bool setOtherOptionEnumeration(std::string value, std::string description, int *i, int ni);
00516 
00517 
00521     std::string getValue();
00522 
00526     std::string getDescription();
00527 
00528 };//class OtherOptionEnumeration
00529 
00530 
00531 
00535 class DoubleVector
00536 {
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
00556 {
00560     int idx;
00561 
00564     double value;
00565 
00566 };
00567 
00572 class BasisStatus
00573 {
00574 public:
00575     IntVector* basic;
00576     IntVector* atLower;
00577     IntVector* atUpper;
00578     IntVector* isFree;
00579     IntVector* superbasic;
00580     IntVector* unknown;
00581 
00582     BasisStatus();
00583     ~BasisStatus();
00584 
00589     bool IsEqual(BasisStatus *that);
00590 
00600     bool setRandom(double density, bool conformant, int iMin, int iMax);
00601 
00609     bool setIntVector(int status, int *i, int ni);
00610 
00617     bool addIdx(int status, int idx);
00618 
00625     int getNumberOfEl(int status);
00626 
00627 
00635     int getEl(int status, int j);
00636 
00646     bool getIntVector(int status, int *i);
00647 };//class BasisStatus
00648 
00658 class StorageCapacity
00659 {
00660 
00661 public:
00663     std::string unit;
00664 
00666     std::string description;
00667 
00669     double value;
00670 
00675     StorageCapacity();
00680     ~StorageCapacity();
00681 
00686     bool IsEqual(StorageCapacity *that);
00687 
00695     bool setRandom(double density, bool conformant);
00696 }; //StorageCapacity
00697 
00709 class CPUSpeed
00710 {
00711 
00712 public:
00714     std::string unit;
00715 
00717     std::string description;
00718 
00720     double value;
00721 
00726     CPUSpeed();
00731     ~CPUSpeed();
00732 
00737     bool IsEqual(CPUSpeed *that);
00738 
00746     bool setRandom(double density, bool conformant);
00747 }; //CPUSpeed
00748 
00760 class CPUNumber
00761 {
00762 
00763 public:
00765     std::string description;
00766 
00768     int value;
00769 
00774     CPUNumber();
00779     ~CPUNumber();
00780 
00785     bool IsEqual(CPUNumber *that);
00786 
00794     bool setRandom(double density, bool conformant);
00795 }; //CPUNumber
00796 
00806 class TimeSpan
00807 {
00808 
00809 public:
00811     std::string unit;
00812 
00814     double value;
00815 
00820     TimeSpan();
00825     ~TimeSpan();
00826 
00831     bool IsEqual(TimeSpan *that);
00832 
00840     bool setRandom(double density, bool conformant);
00841 }; //TimeSpan
00842 
00843 
00844 
00845 class OSGeneral
00846 {
00847 
00848 };
00849 
00850 /***************************************************************************************
00851  * In the schemas there is a growing number of string elements that can only take
00852  * a small number of values. One implementation in C++ uses enumerations, but the
00853  * elements appear in the schemas as strings, so they must be stored internally
00854  * as strings also. Below we list the enumerations and provide two utility methods
00855  * that make working with them convenient:
00856  * return...() functions that return the integer value associated with that enumeration
00857  * verify...() functions that check that a string has a legal value for the enumeration
00858  ***************************************************************************************/
00859 
00860 enum ENUM_CPUSPEEDUNIT
00861 {
00862     ENUM_CPUSPEEDUNIT_hertz = 1,
00863     ENUM_CPUSPEEDUNIT_kilohertz,
00864     ENUM_CPUSPEEDUNIT_megahertz,
00865     ENUM_CPUSPEEDUNIT_gigahertz,
00866     ENUM_CPUSPEEDUNIT_terahertz,
00867     ENUM_CPUSPEEDUNIT_flops,
00868     ENUM_CPUSPEEDUNIT_kiloflops,
00869     ENUM_CPUSPEEDUNIT_megaflops,
00870     ENUM_CPUSPEEDUNIT_gigaflops,
00871     ENUM_CPUSPEEDUNIT_teraflops,
00872     ENUM_CPUSPEEDUNIT_petaflops
00873 };
00874 
00875 inline int returnCPUSpeedUnit(std::string unit)
00876 {
00877     if (unit == "hertz"    ) return ENUM_CPUSPEEDUNIT_hertz;
00878     if (unit == "kilohertz") return ENUM_CPUSPEEDUNIT_kilohertz;
00879     if (unit == "megahertz") return ENUM_CPUSPEEDUNIT_megahertz;
00880     if (unit == "gigahertz") return ENUM_CPUSPEEDUNIT_gigahertz;
00881     if (unit == "terahertz") return ENUM_CPUSPEEDUNIT_terahertz;
00882     if (unit == "flops"    ) return ENUM_CPUSPEEDUNIT_flops;
00883     if (unit == "kiloflops") return ENUM_CPUSPEEDUNIT_kiloflops;
00884     if (unit == "megaflops") return ENUM_CPUSPEEDUNIT_megaflops;
00885     if (unit == "gigaflops") return ENUM_CPUSPEEDUNIT_gigaflops;
00886     if (unit == "teraflops") return ENUM_CPUSPEEDUNIT_teraflops;
00887     if (unit == "petaflops") return ENUM_CPUSPEEDUNIT_petaflops;
00888     return 0;
00889 }//returnCPUSpeedUnit
00890 
00891 inline bool verifyCPUSpeedUnit(std::string unit)
00892 {
00893     return (returnCPUSpeedUnit(unit) > 0);
00894 }//verifyCPUSpeedUnit
00895 
00896 enum ENUM_STORAGEUNIT
00897 {
00898     ENUM_STORAGEUNIT_byte = 1,
00899     ENUM_STORAGEUNIT_kilobyte,
00900     ENUM_STORAGEUNIT_megabyte,
00901     ENUM_STORAGEUNIT_gigabyte,
00902     ENUM_STORAGEUNIT_terabyte,
00903     ENUM_STORAGEUNIT_petabyte,
00904     ENUM_STORAGEUNIT_exabyte,
00905     ENUM_STORAGEUNIT_zettabyte,
00906     ENUM_STORAGEUNIT_yottabyte
00907 };
00908 
00909 inline int returnStorageUnit(std::string unit)
00910 {
00911     if (unit == "byte"     ) return ENUM_STORAGEUNIT_byte;
00912     if (unit == "kilobyte" ) return ENUM_STORAGEUNIT_kilobyte;
00913     if (unit == "megabyte" ) return ENUM_STORAGEUNIT_megabyte;
00914     if (unit == "gigabyte" ) return ENUM_STORAGEUNIT_gigabyte;
00915     if (unit == "terabyte" ) return ENUM_STORAGEUNIT_terabyte;
00916     if (unit == "petabyte" ) return ENUM_STORAGEUNIT_petabyte;
00917     if (unit == "exabyte"  ) return ENUM_STORAGEUNIT_exabyte;
00918     if (unit == "zettabyte") return ENUM_STORAGEUNIT_zettabyte;
00919     if (unit == "yottabyte") return ENUM_STORAGEUNIT_yottabyte;
00920     return 0;
00921 }//returnStorageUnit
00922 
00923 inline bool verifyStorageUnit(std::string unit)
00924 {
00925     return (returnStorageUnit(unit) > 0);
00926 }//verifyCPUSpeedUnit
00927 
00928 enum ENUM_TIMEUNIT
00929 {
00930     ENUM_TIMEUNIT_tick = 1,
00931     ENUM_TIMEUNIT_millisecond,
00932     ENUM_TIMEUNIT_second,
00933     ENUM_TIMEUNIT_minute,
00934     ENUM_TIMEUNIT_hour,
00935     ENUM_TIMEUNIT_day,
00936     ENUM_TIMEUNIT_week,
00937     ENUM_TIMEUNIT_month,
00938     ENUM_TIMEUNIT_year
00939 };
00940 
00941 inline int returnTimeUnit(std::string unit)
00942 {
00943     if (unit == "tick"       ) return ENUM_TIMEUNIT_tick;
00944     if (unit == "millisecond") return ENUM_TIMEUNIT_millisecond;
00945     if (unit == "second"     ) return ENUM_TIMEUNIT_second;
00946     if (unit == "minute"     ) return ENUM_TIMEUNIT_minute;
00947     if (unit == "hour"       ) return ENUM_TIMEUNIT_hour;
00948     if (unit == "day"        ) return ENUM_TIMEUNIT_day;
00949     if (unit == "week"       ) return ENUM_TIMEUNIT_week;
00950     if (unit == "month"      ) return ENUM_TIMEUNIT_month;
00951     if (unit == "year"       ) return ENUM_TIMEUNIT_year;
00952     return 0;
00953 }//returnTimeUnit
00954 
00955 inline bool verifyTimeUnit(std::string unit)
00956 {
00957     return (returnTimeUnit(unit) > 0);
00958 }//verifyTimeUnit
00959 
00960 enum ENUM_TIMETYPE
00961 {
00962     ENUM_TIMETYPE_cpuTime = 1,
00963     ENUM_TIMETYPE_elapsedTime,
00964     ENUM_TIMETYPE_other
00965 };
00966 
00967 inline int returnTimeType(std::string type)
00968 {
00969     if (type == "cpuTime"    ) return ENUM_TIMETYPE_cpuTime;
00970     if (type == "elapsedTime") return ENUM_TIMETYPE_elapsedTime;
00971     if (type == "other"      ) return ENUM_TIMETYPE_other;
00972     return 0;
00973 }//returnTimeType
00974 
00975 inline bool verifyTimeType(std::string type)
00976 {
00977     return (returnTimeType(type) > 0);
00978 }//verifyTimeType
00979 
00980 enum ENUM_TIMECATEGORY
00981 {
00982     ENUM_TIMECATEGORY_total = 1,
00983     ENUM_TIMECATEGORY_input,
00984     ENUM_TIMECATEGORY_preprocessing,
00985     ENUM_TIMECATEGORY_optimization,
00986     ENUM_TIMECATEGORY_postprocessing,
00987     ENUM_TIMECATEGORY_output,
00988     ENUM_TIMECATEGORY_other
00989 };
00990 
00991 inline int returnTimeCategory(std::string category)
00992 {
00993     if (category == "total"         ) return ENUM_TIMECATEGORY_total;
00994     if (category == "input"         ) return ENUM_TIMECATEGORY_input;
00995     if (category == "preprocessing" ) return ENUM_TIMECATEGORY_preprocessing;
00996     if (category == "optimization"  ) return ENUM_TIMECATEGORY_optimization;
00997     if (category == "postprocessing") return ENUM_TIMECATEGORY_postprocessing;
00998     if (category == "output"        ) return ENUM_TIMECATEGORY_output;
00999     if (category == "other"         ) return ENUM_TIMECATEGORY_other;
01000     return 0;
01001 }//returnTimeCategory
01002 
01003 inline bool verifyTimeCategory(std::string category)
01004 {
01005     return (returnTimeCategory(category) > 0);
01006 }//verifyTimeCategory
01007 
01008 enum ENUM_LOCATIONTYPE
01009 {
01010     ENUM_LOCATIONTYPE_local = 1,
01011     ENUM_LOCATIONTYPE_http,
01012     ENUM_LOCATIONTYPE_ftp
01013 };
01014 
01015 inline int returnLocationType(std::string type)
01016 {
01017     if (type == "local") return ENUM_LOCATIONTYPE_local;
01018     if (type == "http" ) return ENUM_LOCATIONTYPE_http;
01019     if (type == "ftp"  ) return ENUM_LOCATIONTYPE_ftp;
01020     return 0;
01021 }//returnLocationType
01022 
01023 inline bool verifyLocationType(std::string type)
01024 {
01025     return (returnLocationType(type) > 0);
01026 }//verifyLocationType
01027 
01028 enum ENUM_TRANSPORT_TYPE
01029 {
01030     ENUM_TRANSPORT_TYPE_osp = 1,
01031     ENUM_TRANSPORT_TYPE_http,
01032     ENUM_TRANSPORT_TYPE_smtp,
01033     ENUM_TRANSPORT_TYPE_ftp,
01034     ENUM_TRANSPORT_TYPE_other
01035 };
01036 
01037 inline int returnTransportType(std::string type)
01038 {
01039     if (type == "osp"  ) return ENUM_TRANSPORT_TYPE_osp;
01040     if (type == "http" ) return ENUM_TRANSPORT_TYPE_http;
01041     if (type == "smtp" ) return ENUM_TRANSPORT_TYPE_smtp;
01042     if (type == "ftp"  ) return ENUM_TRANSPORT_TYPE_ftp;
01043     if (type == "other") return ENUM_TRANSPORT_TYPE_other;
01044     return 0;
01045 }//returnTransportType
01046 
01047 inline bool verifyTransportType(std::string type)
01048 {
01049     return (returnTransportType(type) > 0);
01050 }//verifyTransportType
01051 
01052 enum ENUM_SERVICE_TYPE
01053 {
01054     ENUM_SERVICE_TYPE_analyzer = 1,
01055     ENUM_SERVICE_TYPE_solver,
01056     ENUM_SERVICE_TYPE_scheduler,
01057     ENUM_SERVICE_TYPE_modeler,
01058     ENUM_SERVICE_TYPE_registry,
01059     ENUM_SERVICE_TYPE_agent,
01060     ENUM_SERVICE_TYPE_simulations
01061 };
01062 
01063 inline int returnServiceType(std::string type)
01064 {
01065     if (type == "analyzer"   ) return ENUM_SERVICE_TYPE_analyzer;
01066     if (type == "solver"     ) return ENUM_SERVICE_TYPE_solver;
01067     if (type == "scheduler"  ) return ENUM_SERVICE_TYPE_scheduler;
01068     if (type == "modeler"    ) return ENUM_SERVICE_TYPE_modeler;
01069     if (type == "registry"   ) return ENUM_SERVICE_TYPE_registry;
01070     if (type == "agent"      ) return ENUM_SERVICE_TYPE_agent;
01071     if (type == "simulations") return ENUM_SERVICE_TYPE_simulations;
01072     return 0;
01073 }//returnServiceType
01074 
01075 inline bool verifyServiceType(std::string type)
01076 {
01077     return (returnServiceType(type) > 0);
01078 }//verifyServiceType
01079 
01080 enum ENUM_GENERAL_RESULT_STATUS
01081 {
01082     ENUM_GENERAL_RESULT_STATUS_error = 1,
01083     ENUM_GENERAL_RESULT_STATUS_warning,
01084     ENUM_GENERAL_RESULT_STATUS_normal
01085 };
01086 
01087 inline int returnGeneralResultStatus(std::string status)
01088 {
01089     if (status == "error"  ) return ENUM_GENERAL_RESULT_STATUS_error;
01090     if (status == "warning") return ENUM_GENERAL_RESULT_STATUS_warning;
01091     if (status == "normal" ) return ENUM_GENERAL_RESULT_STATUS_normal;
01092     return 0;
01093 }//returnGeneralResultStatus
01094 
01095 inline bool verifyGeneralResultStatus(std::string status)
01096 {
01097     return (returnGeneralResultStatus(status) > 0);
01098 }//verifyGeneralResultStatus
01099 
01100 enum ENUM_SYSTEM_CURRENT_STATE
01101 {
01102     ENUM_SYSTEM_CURRENT_STATE_busy = 1,
01103     ENUM_SYSTEM_CURRENT_STATE_busyButAccepting,
01104     ENUM_SYSTEM_CURRENT_STATE_idle,
01105     ENUM_SYSTEM_CURRENT_STATE_idleButNotAccepting,
01106     ENUM_SYSTEM_CURRENT_STATE_noResponse
01107 };
01108 
01109 inline int returnSystemCurrentState(std::string status)
01110 {
01111     if (status == "busy"               ) return ENUM_SYSTEM_CURRENT_STATE_busy;
01112     if (status == "busyButAccepting"   ) return ENUM_SYSTEM_CURRENT_STATE_busyButAccepting;
01113     if (status == "idle"               ) return ENUM_SYSTEM_CURRENT_STATE_idle;
01114     if (status == "idleButNotAccepting") return ENUM_SYSTEM_CURRENT_STATE_idleButNotAccepting;
01115     if (status == "noResponse"         ) return ENUM_SYSTEM_CURRENT_STATE_noResponse;
01116     return 0;
01117 }//returnSystemCurrentState
01118 
01119 inline bool verifySystemCurrentState(std::string status)
01120 {
01121     return (returnSystemCurrentState(status) > 0);
01122 }//verifySystemCurrentState
01123 
01124 enum ENUM_JOB_STATUS
01125 {
01126     ENUM_JOB_STATUS_waiting = 1,
01127     ENUM_JOB_STATUS_running,
01128     ENUM_JOB_STATUS_killed,
01129     ENUM_JOB_STATUS_finished,
01130     ENUM_JOB_STATUS_unknown
01131 };
01132 
01133 inline int returnJobStatus(std::string status)
01134 {
01135     if (status == "waiting" ) return ENUM_JOB_STATUS_waiting;
01136     if (status == "running" ) return ENUM_JOB_STATUS_running;
01137     if (status == "killed"  ) return ENUM_JOB_STATUS_killed;
01138     if (status == "finished") return ENUM_JOB_STATUS_finished;
01139     if (status == "unknown" ) return ENUM_JOB_STATUS_unknown;
01140     return 0;
01141 }//returnJobStatus
01142 
01143 inline bool verifyJobStatus(std::string status)
01144 {
01145     return (returnJobStatus(status) > 0);
01146 }//verifyJobStatus
01147 
01148 
01149 enum ENUM_BASIS_STATUS
01150 {
01151     ENUM_BASIS_STATUS_basic = 1,
01152     ENUM_BASIS_STATUS_atLower,
01153     ENUM_BASIS_STATUS_atUpper,
01154     ENUM_BASIS_STATUS_isFree,
01155     ENUM_BASIS_STATUS_superbasic,
01156     ENUM_BASIS_STATUS_unknown
01157 };
01158 
01159 inline int returnBasisStatus(std::string status)
01160 {
01161     if (status == "basic"     ) return ENUM_BASIS_STATUS_basic;
01162     if (status == "atLower"   ) return ENUM_BASIS_STATUS_atLower;
01163     if (status == "atUpper"   ) return ENUM_BASIS_STATUS_atUpper;
01164     if (status == "isFree"    ) return ENUM_BASIS_STATUS_isFree;
01165     if (status == "superBasic") return ENUM_BASIS_STATUS_superbasic;
01166     if (status == "unknown"   ) return ENUM_BASIS_STATUS_unknown;
01167     return 0;
01168 }//returnBasisStatus
01169 
01170 inline bool verifyBasisStatus(std::string status)
01171 {
01172     return (returnBasisStatus(status) > 0);
01173 }//verifyBasisStatus
01174 
01175 enum ENUM_SOLUTION_STATUS
01176 {
01177     ENUM_SOLUTION_STATUS_unbounded = 1,
01178     ENUM_SOLUTION_STATUS_globallyOptimal,
01179     ENUM_SOLUTION_STATUS_locallyOptimal,
01180     ENUM_SOLUTION_STATUS_optimal,
01181     ENUM_SOLUTION_STATUS_bestSoFar,
01182     ENUM_SOLUTION_STATUS_feasible,
01183     ENUM_SOLUTION_STATUS_infeasible,
01184     ENUM_SOLUTION_STATUS_unsure,
01185     ENUM_SOLUTION_STATUS_error,
01186     ENUM_SOLUTION_STATUS_other
01187 };
01188 
01189 inline int returnSolutionStatus(std::string status)
01190 {
01191     if (status == "unbounded"      ) return ENUM_SOLUTION_STATUS_unbounded;
01192     if (status == "globallyOptimal") return ENUM_SOLUTION_STATUS_globallyOptimal;
01193     if (status == "locallyOptimal" ) return ENUM_SOLUTION_STATUS_locallyOptimal;
01194     if (status == "optimal"        ) return ENUM_SOLUTION_STATUS_optimal;
01195     if (status == "bestSoFar"      ) return ENUM_SOLUTION_STATUS_bestSoFar;
01196     if (status == "feasible"       ) return ENUM_SOLUTION_STATUS_feasible;
01197     if (status == "infeasible"     ) return ENUM_SOLUTION_STATUS_infeasible;
01198     if (status == "unsure"         ) return ENUM_SOLUTION_STATUS_unsure;
01199     if (status == "error"          ) return ENUM_SOLUTION_STATUS_error;
01200     if (status == "other"          ) return ENUM_SOLUTION_STATUS_other;
01201     return 0;
01202 }//returnSolutionStatus
01203 
01204 inline bool verifySolutionStatus(std::string status)
01205 {
01206     return (returnSolutionStatus(status) > 0);
01207 }//verifySolutionStatus
01208 
01209 enum ENUM_SOLUTION_SUBSTATUSTYPE
01210 {
01211     ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByLimit = 1,
01212     ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByBounds,
01213     ENUM_SOLUTION_SUBSTATUSTYPE_other
01214 };
01215 
01216 inline int returnSolutionSubstatusType(std::string type)
01217 {
01218     if (type == "stoppedByLimit" ) return ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByLimit;
01219     if (type == "stoppedByBounds") return ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByBounds;
01220     if (type == "other"          ) return ENUM_SOLUTION_SUBSTATUSTYPE_other;
01221     return 0;
01222 }//returnSolutionSubstatusType
01223 
01224 inline bool verifySolutionSubstatusType(std::string type)
01225 {
01226     return (returnSolutionSubstatusType(type) > 0);
01227 }//verifySolutionSubstatusType
01228 
01229 enum ENUM_PROBLEM_COMPONENT
01230 {
01231     ENUM_PROBLEM_COMPONENT_variables = 1,
01232     ENUM_PROBLEM_COMPONENT_objectives,
01233     ENUM_PROBLEM_COMPONENT_constraints
01234 };
01235 
01236 enum ENUM_VARTYPE
01237 {
01238     ENUM_VARTYPE_CONTINUOUS = 1,
01239     ENUM_VARTYPE_INTEGER,
01240     ENUM_VARTYPE_BINARY,
01241     ENUM_VARTYPE_SEMICONTINUOUS,
01242     ENUM_VARTYPE_SEMIINTEGER,
01243     ENUM_VARTYPE_STRING
01244 };
01245 
01246 inline int returnVarType(char vt)
01247 {
01248     if (vt == 'C') return ENUM_VARTYPE_CONTINUOUS;
01249     if (vt == 'B') return ENUM_VARTYPE_BINARY;
01250     if (vt == 'I') return ENUM_VARTYPE_INTEGER;
01251     if (vt == 'S') return ENUM_VARTYPE_STRING;
01252     if (vt == 'D') return ENUM_VARTYPE_SEMICONTINUOUS;
01253     if (vt == 'J') return ENUM_VARTYPE_SEMIINTEGER;
01254     return 0;
01255 }//returnVarType
01256 
01257 inline bool verifyVarType(char vt)
01258 {
01259     return (returnVarType(vt) > 0);
01260 }//verifyVarType
01261 
01262 
01263 enum ENUM_PATHPAIR
01264 {
01265 
01266     ENUM_PATHPAIR_input_dir = 1,
01267     ENUM_PATHPAIR_input_file,
01268     ENUM_PATHPAIR_output_file,
01269     ENUM_PATHPAIR_output_dir
01270 };
01271 
01272 /*************************************************
01273  *
01274  * A function to test equality of two doubles
01275  * This is needed to check equality of objects
01276  * when members can have NaN as a possible value
01277  *
01278 *************************************************/
01279 inline bool isEqual(double x, double y)
01280 {
01281     if (OSIsnan(x) && OSIsnan(y)) return true;
01282     if (x == y) return true;
01283     return false;
01284 }
01285 
01286 
01287 #endif

Generated on Thu Nov 10 03:05:47 2011 by  doxygen 1.4.7