예제 #1
0
    def run(self, timing=False):

        start = time.time()
        self.set_variables()
        self.set_constraints()
        end = time.time() - start
        if timing:
            print("Variables and constraints setting time ", end)

        self.set_objective()

        start = time.time()
        self.m.solve()
        end = time.time() - start
        if timing:
            print("Simplex time ", end)

        self.assign_flights(self.x)

        solution.make_solution(self)

        for flight in self.flights:
            if flight.eta > flight.newSlot.time:
                print(
                    "********************** negative impact *********************************",
                    flight, flight.eta, flight.newSlot.time)
예제 #2
0
 def run(self):
     airline: UDPPairline
     start = time.time()
     for airline in self.airlines:
         with HiddenPrints():
             UDPPlocalOpt(airline, self.slots, self.xp_problem)
     # print(time.time() - start)
     solution.make_solution(self)
예제 #3
0
    def run(self, timing=False):
        print("start")
        feasible = self.check_and_set_matches()
        print("end", len(self.matches))
        if feasible:
            self.set_variables()

            start = time.time()
            self.set_constraints()
            end = time.time() - start
            if timing:
                print("Constraints setting time ", end)

            self.set_objective()

            start = time.time()
            self.m.solve()
            end = time.time() - start
            if timing:
                print("Simplex time ", end)

            # print("status: ", self.m.getProbStatus())
            print("problem status, explained: ", self.m.getProbStatusString())
            xpSolution = self.x
            # print(self.m.getSolution(self.x))
            self.assign_flights(xpSolution)

        else:
            self.assign_flights([flight.slot for flight in self.flights])

        solution.make_solution(self)

        self.offer_solution_maker()

        # for i in self.slots:
        #     if self.x[i, i].x == 0:
        #         for j in self.slots:
        #             if self.x[i, j].x != 0:
        #                 print(i, j)

        for flight in self.flights:
            if flight.eta > flight.newSlot.time:
                print(
                    "********************** danno *********************************",
                    flight, flight.eta, flight.newSlot.time)

        offers = 0
        for i in range(len(self.matches)):
            if self.m.getSolution(self.c[i]) > 0.5:
                # print(self.matches[i])
                offers += 1
        print("offers: ", offers)
예제 #4
0
    def run(self, timing=False):
        feasible = self.check_and_set_matches()
        if feasible:
            self.set_variables()

            # start = time.time()
            self.set_constraints()
            # end = time.time() - start
            # if timing:
            #     print("Constraints setting time ", end)

            self.set_objective()

            start = time.time()
            self.m.solve()
            end = time.time() - start
            # if timing:
            #     print("Simplex time ", end)
            #
            # print("problem status, explained: ", self.m.getProbStatusString())
            xpSolution = self.x
            # print(self.m.getSolution(self.x))
            self.assign_flights(xpSolution)

        else:
            for flight in self.flights:
                flight.newSlot = flight.slot

        solution.make_solution(self)

        self.offer_solution_maker()

        for flight in self.flights:
            if flight.eta > flight.newSlot.time:
                print("********************** danno *********************************",
                      flight, flight.eta, flight.newSlot.time)

        offers = 0
        for i in range(len(self.matches)):
            if self.m.getSolution(self.c[i]) > 0.5:
                self.offers_selected.append(self.matches[i])
                offers += 1