Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

model/STaskSystem.h

Go to the documentation of this file.
00001 /* #start# ***********************************************************
00002 
00003            Scheduling Simulator
00004         Lehrstuhl f"ur Effiziente Algorithmen
00005            Technische Universit"at M"unchen
00006 
00007  File    : $Id: STaskSystem.h,v 1.10 2003/04/12 11:34:55 meierb Exp $
00008 
00009  Purpose : 
00010 
00011  RCS-Log:
00012  $Log: STaskSystem.h,v $
00013  Revision 1.10  2003/04/12 11:34:55  meierb
00014  some comments added
00015 
00016  Revision 1.9  2003/03/21 15:47:05  taeubig
00017  merge with source from Bertolt
00018 
00019  Revision 1.8  2003/01/24 10:04:56  hall
00020  brdCast stuff
00021 
00022  Revision 1.7  2003/01/08 18:57:12  meierb
00023  added randomized release times
00024 
00025  Revision 1.7  2003/01/08 18:38:34  meierb
00026  einchecken!!!
00027 
00028  Revision 1.6  2003/01/08 15:29:21  meierb
00029  schlcht gelaufen mit der Pruefung
00030 
00031  Revision 1.5  2003/01/06 22:27:47  meierb
00032  blablabla
00033 
00034  Revision 1.4  2002/12/16 23:32:09  meierb
00035  *** empty log message ***
00036 
00037  Revision 1.3  2002/12/11 22:27:03  meierb
00038  *** empty log message ***
00039 
00040  Revision 1.2  2002/12/03 17:05:22  meierb
00041  little changes for new files
00042 
00043  Revision 1.1.1.1  2002/12/02 22:26:19  meierb
00044  my_schedule
00045 
00046  Revision 1.3  2002/11/11 16:52:52  taeubig
00047  header include changes
00048 
00049  Revision 1.2  2002/11/09 17:33:16  taeubig
00050  <iostream> inclusion, added std::
00051 
00052  Revision 1.1  2002/08/29 12:59:58  taeubig
00053  Added the sources
00054 
00055  Revision 1.27  2000/07/11 01:44:24  taeubig
00056  Added getRejectedJobs()
00057 
00058  Revision 1.26  2000/06/15 00:42:51  taeubig
00059  Implemented getReadyJobs()  (released and
00060  available w.r.t. the precedence relation)
00061 
00062  Revision 1.25  2000/05/29 19:54:23  taeubig
00063  New subdirectory structure
00064 
00065  Revision 1.24  2000/05/24 12:46:28  taeubig
00066  New compiler (gcc-2.95) and new Qt (2.1)
00067  Replaced "list" by "leda_list" etc.
00068 
00069  Revision 1.23  2000/05/16 13:17:38  taeubig
00070  Added const declaration in setClassification()
00071 
00072  Revision 1.22  2000/04/12 20:48:10  mayerh
00073  added method setClassification()
00074 
00075  Revision 1.21  2000/01/29 19:27:17  zoidl
00076  Together likes to corrupt header files :-(
00077 
00078  Revision 1.20  2000/01/29 18:52:40  zoidl
00079  sim-step-logger diagram
00080 
00081  Revision 1.19  2000/01/17 17:38:12  zoidl
00082  added javadoc comments
00083 
00084  Revision 1.18  1999/12/02 14:45:29  hall
00085  the order of the jobs is now given by there index
00086 
00087  Revision 1.17  1999/12/02 08:06:12  schickin
00088  SEvent-Hierarchie modified (STSysEvent is dead now)
00089 
00090  Revision 1.16  1999/11/19 16:11:03  hall
00091  changed SObserver::update( SEvent & ) to ...( const SEvent & )
00092 
00093  Revision 1.15  1999/08/05 13:03:02  schickin
00094  redesign: event list for algorithm is generated by logger now
00095 
00096  Revision 1.14  1999/06/17 16:34:53  hall
00097  STopology changed, tuned STSysSchedEvent-stuff and lost more!
00098 
00099  Revision 1.13  1999/05/04  12:11:06  schickin
00100  small bugs removed (which came from the redesign of the diagrams)
00101  
00102  Revision 1.12  1999/04/28 14:47:54  schickin
00103  All diagrams reformatted
00104 
00105  Revision 1.11  1999/04/27 13:39:45  schickin
00106  well folks, that's the first demo version that really runs 8-)
00107 
00108  Revision 1.10  1999/04/08 07:30:40  schickin
00109  missing semicolon inserted (necessary for Michael and Rainer)
00110 
00111  Revision 1.9  1999/03/30 12:13:58  schickin
00112  dynamic_cast added, constructors for task system classes added
00113 
00114  Revision 1.8  1999/03/29 12:49:01  schickin
00115  design of modifiers changed (SFooMod is now a member of SFoo). the stuff
00116  compiles and a simple test program runs fine.
00117 
00118  Revision 1.7  1999/03/25 14:13:00  schickin
00119  several changes in /model (no real executable yet)
00120 
00121  Revision 1.6  1999/03/23 14:26:59  schickin
00122  a lot of new code in /model: things compile but have no functionality
00123 
00124  Revision 1.5  1999/02/10 15:05:53  schickin
00125  model-directory can be compiled now
00126 
00127  Revision 1.4  1999/02/10 10:50:47  schickin
00128  main loop for simulation added
00129 
00130  Revision 1.3  1999/01/29 10:04:00  schickin
00131  Project-Headers added.
00132 
00133 
00134  * #end# ************************************************************* */
00135 
00136 #ifndef STASKSYSTEM_H
00137 #define STASKSYSTEM_H
00138 
00139 // system header files
00140 #include <iostream>
00141 
00142 #include <LEDA/array.h>
00143 
00144 // project header files
00145 #include "SPrecBroker.h"
00146 #include "STaskSystemMod.h"
00147 #include "SJobArray.h"
00148 #include "jobs/SJob.h"
00149 #include "env/SEnvironment.h"
00150 #include "../general/ledaPtrSet.h"
00151 #include "../general/SObservable.h"
00152 #include "../general/SObserver.h"
00153 #include "../algorithms/SClassification.h"
00154 #include "../algorithms/SSchedAlgorithm.h"
00155 #include "../logging/SSchedActionList.h"
00156 
00157 class SSchedAlgorithm;
00158 class SMachines;
00159 class SPassiveMachines;
00160 
00170 class STaskSystem : public SObserver, public SObservable {
00171   friend class STaskSystemMod;
00172   NOCOPY(STaskSystem);
00174   /*#  SSchedActionList lnkUnnamed*/
00175 
00176  public:
00179   STaskSystem();
00182   virtual ~STaskSystem();
00183 
00186   const SClassification& getClassification() const { return _classif; };
00187 
00192   double getTime() const { return _simTime; };
00193   
00196   void setAlgorithm(SSchedAlgorithm& alg);
00197  
00200   const SSchedAlgorithm &getAlgorithm() const { return *_pAlg; };
00201 
00202   // Set classification
00203   void setClassification(const SClassification& classif);
00207   bool doSimStep();
00208   
00211   void reset();
00212 
00215   void run() { reset(); while(!doSimStep()); };
00216 
00220   const SJobArray& getAllJobs() const { return _jobs; };
00221 
00225   SJobArray& getAllJobs() { return _jobs; };
00226 
00229   int numJobs() const
00230     { return getAllJobs().size(); };
00231 
00234   leda_set<SJob*> getHiddenJobs() const
00235     { return getJobsInState(SJob::HIDDEN); };
00238   leda_set<SJob*> getReleasedJobs() const
00239     { return getJobsInState(SJob::RELEASED); };
00242   leda_set<SJob*> getFinishedJobs() const
00243     { return getJobsInState(SJob::FINISHED); };
00246   leda_set<SJob*> getRunningJobs() const
00247     { return getJobsInState(SJob::RUNNING); };
00250   leda_set<SJob*> getRejectedJobs() const
00251     { return getJobsInState(SJob::REJECTED); };
00252 
00256   leda_set<SJob*> getAvailableJobs() const;
00257 
00260   leda_set<SJob*> getReadyJobs() const; 
00261 
00267   SJob& getJob(int idx) { return *(_jobs[idx]); };
00268 
00274   const SJob& getJob(int idx) const { return *(_jobs[idx]); };
00275   
00278   const SPrecRelation& getPrecRelation() const
00279     { return _precBroker.getMaster(); };
00280 
00283   SPrecRelation& getPrecRelation()
00284     { return _precBroker.getMaster(); };
00285 
00288   SPrecBroker& getPrecBroker()
00289     { return _precBroker; };
00290   
00293   virtual STaskSystemMod& getModifier() { return _mod; };
00294 
00297   const leda_array<SPassiveMachines*>& getPassiveMachines() const
00298     { return _passMachines; }
00299   
00302   leda_array<SPassiveMachines*>& getPassiveMachines()
00303     { return _passMachines; }
00304 
00307   const SMachines& getMachines() const { return *_machines; }
00308   
00311   SMachines& getMachines() { return *_machines; }
00312 
00316   virtual void update(const SEvent& event);
00317   
00319   bool getRandProcTimes();
00320   
00322   void setRelTimeDist(SProbabilityDist* dist);
00323   
00325   SProbabilityDist* getRelTimeDist();
00326 
00327 private:
00329   /*#  SSchedActionList lnkUnnamed*/
00330   leda_set<SJob*> getJobsInState(SJob::State stat) const;
00331 
00332   SClassification _classif;
00334   double _simTime;
00340   leda_array<SPassiveMachines*> _passMachines;
00342   SPrecBroker _precBroker;
00347   SJobArray _jobs;
00348   SSchedAlgorithm* _pAlg;
00351   double _alarmTime;
00352   STaskSystemMod _mod;
00354   SMachines* _machines;
00356   SProbabilityDist::Type _procTimeDist;
00361   SProbabilityDist *_relTimeDist;
00363   bool _randomProcTimes;
00364   bool _randomRelTimes;
00365 };
00366 
00367 inline std::ostream& operator<<(std::ostream& rOs, const STaskSystem& rTS)
00368 {
00369   ((STaskSystem&)rTS).getModifier().save(rOs);
00370   return rOs;
00371 }
00372 
00373 #endif //STASKSYSTEM_H

Generated on Thu May 22 16:48:09 2003 for Sketch-it! by doxygen1.2.18