00001 /* #start# *********************************************************** 00002 00003 Scheduling Simulator 00004 Lehrstuhl f"ur Effiziente Algorithmen 00005 Technische Universit"at M"unchen 00006 00007 File : $Id: SShopJob.h,v 1.6 2003/03/21 15:47:05 taeubig Exp $ 00008 00009 Purpose : 00010 00011 RCS-Log: 00012 $Log: SShopJob.h,v $ 00013 Revision 1.6 2003/03/21 15:47:05 taeubig 00014 merge with source from Bertolt 00015 00016 Revision 1.5 2003/01/24 10:05:02 hall 00017 brdCast stuff 00018 00019 Revision 1.4 2003/01/08 18:57:13 meierb 00020 added randomized release times 00021 00022 Revision 1.2 2002/12/16 23:32:09 meierb 00023 *** empty log message *** 00024 00025 Revision 1.1.1.1 2002/12/02 22:26:19 meierb 00026 my_schedule 00027 00028 Revision 1.2 2002/11/09 20:50:15 taeubig 00029 <iostream> inclusion, added std:: 00030 corrected relative path for header includes 00031 00032 Revision 1.1 2002/08/29 12:59:59 taeubig 00033 Added the sources 00034 00035 Revision 1.1 2000/05/29 19:51:32 taeubig 00036 Moved job type related files into subdirectory jobs 00037 00038 Revision 1.15 2000/05/24 12:46:24 taeubig 00039 New compiler (gcc-2.95) and new Qt (2.1) 00040 Replaced "list" by "leda_list" etc. 00041 00042 Revision 1.14 2000/01/13 00:47:10 zoidl 00043 added javadoc comments 00044 00045 Revision 1.13 1999/12/28 23:32:59 zoidl 00046 SShopJob::setNumOfOperations() is dead, long live 00047 SGeneralShopMod::setNumOperations() 00048 00049 Revision 1.12 1999/11/30 01:27:59 zoidl 00050 thetest2 crashed: renamed protected: advanceProcTime() to 00051 private: advanceOpProcTime() 00052 00053 Revision 1.11 1999/11/30 00:03:00 zoidl 00054 now setCurrOper() checks if order of ops is respected 00055 00056 Revision 1.10 1999/11/24 17:51:44 zoidl 00057 open shop example works 00058 00059 Revision 1.9 1999/11/17 14:57:41 schickin 00060 frame for shop models added 00061 00062 Revision 1.8 1999/11/16 14:46:56 schickin 00063 reset()-bug in environment and machines removed 00064 00065 Revision 1.7 1999/11/05 14:26:32 zoidl 00066 prepared for loading shop-jobs 00067 00068 Revision 1.6 1999/06/17 16:34:49 hall 00069 STopology changed, tuned STSysSchedEvent-stuff and lost more! 00070 00071 Revision 1.5 1999/05/06 14:51:42 schickin 00072 event handling by jobs and machines redesigned 00073 00074 Revision 1.4 1999/03/31 11:13:33 hall 00075 added a few output operators and save routines 00076 00077 Revision 1.3 1999/02/12 11:55:50 hall 00078 impl. SEnvironment slice 00079 00080 Revision 1.2 1999/01/29 10:03:53 schickin 00081 Project-Headers added. 00082 00083 00084 * #end# ************************************************************* */ 00085 00086 #ifndef SSHOPJOB_H 00087 #define SSHOPJOB_H 00088 00089 // system header files 00090 #include <iostream> 00091 00092 #include <LEDA/array.h> 00093 00094 // project header files 00095 #include "SJob.h" 00096 #include "SShopJobMod.h" 00097 00098 class SGeneralShop; 00099 00100 // ----------------------------------------------------------------------- 00113 class SShopJob : public virtual SJob { 00114 00115 TYPEINFO0(SShopJob, "shop"); 00116 public: 00119 SShopJob(SProbabilityDist* dist); 00120 SShopJob(double proctime); 00121 /* Destructor 00122 */ 00123 virtual ~SShopJob() {}; 00124 00130 virtual void process (SMachines& machines, double duration); 00131 00134 virtual void reset(); 00135 00141 bool isOpFinished(int op) const 00142 { 00143 if ( op < _finishedFlags.size() ) 00144 return _finishedFlags[op]; 00145 else 00146 return false; 00147 } 00148 00152 int getFinishedOper() const { return _finOper; }; 00153 00159 int getCurrOper() const { return _currOper;}; 00164 void setCurrOper(int newOp, const SMachines& mach); 00165 00168 double getRemOpProcTime() const { return _remOpProcTime; }; 00169 00174 virtual SJobMod& getModifier() { return _mod; }; 00175 00176 private: 00177 SShopJobMod _mod; 00178 // the operations which is scheduled next for execution (or which is 00179 // currently executed) 00180 int _currOper; 00181 // number of operations which have already been processed 00182 int _finOper; 00183 // is process called the first time in this simulation: 00184 // if true, then the finishedFlags-array will be set in process() 00185 bool _firstCallOfProcess; 00186 // flags are true if the corresponding operation has been finished 00187 leda_array<bool> _finishedFlags; 00188 // time that the current operation has already been processed. 00189 // it is initialized with the partial proc time stored in the env and 00190 // decreased in advanceOpProcTime() called by process(), 00191 // if _remProcTime reaches the value 0, the current operation is 00192 // finished 00193 double _remOpProcTime; 00194 // advance _remOpProcTime and call SJob::advanceProcTime() 00195 void advanceOpProcTime(double by); 00196 }; 00197 // ----------------------------------------------------------------------- 00198 std::ostream& operator<<(std::ostream& out, SShopJob &job); 00199 // ----------------------------------------------------------------------- 00200 00201 #endif //SSHOPJOB_H 00202 00203