Esempio n. 1
0
    def __init__(self, object_set):
        print(object_set.num_blocks())
        instance_name = 'hbw-num-blocks-%s-num-cyls-%s' % (
            object_set.num_blocks(), object_set.num_cylinders())
        Task.__init__(self, 'Hydraulic-BlocksWorld', instance_name)
        self.objects = object_set

        self.block_position_value_names = [
            on_block(k) for k in xrange(0, self.objects.num_blocks())
        ]
        self.block_position_value_names += [
            'on_piston'
        ]  #on_cylinder_piston(k) for k in xrange(0, self.objects.num_cylinders()) ]
        self.block_position_value_names += ['hand']
        self.block_position_values = {
            name: k
            for k, name in enumerate(self.block_position_value_names)
        }

        self.block_container_value_names = [
            in_cylinder(k) for k in xrange(0, self.objects.num_cylinders())
        ] + ['none']
        self.block_container_values = {
            name: k
            for k, name in enumerate(self.block_container_value_names)
        }

        self.create_vars(self.objects.num_blocks(),
                         self.objects.num_cylinders())
Esempio n. 2
0
	def __init__( self, counters, max_value ) :
		Task.__init__( self, 'Counters', 'Num-Counters-{0}-Max-Value-{1}'.format( len(counters), max_value ) )
		self.counters = counters
		self.max_value = int(max_value)
		self.counter_values = []
		self.create_vars()
		self.create_actions()
Esempio n. 3
0
 def __init__(self, object_set):
     print(object_set.num_blocks())
     instance_name = 'hbw-num-blocks-%s-num-cyls-%s' % (
         object_set.num_blocks(), object_set.num_cylinders())
     Task.__init__(self, 'Hydraulic-BlocksWorld', instance_name)
     self.objects = object_set
     self.create_vars(self.objects.num_blocks(),
                      self.objects.num_cylinders())
Esempio n. 4
0
 def __init__(self, counters, max_value):
     Task.__init__(
         self, 'Counters',
         'Num-Counters-{0}-Max-Value-{1}'.format(len(counters), max_value))
     self.counters = counters
     self.max_value = int(max_value)
     self.counter_values = {
         c: {k: None
             for k in xrange(0, self.max_value)}
         for c in self.counters
     }
     self.create_vars()
     self.create_actions()
Esempio n. 5
0
 def __init__(self, network, sdac=None):
     Task.__init__(self, 'SGT_PSR_UG', 'SGT_PSR_UG_NETWORK')
     self.network = network
     self.network.find_total_load()
     self.plan_end_var = None
     self.create_vars()
     self.conditional_costs = []
     self.sdac_type = sdac
     if sdac == "Valuation":
         self.create_conditional_costs()
     elif sdac == "Objective":
         self.objective_function = "PSRObjective"
     self.create_actions()
Esempio n. 6
0
 def __init__(self, network, sdac=None):
     Task.__init__(self, 'SGT_PSR', 'SGT_PSR_NETWORK')
     self.network = network
     self.network.find_total_load()
     print("Total load:", self.network.total_load)
     self.create_vars()
     self.objective_function = None
     self.conditional_costs = []
     if sdac == "Valuation":
         self.create_conditional_costs()
     elif sdac == "Objective":
         self.objective_function = "PSRObjective"
     self.create_actions()
Esempio n. 7
0
 def __init__(self, name, dm, locations, demand, vehicles):
     instance_name = name
     Task.__init__(self, 'Linehaul', instance_name)
     # list of location names, depot is locations[0]:
     self.locations = locations
     self.distance_matrix = dm
     # demand[l] = (qc, qa) means the total demand for
     # chilled (ambient) goods at location l is qc (qa).
     self.demand = demand
     # vehicles: list of tuples (type, pkc, cap, chilled),
     # where: pkc = per-kilometer cost, cap = capactiy,
     # chilled = True/False
     self.vehicles = []
     self.vehicle_type = dict()
     for (vtype, count, pkc, cap, chilled) in vehicles:
         for i in range(count):
             vname = "{0}{1}".format(vtype, i)
             self.vehicles.append((vname, pkc, cap, chilled))
             self.vehicle_type[vname] = vtype
     self.create_vars()
     self.create_actions()
Esempio n. 8
0
 def __init__(self, power_network):
     Task.__init__(self, 'Two-End Line PSR', power_network.name)
     self.network = power_network
     self.create_vars()
     self.create_actions()
Esempio n. 9
0
 def __init__(self, network):
     Task.__init__(self, 'SGT_PSR', 'SGT_PSR_NETWORK')
     self.network = network
     self.create_vars()
     self.create_actions()