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

model/SSampleGen.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: SSampleGen.h,v 1.7 2003/03/21 15:47:05 taeubig Exp $
00008 
00009  Purpose : generator for problem instances
00010 
00011  * #end# ************************************************************* */
00012 
00013 #ifndef SSAMPLEGEN_H
00014 #define SSAMPLEGEN_H
00015 
00016 // system header files
00017 
00018 // project header files
00019 #include "STaskSystem.h"
00020 #include "../probability/SProbabilityDist.h"
00021 
00027 class SSampleGen {
00028   
00029  public:
00032   SSampleGen();
00033 
00036   ~SSampleGen();
00037 
00044   void setMachEnvironment(const leda_string& envClassifier) 
00045     { _machEnvClass = envClassifier; }
00046 
00049   const leda_string& getMachEnvironment() const 
00050     { return _machEnvClass; }
00051 
00055   void setMachNumOfMachines(int numMach)
00056     { _machNum = numMach; }
00057 
00060   int getMachNumOfMachines() const 
00061     { return _machNum; };
00062 
00068   void setMachTopology(const leda_string& topoClassifier, 
00069            int meshW = -1, int meshH = -1) 
00070     { 
00071       _machTopoClass = topoClassifier;
00072       _machMeshTopoW = meshW;
00073       _machMeshTopoH = meshH;
00074     }
00075   
00081   const leda_string& getMachTopology(int& retMeshW, int& retMeshH) const
00082     { retMeshW = _machMeshTopoW; retMeshH = _machMeshTopoH;
00083       return _machTopoClass; }
00084   
00088   void setJobNumOfJobs(int numJobs) 
00089     { _jobsNum = numJobs; }
00090     
00093   int getJobNumOfJobs() const
00094     { return _jobsNum; }
00095 
00099   void setJobNumOfMsgs(int numMsgs) 
00100     { _msgsNum = numMsgs; }
00101     
00104   int getJobNumOfMsgs() const
00105     { return _msgsNum; }
00106 
00109   void setProcTimeDist(SProbabilityDist::Type type, double lower, double upper);
00110 
00114   //void setProcTimeDist(SProbabilityDist *pDist);
00115   
00118   void setRelTimeDist(SProbabilityDist *pDist);
00119 
00122   SProbabilityDist::Type getJobProcTimeDist() const ;
00123 
00128   void setMsgDist(bool zipf);
00129 
00133   void setPrecRelation(const leda_string& precRelation)
00134     { _precRel = precRelation; }
00135 
00138   const leda_string& getPrecRelation() const
00139     { return _precRel; }
00140 
00160   STaskSystem* sample();
00161   
00164   void reset();
00165 
00174   enum ErrorCode { 
00175     NOERROR ,      // no error occured
00176     NUMMACHLOW ,   // number of machines is < 1
00177     UNKNOWNENV ,   // requested unknown environment
00178     MESHSIZELOW ,  // width or height of mesh topology < 1
00179     UNKNOWNTOPO ,  // requested unknown topology
00180     UNKNOWNPREC,   // requested unknown precedence relation
00181     NUMJOBSLOW     // number of jobs is < 1
00182   };
00183   
00188   ErrorCode getError() const
00189     { return _errCode; }
00191   void setRandProcTimes(bool set);
00193   void setRandRelTimes(bool set);
00194   
00195  private:
00196   
00197   STaskSystem *_pTS;
00198   
00199   // parameters for machines
00200   int _machNum;
00201   leda_string _machEnvClass;
00202   leda_string _machTopoClass;
00203   int _machMeshTopoW, _machMeshTopoH;
00204   
00205   // parameter for prec relation
00206   leda_string _precRel;
00207 
00208   // parameters for jobs
00209   int _jobsNum;
00210   int _msgsNum;
00211   bool _randProcTimes;
00212   bool _randRelTimes;
00213 
00214   // parameter for creation of the distribution of job proc/rel time
00215   // and message request prob.
00216   //SProbabilityDist *_pProcTimeDist;
00217   SProbabilityDist::Type _procTimeDistType;
00218   SProbabilityDist *_pRelTimeDist;
00219   bool _zipf;
00222   double _pdistval1;
00223   double _pdistval2;
00224   double _rdistval;
00225 
00226   // error code
00227   ErrorCode _errCode;
00228 
00229   // sample-Methods
00230   bool sampleMachEnv();
00231   bool sampleMachTopo();
00232   bool samplePrec();
00233   bool sampleJobs();
00234   bool genClassification();
00235   
00236 };
00237 
00238 #endif

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