00001 /* #start# *********************************************************** 00002 00003 Scheduling Simulator 00004 Lehrstuhl f"ur Effiziente Algorithmen 00005 Technische Universit"at M"unchen 00006 00007 File : $Id: SClassification.h,v 1.5 2003/03/21 15:47:05 taeubig Exp $ 00008 00009 Purpose : this class implements the usual classification scheme for 00010 scheduling algorithms and problems. classifications can be 00011 compared in order to find out whether an algorithm and a 00012 problem instance are compatible. 00013 00014 RCS-Log: 00015 $Log: SClassification.h,v $ 00016 Revision 1.5 2003/03/21 15:47:05 taeubig 00017 merge with source from Bertolt 00018 00019 Revision 1.4 2003/01/24 10:04:46 hall 00020 brdCast stuff 00021 00022 Revision 1.3 2003/01/08 18:57:10 meierb 00023 added randomized release times 00024 00025 Revision 1.4 2003/01/08 15:29:06 meierb 00026 schlcht gelaufen mit der Pruefung 00027 00028 Revision 1.3 2003/01/06 22:27:47 meierb 00029 blablabla 00030 00031 Revision 1.2 2002/12/16 23:32:09 meierb 00032 *** empty log message *** 00033 00034 Revision 1.1.1.1 2002/12/02 22:26:19 meierb 00035 my_schedule 00036 00037 Revision 1.1 2002/08/29 12:59:58 taeubig 00038 Added the sources 00039 00040 Revision 1.19 2000/12/06 11:35:09 taeubig 00041 Cosmetics (seperate->separate) 00042 00043 Revision 1.18 2000/12/04 16:08:31 taeubig 00044 Incremented size of _egArray 00045 00046 Revision 1.17 2000/07/23 18:57:47 mayerh 00047 added method to seperate input-string 00048 00049 Revision 1.16 2000/07/19 19:59:19 mayerh 00050 added methods to get and set Job-Time Intervals 00051 00052 Revision 1.15 2000/06/13 14:02:26 hall 00053 no real changes ... 00054 00055 Revision 1.14 2000/06/09 14:08:24 schickin 00056 small bug in SClassification removed (static h_array is now d_array) 00057 00058 Revision 1.13 2000/05/31 14:59:50 mayerh 00059 added static member-variables 00060 00061 Revision 1.12 2000/05/24 12:21:01 taeubig 00062 New compiler (gcc-2.95) and new Qt (2.1) 00063 Replaced "list" by "leda_list" etc. 00064 00065 Revision 1.11 2000/05/09 10:36:06 taeubig 00066 Added const declarations 00067 00068 Revision 1.10 2000/05/07 22:27:31 taeubig 00069 Minor changes to avoid warnings and make it compile with gcc 2.95.2 00070 00071 Revision 1.9 2000/04/19 19:57:44 mayerh 00072 deleted get- / setNumberOfMachines 00073 00074 Revision 1.8 2000/04/14 10:01:54 mayerh 00075 added function setNumberOfMachines() 00076 00077 Revision 1.7 2000/04/12 20:42:47 mayerh 00078 added attributes _descriptor, _numberOfMachines and corresponding access methods 00079 00080 Revision 1.6 2000/04/05 21:00:56 mayerh 00081 added explicit declaration of the default-constructor (required by some compiler-versions) 00082 00083 Revision 1.5 2000/03/28 13:03:05 hall 00084 updated Interface of SClassif and SSchedAlg. 00085 00086 Revision 1.4 2000/01/12 11:31:33 zoidl 00087 added javadoc comments and cosmetic changes in getDescription 00088 00089 Revision 1.3 1999/08/05 08:47:45 schickin 00090 purpose of important classes noted in the header-files 00091 00092 Revision 1.2 1999/01/29 10:03:25 schickin 00093 Project-Headers added. 00094 00095 00096 * #end# ************************************************************* */ 00097 00098 #ifndef SCLASSIFICATION_H 00099 #define SCLASSIFICATION_H 00100 00101 #include <LEDA/string.h> 00102 #include <LEDA/graph.h> 00103 #include <LEDA/graph_alg.h> 00104 #include <LEDA/list.h> 00105 #include <LEDA/d_array.h> 00106 00114 class SClassification { 00115 public: 00120 SClassification(){} 00121 SClassification(const leda_string &s); 00122 00123 bool isGeneralizationOf(const SClassification &classif) const; 00124 const leda_string &getDescriptor(int i) const; 00128 const leda_string &toString() const; 00129 00130 /* 00131 * use the following methods to read and write the interval bounds of the 00132 * job finishing times(PVal*) or the release times(RVal*). 00133 * If the processing times depend only on one parameter(e.g. they are constant 00134 * or distributed exponentially) use just val1, or set both values the same. 00135 */ 00136 00137 double getPVal1() const; 00138 void setPVal1(double val); 00139 double getPVal2() const; 00140 void setPVal2(double val); 00141 00142 double getRVal1() const; 00143 void setRVal1(double val); 00144 00145 private: 00146 static const int _intArrayLength = 6; 00147 00148 static bool _boolFirstInit; 00149 static leda_graph _G; 00150 static leda_d_array<leda_string, leda_node> _ndArray[_intArrayLength]; 00151 static leda_edge _egArray[_intArrayLength][19]; 00152 00153 leda_string _descriptor[_intArrayLength]; 00154 int _numberOfMachines; 00155 // parameters for processing times (e.g. lower, upper, parameter) 00156 double _pval1; 00157 double _pval2; 00158 // parameters for release times (e.g. rate, length n) 00159 double _rval1; 00160 00161 // ---------------------------------------------------------------------- 00162 leda_list<leda_string> separateInputString(leda_string s) { 00163 char tmp; 00164 leda_list<leda_string> lstTmp; 00165 int intLeft = 0, intRight = 0; 00166 00167 for(int i = 0; i < s.length(); i++) { 00168 tmp = s[i]; 00169 if (tmp == ',' || tmp == '|') { 00170 lstTmp.push(s(intLeft, intRight)); 00171 intLeft = intRight + 2; 00172 } 00173 intRight = i; 00174 } 00175 //get last string 00176 lstTmp.push(s(intLeft, intRight)); 00177 return lstTmp; 00178 } 00179 00180 }; 00181 // ---------------------------------------------------------------------- 00182 00183 #endif //SCLASSIFICATION_H 00184 00185