def __init__(self, fleet, environment, global_planner=None, options=None, **kwargs): Problem.__init__(self, fleet, environment, options, label='schedulerproblem') self.curr_state = self.vehicles[0].prediction['state'] # initial vehicle position self.goal_state = self.vehicles[0].poseT # overall goal self.problem_options = options # e.g. selection of problem type (freeT, fixedT) if not 'freeT' in options: # select default type self.problem_options['freeT'] = True self.start_time = 0. self.update_times=[] # save vehicle dimension, determines how close waypoints can be to the border shape = self.vehicles[0].shapes[0] if isinstance(shape, Circle): self.veh_size = shape.radius # used to check if vehicle fits completely in a cell # radius is only half the vehicle size size_to_check = self.veh_size*2 elif isinstance(shape, Rectangle): self.veh_size = max(shape.width, shape.height) # veh_size is complete width or height for rectangular shape size_to_check = self.veh_size # margin, applied to vehicle size to avoid goal positions very close to the border self.margin = 1.1 # assign global planner if global_planner is not None: # save the provided planner self.global_planner = global_planner else: # make a default global planner self.global_planner = AStarPlanner(environment, [20, 20], self.curr_state, self.goal_state) # frame settings self.frames = [] self.cnt = 1 # frame counter self.n_frames = options['n_frames'] if 'n_frames' in options else 1 # amount of frames to combine if (self.n_frames > 1 and not self.problem_options['freeT']): raise ValueError('Fixed time problems are only supported for n_frames = 1') self._n_frames = self.n_frames # save original value self.frame_type = options['frame_type'] if 'frame_type' in options else 'shift' # set frame size for frame_type shift if self.frame_type is 'shift': # by default frame size is set to 1/5 of total environment width self.frame_size = options['frame_size'] if 'frame_size' in options else environment.room[0]['shape'].width*0.2 # by default move limit is set to 1/4 of frame size self.move_limit = options['move_limit'] if 'move_limit' in options else self.frame_size*0.25 if self.frame_type is 'corridor': # scale up frame with small steps or not self.scale_up_fine = options['scale_up_fine'] if 'scale_up_fine' in options else True self.l_shape = options['l_shape'] if 'l_shape' in options else False # check if vehicle size is larger than the cell size n_cells = self.global_planner.grid.n_cells if (size_to_check >= (min(environment.room[0]['shape'].width/float(n_cells[0]), \ environment.room[0]['shape'].height/float(n_cells[1]))) and self.frame_type == 'corridor'): warnings.warn('Vehicle is bigger than one cell, this may cause problems' + ' when switching frames. Consider reducing the amount of cells or reducing' + ' the size of the vehicle')
def __init__(self, capacity, search_space, fitness_function, minimization=False): Problem.__init__(self, search_space, fitness_function, minimization) self.capacity = capacity
def __init__(self, tower_size=3, pruning=False): self.tower_size = tower_size Problem.__init__(self, [list(range(self.tower_size, 0, -1)), [], []]) self.pruning = pruning self.other_pegs = [[1, 2], [0, 2], [ 0, 1 ]] #list of pegs a disk in a peg of given index can be moved in
def __init__(self, fleet, environment, n_frames, options=None): Problem.__init__(self, fleet, environment, options, label='multiframeproblem') self.n_frames = n_frames if self.n_frames > len(self.environment.room): raise RuntimeError('Number of frames you want to consider at once is larger' + 'than the amount of rooms provided in environment') self.init_time = None self.start_time = 0. self.objective = 0.
def __init__(self, index, vehicle, problem, environment, distr_problem, options={}): Problem.__init__(self, vehicle, environment, options, label='admm') self.problem = problem self.distr_problem = distr_problem self.vehicle = vehicle self.environment = environment self.group = {child.label: child for child in ([ vehicle, problem, environment, self] + environment.obstacles)} for child in self.group.values(): child._index = index
def __init__(self, index, vehicle, problem, environment, distr_problem, label, options=None): Problem.__init__(self, vehicle, environment, options, label=label) self.problem = problem self.distr_problem = distr_problem self.vehicle = vehicle self.environment = environment self.group = col.OrderedDict() for child in ([vehicle, problem, environment, self] + environment.obstacles): self.group[child.label] = child for child in self.group.values(): child._index = index
def __init__(self, size, pruning=False, neighbor_selection="swap", objective_fn="all", start_fn="permute", start_state=None): Problem.__init__(self, []) self.size = size self.pruning = pruning self.neighbor_selection = neighbor_selection self.objective_fn = objective_fn self.start_fn = start_fn self.start_state = start_state self.initialize_neighbor_selection_dict() self.initialize_objective_fn_dict()
def __init__(self, fleet, environment, n_segments, options=None, **kwargs): Problem.__init__(self, fleet, environment, options, label='gcodeproblem') self.n_segments = n_segments # amount of GCode commands to connect if self.n_segments > len(self.environment.room): raise RuntimeError('Number of segments to combine is larger than the amount of ' + 'GCode segments/rooms provided') self.init_time = None self.start_time = 0. self.objective = 0. # an initial guess for the motion time may be passed by the scheduler during problem creation if 'motion_time_guess' in kwargs: self.motion_time_guess = kwargs['motion_time_guess']
def __init__(self, fleet, environment, n_frames, options=None): Problem.__init__(self, fleet, environment, options, label='multiframeproblem') self.n_frames = n_frames if self.n_frames > len(self.environment.room): raise RuntimeError( 'Number of frames you want to consider at once is larger' + 'than the amount of rooms provided in environment') self.init_time = None self.start_time = 0. self.objective = 0.
def __init__(self, fleet, environment, n_segments, options=None, **kwargs): Problem.__init__(self, fleet, environment, options, label='gcodeproblem') self.n_segments = n_segments # amount of GCode commands to connect if self.n_segments > len(self.environment.room): raise RuntimeError( 'Number of segments to combine is larger than the amount of ' + 'GCode segments/rooms provided') self.init_time = None self.start_time = 0. self.objective = 0. # an initial guess for the motion time may be passed by the scheduler during problem creation if 'motion_time_guess' in kwargs: self.motion_time_guess = kwargs['motion_time_guess']
def __init__(self, job_times, people_count=3, start_state=None, neighbor_selection="find_neighbor", objective_fn="max_time", start_fn="random"): Problem.__init__(self, []) self.job_count = len(job_times) self.job_times = job_times self.people_count = people_count self.start_state = start_state self.start_fn = start_fn # Keeping these in case you want to experiment with objective fn and neighbors self.neighbor_selection = neighbor_selection self.objective_fn = objective_fn self.initialize_neighbor_selection_dict() self.initialize_objective_fn_dict()
def __init__(self): Problem.__init__(self) Product.__init__(self) Client.__init__(self) RProblem.__init__(self) Techn.__init__(self) self.Scheduling = Scheduling() Scheduling.__init__(self) QMainWindow.__init__(self) Ui_LoginWindow.__init__(self) self.setupUi(self) self.setFixedSize(670, 570) # sizeofwindow # *****************************add image**************** oImage = QImage("6719.jpg") sImage = oImage.scaled(QSize(700, 600)) # resize Image to widgets size palette = QPalette() palette.setBrush(QPalette.Window, QBrush(sImage)) self.setPalette(palette) self.btn_login.setStyleSheet("background: transparent;") self.label.setStyleSheet("color: white;") self.btn_login.clicked.connect(self.redirectTo)
def __init__(self, fleet, environment, problems, updater_type, options): self.problems = problems self.updater_type = updater_type Problem.__init__(self, fleet, environment, options)
def __init__(self): '''constructor''' Problem.__init__(self) self.connection = None
def __init__(self, fleet, environment, options): Problem.__init__(self, fleet, environment, options, label='p2p') self.init_time = None self.start_time = 0.
def __init__(self, search_space, fitness_function, minimization=True): Problem.__init__(self, search_space, fitness_function, minimization)
def __init__(self, size, pruning=False): Problem.__init__(self, []) self.size = size self.pruning = pruning
def __init__(self): '''constructor''' Problem.__init__(self)
def __init__(self, fleet, environment, global_planner=None, options=None, **kwargs): Problem.__init__(self, fleet, environment, options, label='schedulerproblem') self.curr_state = self.vehicles[0].prediction[ 'state'] # initial vehicle position self.goal_state = self.vehicles[0].poseT # overall goal self.problem_options = options # e.g. selection of problem type (freeT, fixedT) if not 'freeT' in options: # select default type self.problem_options['freeT'] = True self.start_time = 0. self.update_times = [] # save vehicle dimension, determines how close waypoints can be to the border shape = self.vehicles[0].shapes[0] if isinstance(shape, Circle): self.veh_size = shape.radius # used to check if vehicle fits completely in a cell # radius is only half the vehicle size size_to_check = self.veh_size * 2 elif isinstance(shape, Rectangle): self.veh_size = max(shape.width, shape.height) # veh_size is complete width or height for rectangular shape size_to_check = self.veh_size # margin, applied to vehicle size to avoid goal positions very close to the border self.margin = 1.1 # assign global planner if global_planner is not None: # save the provided planner self.global_planner = global_planner else: # make a default global planner self.global_planner = AStarPlanner(environment, [20, 20], self.curr_state, self.goal_state) # frame settings self.frames = [] self.cnt = 1 # frame counter self.n_frames = options[ 'n_frames'] if 'n_frames' in options else 1 # amount of frames to combine if (self.n_frames > 1 and not self.problem_options['freeT']): raise ValueError( 'Fixed time problems are only supported for n_frames = 1') self._n_frames = self.n_frames # save original value self.frame_type = options[ 'frame_type'] if 'frame_type' in options else 'shift' # set frame size for frame_type shift if self.frame_type is 'shift': # by default frame size is set to 1/5 of total environment width self.frame_size = options[ 'frame_size'] if 'frame_size' in options else environment.room[ 0]['shape'].width * 0.2 # by default move limit is set to 1/4 of frame size self.move_limit = options[ 'move_limit'] if 'move_limit' in options else self.frame_size * 0.25 if self.frame_type is 'corridor': # scale up frame with small steps or not self.scale_up_fine = options[ 'scale_up_fine'] if 'scale_up_fine' in options else True self.l_shape = options['l_shape'] if 'l_shape' in options else False # check if vehicle size is larger than the cell size n_cells = self.global_planner.grid.n_cells if (size_to_check >= (min(environment.room[0]['shape'].width/float(n_cells[0]), \ environment.room[0]['shape'].height/float(n_cells[1]))) and self.frame_type == 'corridor'): warnings.warn( 'Vehicle is bigger than one cell, this may cause problems' + ' when switching frames. Consider reducing the amount of cells or reducing' + ' the size of the vehicle')
def __init__(self, problems, updater_type, options): self.problems = problems self.updater_type = updater_type vehicles = [p.vehicles[0] for p in problems] Problem.__init__(self, vehicles, problems[0].environment, options)
def __init__(self, fleet, environment, options={}): Problem.__init__(self, fleet, environment, options, label='p2p') for vehicle in self.vehicles: splines = vehicle.define_splines(n_seg=1)[0] vehicle.define_trajectory_constraints(splines) environment.define_collision_constraints(vehicle, splines)