def _process_initialize_ges(self, message): print_with_rank(self.num, "message: " + str(message)) entries = message[1] for details in entries: algo_name = details["algorithm"] entity_name = details["entity_name"] radius = details["radius"] soma_xyz = details["soma_xyz"] new_front = Front(entity_name,algo_name,soma_xyz,radius,\ 0,0) # 0: pathlength, 0: order new_front.soma_pos = soma_xyz # self.fronts.append(new_front) # # 2014-02-19: in principle the "all_contained" can be deleted once # # I include the diameters in all constellations # self.all_contained_entities[entity_name] = [] # self.all_contained_entities[entity_name].append(new_front) # 2014-08-06 if entity_name in self.dynamic_constellation: print "Help! I am overwriting something" time.sleep(10) self.dynamic_constellation[entity_name] = set() self.dynamic_constellation[entity_name].add( new_front) #append((soma_xyz,radius)) self.active_fronts.append(new_front)
def NondominatedSorting(self): f1 = Front() for chromosome in self.chromosomes: if chromosome.is_Rank1(): f1.answers.append(chromosome) self.fronts.append(f1) fi = f1 a = 1 while len(fi.answers) > 0: q = [] for answer in fi.answers: for dominatedPoint in answer.dominatedPoints: dominatedPoint.beingdominatedCount -= 1 if dominatedPoint.beingdominatedCount == 0: dominatedPoint.rank = a + 1 self.chromosomes[ dominatedPoint.populationID].rank = a + 1 q.append(dominatedPoint) fi = Front() for n in range(len(q)): fi.answers.append(q[n]) if fi.answers: self.fronts.append(fi) a += 1
def _process_initialize_ges(self,message): print_with_rank(self.num,"message: " + str(message)) entries = message[1] for details in entries : algo_name = details["algorithm"] entity_name = details["entity_name"] radius = details["radius"] soma_xyz = details["soma_xyz"] new_front = Front(entity_name,algo_name,soma_xyz,radius,\ 0,0) # 0: pathlength, 0: order new_front.soma_pos = soma_xyz # self.fronts.append(new_front) # # 2014-02-19: in principle the "all_contained" can be deleted once # # I include the diameters in all constellations # self.all_contained_entities[entity_name] = [] # self.all_contained_entities[entity_name].append(new_front) # 2014-08-06 if entity_name in self.dynamic_constellation : print "Help! I am overwriting something" time.sleep(10) self.dynamic_constellation[entity_name] = set() self.dynamic_constellation[entity_name].add(new_front)#append((soma_xyz,radius)) self.active_fronts.append(new_front)
def create_front(repoUrl): if repoUrl.startswith("boar://"): front = client.connect(repoUrl) front.isRemote = True else: front = Front(Repo(repoUrl)) front.isRemote = False return front
def _summarize_constellation(self, c): summarized_constellation = {} # 2014-01-19, 2014-08-06 for key in c: temp = [np.mean(c[key], axis=0)] temp2 = [] for t in temp: temp2.append((t, 0)) #print "summary for key=",key,'=>',temp2 sum_front = Front(key, "", temp2[0][0], 0, 0, 0) summarized_constellation[key] = set([sum_front]) #print_with_rank(self.num,"summarized: "+str(summarized_constellation)) return summarized_constellation
def _get_sub_substrate(self, boundary): # get subvolume substrate sub_substrate = {} b0 = np.array(boundary[0]) b1 = np.array(boundary[1]) for entity in self.substrate: print("checking entity: ", entity, ", boundary: ", boundary) # 2014-08-08, make all internals sets of fronts.. bit redundant memory wise, but easy for administration sub_substrate[entity] = set() for ppoint in self.substrate[entity]: point = ppoint[0] t_front = Front(None, None, point, ppoint[1], 0, 0) sub_substrate[entity].add(t_front) #time.sleep(1) if len(sub_substrate[entity]) == 0: sub_substrate.pop(entity, None) return sub_substrate
def connect(repourl): if os.getenv("BOAR_TEST_REMOTE_REPO") == "1": # Force boar to use the remote communication mechanism even for local repos. repourl = localize(repourl) elif os.getenv("BOAR_TEST_REMOTE_REPO") == "2": # Force boar to use the remote communication mechanism over ssh repourl = ssh_localize(repourl) m = re.match(BOAR_URL_PATTERN, repourl) if not m: return Front(user_friendly_open_local_repository(repourl)) transporter = m.group(2) if transporter == None or transporter == "tcp": front = connect_tcp(repourl) elif transporter == "ssh": front = connect_ssh(repourl) elif transporter == "local": front = connect_local(repourl) else: raise UserError("No such transporter: '%s'" % transporter) assert front return front
class Coordinates(): # For doors levels = [0, 4, 7] centers = [-6.25, -4.75, -3.25, -1.75, 0, 1.75, 3.25, 4.75, 6.25] stct = Structure() tops = stct.get_tops() front = Front().get_front() doors_objects = {0: {}, 4: {}, 7: {}} doors = [] left_doors = [] for level in levels: for center in centers: door = Door(level, center) doors_objects[level][center] = door doors.append(door.get_door()) left_doors.append(door.get_left_door()) # tops door lvl, ctr = 10, 0 levels.append(lvl) doors_objects[lvl] = {} door = Door(lvl, ctr) doors_objects[lvl][ctr] = door doors.append(door.get_door()) chairs = [] c_coordsT = [ (-5.5, 0, 9.3), (-4, 0, -15.7), (0, 0, -15.7), (4, 0, -15.7), (-2, 0, -12.7), (2, 0, -12.7), # 0 degrees (-4.7, 0, -15), (-0.7, 0, -15), (3.3, 0, -15), (-2.7, 0, -12), (1.3, 0, -12), (-6.2, 0, -1), # 90 degrees (-3.3, 0, -15), (0.7, 0, -15), (4.7, 0, -15), (-1.3, 0, -12), (2.7, 0, -12), # -90 degrees (-4, 0, -14.3), (0, 0, -14.3), (4, 0, -14.3), (-2, 0, -11.3), (2, 0, -11.3) ] # 180 degrees c_coords = [(0, 0, 0)] * 22 for cc in c_coords: chair = Chair(cc).get_chair() chairs.append(chair) chairs2 = [] c2_coordsT = [(5.5, 0, 6), (-5.5, 0, -6), (-5, 0, -6), (-4, 0, -6), (-3.5, 0, -6), (-2.5, 0, -6), (-2, 0, -6), (1.5, 0, -6), (2.5, 0, -6), (3.5, 0, -6), (4.5, 0, -6), (5.5, 0, -6)] c2_coords = [(0, 0, 0)] * 12 for cc2 in c2_coords: chair = Chair2(cc2).get_chair() chairs2.append(chair) tables = [] ct_coordsT = [(-5.5, 0, 10), (-4, 0, -15), (0, 0, -15), (4, 0, -15), (-2, 0, -12), (2, 0, -12), (-5.5, 0, -1)] ct_coords = [(0, 0, 0)] * 7 for ct in ct_coords: table = Table(ct).get_table() tables.append(table) bookcases = [] cbc_coordsT = [(3.5, 0, 3), (3.5, 4, 3), (-6.6, 0, -6.5), (-6.6, 0, -9.5), (-6.6, 0, -12.5), (-6.6, 0, -15.5), (6.6, 0, -6.5), (6.6, 0, 15.5), (6.6, 0, 12.5), (6.6, 0, 9.5), (6.6, 0, 6.5), (6.6, 0, -9.5), (6.6, 0, -12.5), (-6.5, 0, 6.5), (-6.5, 0, 3.7), (-6.5, 0, 1.3), (6.6, 0, -15.5), (-6.6, 0, 14), (-1.5, 0, -19), (1.5, 0, -19)] cbc_coords = [(0, 0, 0)] * 20 for cbc in cbc_coords: bookcase = Bookcase(cbc).get_bookcase() bookcases.append(bookcase) bookcases2 = [] cbc2_coordsT = [(3.5, 0, 1), (3.5, 4, 1), (-5.5, 0, -19), (6.5, 0, -19), (-3.5, 0, -19), (4.5, 0, -19), (-4.2, 0, 1)] cbc2_coords = [(0, 0, 0)] * 7 for cbc2 in cbc2_coords: bookcase2 = Bookcase2(cbc2).get_bookcase() bookcases2.append(bookcase2) walls = [] cw_coords = [(0, 0, 0)] for cw in cw_coords: wall = Wall(cw).get_wall() walls.append(wall) floors = [] cf_coords = [(0, 0, 0)] for cf in cf_coords: floor = Floor(cf).get_floor() floors.append(floor)