00001 /* #start# *********************************************************** 00002 00003 Scheduling Simulator 00004 Lehrstuhl f"ur Effiziente Algorithmen 00005 Technische Universit"at M"unchen 00006 00007 File : $Id: STopology.h,v 1.5 2003/01/24 10:05:04 hall Exp $ 00008 00009 Purpose : jobs and machines have a topology which handles the 00010 embedding of jobs in machines. a topology can for example 00011 be a mesh. machines in a classical scheduling problem are 00012 just sets of points and each job is a single point. 00013 topologies can be asked if a certain embedding is possible 00014 and they can also administrate the embedding. 00015 00016 * #end# ************************************************************* */ 00017 00018 #ifndef STOPOLOGY_H 00019 #define STOPOLOGY_H 00020 00021 // system header files 00022 #include <LEDA/list.h> 00023 00024 // project header files 00025 #include "../../general/STypeInfo.h" 00026 #include "../../general/SObservable.h" 00027 #include "STopologyMod.h" 00028 #include "SComplexPosition.h" 00029 00041 class STopology : public STypeInfo, public SObservable { 00042 NOCOPY(STopology); 00043 public: 00046 STopology() {} 00049 virtual ~STopology() {} 00050 00053 virtual STopologyMod& getModifier() = 0; 00054 00059 virtual int getCount() const = 0; 00060 00061 // the following functions are only needed for the embedding done in the 00062 // machines 00063 00068 virtual int getIDAt(int pos) const = 0; 00073 virtual int getPos(int ID) const = 0; 00078 virtual bool isPosFree(int pos) const = 0; 00082 virtual leda_list<int> getFreePos() const; 00088 virtual bool canEmbedAt(const STopology &top, int pos) const = 0; 00094 virtual leda_list<int> canEmbedAt(const STopology &top) const; 00095 00101 virtual void embed(const STopology& top, int pos, int ID) = 0; 00102 virtual void embed(const STopology& top, 00103 const SComplexPosition *pComplexPos, int ID) { 00104 if (pComplexPos != NULL) 00105 embed(top, pComplexPos->getMinPos(), ID); 00106 else 00107 assert(false); 00108 }; 00109 00113 virtual void remove(int ID) = 0; 00118 // Hence, reimplement it or live with it, but don't blame me (TS) 00119 virtual leda_list<int> getEmbeddedIDs() const; 00123 //Hence, reimplement it or live with it, but don't blame me (TS) */ 00124 virtual void clear(); 00125 /* 00126 virtual bool isSmaller(const STopology &top) const 00127 { return !canEmbedAt(top).empty(); }; 00128 */ 00132 virtual bool fitsInto(const STopology *top) const = 0; 00133 }; 00134 00135 #endif //STOPOLOGY_H 00136 00137 00138 00139 00140 00141 00142 00143