Ejemplo n.º 1
0
    def outtestfindExpectedDesign(self):
        """Perform the actual search for a design"""
        # Generate all the design candidates
        # Instantiate cost model
        cmConfig = {
            'weight_network': 4,
            'weight_disk':    1,
            'weight_skew':    1,
            'nodes':          10,
            'max_memory':     1024,
            'skew_intervals': 10,
            'address_size':   64,
            'window_size':    500
        }
        cm = CostModel(self.collections, self.workload, cmConfig)

        initialDesign = InitialDesigner(self.collections, self.workload, None).generate()
        upper_bound = cm.overallCost(initialDesign)
        print "init solution: ", initialDesign
        print "init solution cost: ", upper_bound
        collectionNames = [c for c in self.collections]
        
        dc = self.dc.getCandidates(collectionNames)
        print "candidates: ", dc
        ln = LNSDesigner(self.collections, \
                        self.dc, \
                        self.workload, \
                        None, \
                        cm, \
                        initialDesign, \
                        upper_bound, \
                        LNS_RUN_TIME)
        solution = ln.solve()
        print "Best cost: ", ln.bestCost
        print "solution: ", solution
Ejemplo n.º 2
0
    def search(self, initialCost, initialDesign, worker_id):
        """
            Main search process starts here
        """
        lock = thread.allocate_lock()
        self.search_method = LNSDesigner(self.collections, self.designCandidates, self.workload, self.config, self.cm, initialDesign, initialCost, self.channel, lock, worker_id)
        self.search_method.start()
    ## DEF

## CLASS