本文整理汇总了Python中solver.Solver.set_data方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.set_data方法的具体用法?Python Solver.set_data怎么用?Python Solver.set_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solver.Solver
的用法示例。
在下文中一共展示了Solver.set_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import set_data [as 别名]
class MainWindow(QWidget):
"""
Main window class for capraz_sevkiyat project
"""
def __init__(self):
QWidget.__init__(self)
self.model = None
self.setWindowTitle("Cross Docking Project")
self.setGeometry(400, 400, 400, 400)
self.set_buttons()
self.set_layout()
self.truck_image_list = {}
self.truckDataWindow = None
self.data = DataStore()
self.model = None
self.current_iteration = 1
self.iteration_limit = 100
self.current_data_set = 0
self.algorithms = None
self.solution_choice = None
self.scn = QGraphicsScene()
self.simulation = GraphView(self.scn)
def set_buttons(self):
self.new_data_set_button = QPushButton('New Data Set')
self.load_data_set_button = QPushButton('Load Data Set')
self.save_data_set_button = QPushButton('Save Data Set')
self.truck_data_button = QPushButton('Truck Data')
self.system_data_button = QPushButton('System Data')
self.algorithm_data_button = QPushButton('Algorithm Data')
self.generate_data_set_button = QPushButton('Generate Data Set')
self.show_data_button = QPushButton('Show Data Set')
self.print_gams_button = QPushButton('Print gams output')
self.data_set_ready_button = QPushButton('Data Set Ready')
self.solve_step_button = QPushButton('Solve Next Step')
self.solve_iteration_button = QPushButton('Solve Next Iteration')
self.solve_next_data_set_button = QPushButton('Solve Next Data Set')
self.show_logger_button = QPushButton('Show Logger')
self.show_simulation_button = QPushButton('Show Simulation')
self.show_data_table = QPushButton('Show Run Time Data Table')
self.data_set_number = QSpinBox()
self.data_set_number.setMinimum(0)
self.new_data_set_button.clicked.connect(self.new_data_set)
self.load_data_set_button.clicked.connect(self.load_data)
self.save_data_set_button.clicked.connect(self.save_data)
self.truck_data_button.clicked.connect(self.show_truck_data)
self.system_data_button.clicked.connect(self.show_system_data)
self.algorithm_data_button.clicked.connect(self.show_algorithm_data)
self.generate_data_set_button.clicked.connect(self.generate_data_set)
self.show_data_button.clicked.connect(self.show_data)
self.print_gams_button.clicked.connect(self.print_gams)
self.data_set_ready_button.clicked.connect(self.data_set_ready)
self.show_logger_button.clicked.connect(self.show_logger)
self.show_data_table.clicked.connect(self.show_runtime_table)
self.solve_next_data_set_button.clicked.connect(self.data_set_button)
self.solve_iteration_button.clicked.connect(self.iteration_button)
self.solve_step_button.clicked.connect(self.step_button)
self.data_set_number.valueChanged.connect(self.set_data_set_number)
def set_layout(self):
self.data_set_layout = QGridLayout()
self.data_set_layout.addWidget(self.new_data_set_button, 1 ,1)
self.data_set_layout.addWidget(self.load_data_set_button, 1 ,2)
self.data_set_layout.addWidget(self.save_data_set_button, 1 ,3)
self.data_set_layout.addWidget(self.truck_data_button, 2 ,1)
self.data_set_layout.addWidget(self.system_data_button, 2 ,2)
self.data_set_layout.addWidget(self.algorithm_data_button, 2 ,3)
self.data_set_layout.addWidget(self.generate_data_set_button, 3, 1)
self.data_set_layout.addWidget(self.show_data_button, 3, 2)
self.data_set_layout.addWidget(self.print_gams_button, 3, 3)
self.data_set_layout.addWidget(self.data_set_ready_button, 4, 1)
self.solver_layout = QGridLayout()
self.solver_layout.addWidget(self.solve_step_button, 1, 1)
self.solver_layout.addWidget(self.solve_iteration_button, 1, 2)
self.solver_layout.addWidget(self.solve_next_data_set_button, 1, 3)
self.solver_layout.addWidget(self.data_set_number, 1, 4)
#.........这里部分代码省略.........
示例2: GeneralInfo
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import set_data [as 别名]
#.........这里部分代码省略.........
# self.layout.addWidget(self.simulation, 1, 2)
self.setLayout(self.layout)
self.model = None
self.data = DataStore()
self.current_iteration = 1
self.iteration_limit = 100
self.current_data_set = 0
self.data_string = ''
self.algorithms = Algorithms()
self.algo_screen = ChooseAlgo()
self.trial_time = 0
def init_solution(self, data=DataStore()):
"""
Starts solution for a data set
:param data: data store
:return:
"""
self.play_button.setDisabled(False)
self.stop_button.setDisabled(False)
self.pause_button.setDisabled(False)
self.solution_type_combo.setDisabled(False)
self.data = data
self.model = Solver(self.data)
self.simulation.init_image(self.model)
self.print_start_data()
numbers = {'inbound': self.data.number_of_inbound_trucks, 'outbound': self.data.number_of_outbound_trucks,
'compound': self.data.number_of_compound_trucks, 'receive': self.data.number_of_receiving_doors,
'shipping': self.data.number_of_shipping_doors}
self.algorithms.set_algorithms(self.model)
self.model.set_data(0)
def solution_type_choice(self):
"""
update bools for the choosen solution type
:return:
"""
choice = self.solution_type_combo.currentText()
if choice == 'solve':
self.solve_bool = True
self.data_set_bool = False
self.iteration_bool = False
self.step_bool = False
elif choice == 'data_set':
self.solve_bool = True
self.data_set_bool = True
self.iteration_bool = False
self.step_bool = False
elif choice == 'iteration':
self.solve_bool = True
self.data_set_bool = True
self.iteration_bool = True
self.step_bool = False
elif choice == 'step':
self.solve_bool = True
self.data_set_bool = True
self.iteration_bool = True
self.step_bool = True
def choose_algorithm(self):