Пример #1
0
	def generate_variables(self):
		routes = [1,2,3]
		n_buses = 50
		# demand = [[[9,9]], [[10,10]], [[24,25]]]
		demand = [[[591,662,708,542,823,871,836,681]], [[666,687,682,376,202,172,161,131]], [[1583,1741,1864,1577,1983,1866,1609,1422], [22,16,13,18,19,34,59,50]]]
		# demand = [[[138,141,155,157,146,162,180,174,165,182,194,167,100,116,144,182,202,207,205,209,221,218,211,221,224,208,203,201,181,174,170,156]], [[152,158,164,192,185,179,156,167,166,177,160,179,90,99,91,96,59,51,45,47,46,48,35,43,39,45,42,35,42,28,30,31]], [[366,386,395,436,443,432,436,430,426,442,480,516,366,323,392,496,516,485,491,491,499,464,479,424,418,417,388,386,360,357,350,355], [2,8,10,2,2,5,6,3,3,2,6,2,2,5,7,4,7,2,4,6,8,7,8,11,15,15,16,13,12,11,14,13]]]

		self.vars.register('sw', Helper.g('w_r', 'C', 1, 1))
		self.vars.register('w', Helper.g('w_r{}_i{}', 'C', 0, len(routes), len(demand[0][0])))
		# self.vars.register('w', Helper.g('w_r{}_i{}', 'C', [sum(demand[r]) for r in range(len(routes))], len(routes), len(demand[0][0])))
		self.vars.register('delta', Helper.g('delta_r{},i{}', 'C', 0, len(routes), len(demand[0][0])))
		self.vars.register('n', Helper.g('n_i{},r{},n{}', 'B', 0, len(demand[0][0]), len(routes), n_buses))
		self.vars.register('ndelta', Helper.g('ndelta_i{},r{},n{}', 'C', 0, len(demand[0][0]), len(routes), n_buses))
Пример #2
0
    def generate_variables(self):
        groups = self.sc.groups
        plan_horizon = self.sc.plan_horizon

        r = self.sc.routes[0]

        # d: Departure time
        self.vars.register('d',
                           Helper.g('d_s{},k{}', 'I', 0, r.n_stops, r.n_buses))
        # a: Arrival time
        self.vars.register('a',
                           Helper.g('a_s{},k{}', 'I', 0, r.n_stops, r.n_buses))

        # h: Dwell time
        self.vars.register('h',
                           Helper.g('h_s{},k{}', 'I', 0, r.n_stops, r.n_buses))

        # c: Capacity
        self.vars.register('c',
                           Helper.g('c_s{},k{}', 'I', 0, r.n_stops, r.n_buses))

        p = []
        pt = []
        pta = []
        # ptd = []

        for g in groups:
            p.append(Helper.g('p_g%d,k{}' % g.id, 'B', 0, g.routes[0].n_buses))
            pt.append(
                Helper.g('pt_g%d,k{}' % g.id, 'B', 0, g.routes[0].n_buses))
            pta.append(
                Helper.g('pta_g%d,k{}' % g.id, 'I', 0, g.routes[0].n_buses))
            # ptd.append(Helper.g(
            # 	'ptd_g%d,k{}' % g.id, 'I', 0, g.routes[0].n_buses))

        self.vars.register('p', p)
        self.vars.register('pt', pt)
        self.vars.register('pta', pta)
        # self.vars.register('ptd', ptd)

        # self.vars.register('w', Helper.g(
        # 	'w_g{}', 'I', [0 for g in groups], len(groups)))
        self.vars.register(
            't', Helper.g('t_g{}', 'I', [g.size for g in groups], len(groups)))
Пример #3
0
	def generate_variables(self):
		r_max = 1
		candidate_stops = [[55.785470, 12.523041],[55.786239, 12.522234],[55.786541, 12.526961],[55.789277, 12.523946],[55.786431, 12.521428],[55.785898, 12.520618],[55.785138, 12.520728],[55.784637, 12.520459],[55.782099, 12.514132],[55.782460, 12.519244],[55.782226, 12.520035]]
		demand_centroids = [[55.786344,12.524316],[55.786344,12.524316],[55.786872,12.5259],[55.78944,12.525146],[55.786745,12.520469],[55.787486,12.518472],[55.787911,12.518621],[55.785438,12.519377],[55.785154,12.520434],[55.785241,12.518699],[55.783,12.512931],[55.781929,12.521461]]
		n_candidate_stops = len(candidate_stops)
		demands = [[0, 100, 3, 36, 0, 14, 13, 19, 42, 55, 5, 20],
			 [190, 0, 2, 25, 0, 18, 6, 8, 40, 37, 5, 4],
			 [13, 10, 0, 3, 0, 3, 0, 1, 5, 3, 0, 0],
			 [137, 1, 0, 0, 0, 10, 4, 1, 17, 34, 1, 1],
			 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
			 [47, 9, 2, 4, 0, 0, 63, 0, 0, 6, 2, 0],
			 [46, 4, 0, 0, 0, 173, 0, 0, 0, 2, 2, 1],
			 [61, 2, 0, 1, 0, 1, 0, 0, 78, 116, 0, 0],
			 [116, 13, 1, 5, 0, 8, 0, 52, 0, 84, 16, 8],
			 [167, 6, 0, 6, 0, 33, 13, 52, 230, 0, 23, 6],
			 [1, 1, 0, 0, 0, 1, 0, 0, 7, 1, 0, 1],
			 [97, 55, 0, 6, 0, 3, 2, 2, 47, 39, 9, 0]]

		# self.vars.register('st', Helper.g('st_{}', 'B', 1, n_candidate_stops))

		self.vars.register('x', Helper.g('x_{},{},{}', 'B', 0, r_max, n_candidate_stops+1, n_candidate_stops+1))
		# self.vars.register('xf', Helper.g('xf_{},{},{}', 'C', 0, r_max, n_candidate_stops+1, n_candidate_stops+1))
		# self.vars.register('zxf', Helper.g('zxf_{},{},{}', 'C', 0, r_max, n_candidate_stops+1, n_candidate_stops+1))

		# self.vars.register('xD', Helper.g('xD_{},{},{},{}', 'C', 0, r_max, n_candidate_stops, n_candidate_stops, n_candidate_stops))
		# self.vars.register('sD', Helper.g('sD_{},{},{}', 'B', 0, r_max, n_candidate_stops, n_candidate_stops))
		# self.vars.register('D', Helper.g('D_{},{},{}', 'C', 0, r_max, n_candidate_stops, n_candidate_stops))
		self.vars.register('f', Helper.g('f_{}', 'C', 0, r_max))
		# self.vars.register('T', Helper.g('T_{}', 'C', 1000, r_max))

		# self.vars.register('ts', Helper.g('ts_{}', 'C', -1, 1))
		
		self.vars.register('w', Helper.g('w_{},{}', 'C', reduce(lambda a,b: a+b, demands), len(demands), len(demands)))

		self.vars.register('s', Helper.g('s_{},{},{},{}', 'B', 0, len(demands), len(demands), n_candidate_stops, n_candidate_stops))

		self.vars.register('adm', Helper.g('adm_{},{}', 'B', 0, n_candidate_stops+1, n_candidate_stops+1))
		self.vars.register('xadm', Helper.g('adm_{},{},{},{}', 'B', 0, r_max, n_candidate_stops+1, n_candidate_stops+1, n_candidate_stops+1))

		# self.vars.register('q', Helper.g('q_{},{}', 'C', 0, r_max, n_candidate_stops))

		self.vars.register('delta', Helper.g('delta_{},{}', 'B', 0, r_max, n_candidate_stops))
		self.vars.register('deltaf', Helper.g('deltaf_{},{}', 'C', 0, r_max, n_candidate_stops))
Пример #4
0
    def generate_variables(self):
        r_max = 1
        candidate_stops = [  #[55.785470, 12.523041],
            [55.786239, 12.522234], [55.786541, 12.526961],
            [55.789277, 12.523946], [55.786431, 12.521428],
            [55.785898, 12.520618], [55.785138, 12.520728],
            [55.784637, 12.520459], [55.782099, 12.514132],
            [55.782460, 12.519244], [55.782226, 12.520035]
        ]
        demand_centroids = [[55.786344, 12.524316], [55.786344, 12.524316],
                            [55.786872, 12.5259], [55.78944, 12.525146],
                            [55.786745, 12.520469], [55.787486, 12.518472],
                            [55.787911, 12.518621], [55.785438, 12.519377],
                            [55.785154, 12.520434], [55.785241, 12.518699],
                            [55.783, 12.512931], [55.781929, 12.521461]]
        n_candidate_stops = len(candidate_stops)
        demands = [[0, 100, 3, 36, 0, 14, 13, 19, 42, 55, 5, 20],
                   [190, 0, 2, 25, 0, 18, 6, 8, 40, 37, 5, 4],
                   [13, 10, 0, 3, 0, 3, 0, 1, 5, 3, 0, 0],
                   [137, 1, 0, 0, 0, 10, 4, 1, 17, 34, 1, 1],
                   [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                   [47, 9, 2, 4, 0, 0, 63, 0, 0, 6, 2, 0],
                   [46, 4, 0, 0, 0, 173, 0, 0, 0, 2, 2, 1],
                   [61, 2, 0, 1, 0, 1, 0, 0, 78, 116, 0, 0],
                   [116, 13, 1, 5, 0, 8, 0, 52, 0, 84, 16, 8],
                   [167, 6, 0, 6, 0, 33, 13, 52, 230, 0, 23, 6],
                   [1, 1, 0, 0, 0, 1, 0, 0, 7, 1, 0, 1],
                   [97, 55, 0, 6, 0, 3, 2, 2, 47, 39, 9, 0]]

        walkcosts = []

        for p in range(len(demands)):
            for q in range(len(demands)):
                for o in range(len(candidate_stops)):
                    for d in range(len(candidate_stops)):
                        wt = walktime(candidate_stops[o],
                                      demand_centroids[p]) + walktime(
                                          candidate_stops[d],
                                          demand_centroids[q])

                        if wt <= 10:
                            walkcosts.append(demands[p][q] * wt)
                        else:
                            walkcosts.append(0)

        self.vars.register(
            'x',
            Helper.g('x_{},{},{}', 'B', 0, r_max, n_candidate_stops + 1,
                     n_candidate_stops + 2))
        self.vars.register(
            'xf',
            Helper.g('xf_{},{},{}', 'C', 0, r_max, n_candidate_stops + 1,
                     n_candidate_stops + 1))
        self.vars.register(
            'zxf',
            Helper.g('zxf_{},{},{}', 'C', 0, r_max, n_candidate_stops + 1,
                     n_candidate_stops + 1))
        self.vars.register(
            'zzxf',
            Helper.g('zzxf_{},{},{}', 'C', 0, r_max, n_candidate_stops + 1,
                     n_candidate_stops + 1))

        # Frequency
        self.vars.register('f', Helper.g('f_{}', 'C', 0, r_max))

        # Route length (temporal length)
        self.vars.register('T', Helper.g('T_{}', 'C', 0, r_max))

        self.vars.register(
            's',
            Helper.g('s_{},{},{},{}', 'B', walkcosts, len(demands),
                     len(demands), n_candidate_stops, n_candidate_stops))

        self.vars.register(
            'q', Helper.g('q_{},{}', 'C', 0, r_max, n_candidate_stops))

        self.vars.register(
            'delta', Helper.g('delta_{},{}', 'B', 0, r_max, n_candidate_stops))
        self.vars.register(
            'deltaf', Helper.g('deltaf_{},{}', 'C', 0, r_max,
                               n_candidate_stops))

        # 11*11*1*11*11
        self.vars.register(
            'st',
            Helper.g(
                'st_{},{},{},{}', 'C',
                np.repeat(
                    np.array(demands).flatten(),
                    n_candidate_stops * n_candidate_stops).tolist(),
                len(demands), len(demands), n_candidate_stops,
                n_candidate_stops))
        self.vars.register(
            't',
            Helper.g('t_{},{}', 'C', 0, n_candidate_stops, n_candidate_stops))
        self.vars.register(
            'xs',
            Helper.g('xs_{},{},{},{},{}', 'B', 0, n_candidate_stops,
                     n_candidate_stops, r_max, n_candidate_stops + 1,
                     n_candidate_stops + 2))
Пример #5
0
	def generate_variables(self, **kwargs):
		r_max = kwargs['r_max']
		max_cap = kwargs['max_cap']
		candidate_stops = kwargs['candidate_stops']
		demand_centroids = kwargs['demand_centroids']
		demands = kwargs['demands']

		n_candidate_stops = len(candidate_stops)
		n_demands = len(demands)

		self.vars.register('x', Helper.g('x_{},{},{},{}', 'B', 0, n_demands, n_demands, n_candidate_stops+n_demands, n_candidate_stops+n_demands))
		self.vars.register('w', Helper.g('w_{},{}', 'C', 0, n_demands, n_demands))
		self.vars.register('r', Helper.g('r_{},{}', 'C', 0, n_demands, n_demands))

		# self.vars.register('w', Helper.g('w_{},{}', 'C', np.array(demands).flatten().tolist(), n_demands, n_demands))
		# self.vars.register('r', Helper.g('r_{},{}', 'C', np.array(demands).flatten().tolist(), n_demands, n_demands))

		self.vars.register('w', Helper.g('w_{},{}', 'C', 0, n_demands, n_demands))
		self.vars.register('r', Helper.g('r_{},{}', 'C', 0, n_demands, n_demands))

		# Route
		self.vars.register('rx', Helper.g('rx_{},{},{}', 'B', 0, r_max, n_candidate_stops+2, n_candidate_stops+2))
		self.vars.register('rx0', Helper.g('rx0_{},{},{}', 'B', 0, r_max, n_candidate_stops, n_candidate_stops))
		self.vars.register('rq', Helper.g('q_{},{}', 'C', 0, r_max, n_candidate_stops))

		self.vars.register('f', Helper.g('f_{}', 'C', 0, r_max))

		self.vars.register('c', Helper.g('c_{}', 'B', 0, r_max))
		self.vars.register('z1', Helper.g('z1_{},{},{}', 'C', 0, r_max, n_candidate_stops, n_candidate_stops))
		self.vars.register('z2', Helper.g('z2_{},{},{}', 'C', 0, r_max, n_candidate_stops, n_candidate_stops))
		self.vars.register('z3', Helper.g('z3_{},{},{}', 'C', 0, r_max, n_candidate_stops, n_candidate_stops))

		self.vars.register('s', Helper.g('s_{},{}', 'C', np.array(demands).flatten().tolist(), n_demands, n_demands))
Пример #6
0
    def generate_variables(self):
        routes, groups = (self.sc.routes, self.sc.groups)
        plan_horizon = self.sc.plan_horizon

        c = Helper.initialize_nested_dict(len(routes), len(routes))
        t = Helper.initialize_nested_dict(len(routes), len(routes))
        p = Helper.initialize_nested_dict(len(routes), len(routes))
        zt = Helper.initialize_nested_dict(len(routes), len(routes))

        for r in routes:
            for rp, ss in r.transfers:
                c[r.id][rp.id] = Helper.g(
                    'c_r%d,rp%d,s{},k{},kp{}' % (r.id, rp.id), 'B', 0, ss,
                    r.n_buses, rp.n_buses)
                t[r.id][rp.id] = Helper.g(
                    't_r%d,rp%d,s{},k{},kp{}' % (r.id, rp.id), 'I', 0, ss,
                    r.n_buses, rp.n_buses)
                p[r.id][rp.id] = Helper.g(
                    'p_r%d,rp%d,s{},k{},kp{},g{}' % (r.id, rp.id), 'B', 0, ss,
                    r.n_buses, rp.n_buses, len(groups))
                zt[r.id][rp.id] = Helper.g(
                    'zt_r%d,rp%d,s{},k{},kp{},g{}' % (r.id, rp.id), 'I', 0, ss,
                    r.n_buses, rp.n_buses, len(groups))

        co = []
        to = []
        z = []

        for g in groups:
            co.append(
                Helper.g('co_g%d,k{}' % g.id, 'B', 0, g.routes[0].n_buses))

            if self.options['waiting_time_objective_coefficient'] == 'demand':
                to.append(
                    Helper.g('to_g%d,k{}' % g.id, 'I', g.size,
                             g.routes[0].n_buses))
            else:
                to.append(
                    Helper.g(
                        'to_g%d,k{}' % g.id, 'I', g.size *
                        self.options['waiting_time_objective_coefficient'],
                        g.routes[0].n_buses))

            z.append(
                Helper.g('z_g%d,k{},kp{}' % g.id, 'B', 0, g.routes[0].n_buses,
                         g.routes[1].n_buses))

        self.vars.register('d', [
            Helper.g('d_r%d,s{},k{}' % r.id, 'I', 0, r.n_stops, r.n_buses)
            for r in routes
        ])
        self.vars.register('a', [
            Helper.g('a_r%d,s{},k{}' % r.id, 'I', 0, r.n_stops, r.n_buses)
            for r in routes
        ])
        self.vars.register('h', [
            Helper.g('h_r%d,s{},k{}' % r.id, 'I', 0, r.n_stops, r.n_buses)
            for r in routes
        ])
        self.vars.register('db', [
            Helper.g('db_r%d,s{},k{},n{}' % r.id, 'B', 0, r.n_stops, r.n_buses,
                     plan_horizon) for r in routes
        ])

        self.vars.register('c', c)
        self.vars.register('t', t)
        self.vars.register('p', p)
        self.vars.register('zt', zt)

        self.vars.register('co', co)
        self.vars.register('to', to)
        self.vars.register('z', z)

        self.vars.register(
            'tg', Helper.g('tg_g{}', 'I', [g.size for g in groups],
                           len(groups)))
Пример #7
0
    def generate_variables(self):
        r_max = 1
        max_cap = 30
        candidate_stops = [[55.785470, 12.523041], [55.786239, 12.522234],
                           [55.786541, 12.526961], [55.789277, 12.523946],
                           [55.786431, 12.521428], [55.785898, 12.520618],
                           [55.785138, 12.520728], [55.784637, 12.520459],
                           [55.782099, 12.514132], [55.782460, 12.519244],
                           [55.782226, 12.520035]]
        n_candidate_stops = len(candidate_stops)
        demand_centroids = [[55.786344, 12.524316], [55.786344, 12.524316],
                            [55.786872, 12.5259], [55.78944, 12.525146],
                            [55.786745, 12.520469], [55.787486, 12.518472],
                            [55.787911, 12.518621], [55.785438, 12.519377],
                            [55.785154, 12.520434], [55.785241, 12.518699],
                            [55.782330, 12.513640], [55.781929, 12.521461]]
        demands = [[
            0.0, 59.04, 20.34, 17.0, 0.0, 15.87, 8.27, 2.94, 23.92, 34.73,
            1.91, 15.26
        ],
                   [
                       47.32, 0.0, 7.31, 8.7, 0.0, 8.66, 5.07, 1.23, 11.37,
                       14.67, 0.97, 6.27
                   ],
                   [
                       14.09, 7.53, 0.0, 4.51, 0.0, 2.02, 1.23, 0.39, 3.78,
                       3.75, 0.24, 1.67
                   ],
                   [
                       14.64, 8.1, 4.75, 0.0, 0.0, 1.13, 0.81, 0.4, 2.07, 2.76,
                       0.27, 1.53
                   ],
                   [
                       0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                       0.0
                   ],
                   [
                       14.1, 8.61, 2.06, 1.38, 0.0, 0.0, 20.35, 1.28, 6.48,
                       16.1, 0.25, 1.72
                   ],
                   [
                       7.06, 4.96, 1.13, 1.09, 0.0, 20.74, 0.0, 0.39, 2.31,
                       6.38, 0.15, 0.86
                   ],
                   [
                       2.3, 1.03, 0.34, 0.23, 0.0, 0.99, 0.22, 0.0, 5.55, 5.08,
                       0.07, 0.37
                   ],
                   [
                       19.67, 11.18, 3.53, 1.91, 0.0, 7.05, 2.24, 6.45, 0.0,
                       28.64, 0.82, 4.56
                   ],
                   [
                       31.91, 14.58, 3.91, 2.84, 0.0, 17.88, 6.71, 7.28,
                       28.09, 0.0, 1.15, 7.68
                   ],
                   [
                       1.72, 0.94, 0.23, 0.3, 0.0, 0.22, 0.12, 0.1, 0.83, 1.13,
                       0.0, 1.2
                   ],
                   [
                       13.15, 5.68, 1.69, 1.78, 0.0, 1.63, 0.82, 0.4, 4.24,
                       7.15, 1.11, 0.0
                   ]]

        self.vars.register(
            'x',
            Helper.g('x_{},{},{},{}', 'B', 1, len(demands), len(demands),
                     n_candidate_stops + len(demands),
                     n_candidate_stops + len(demands)))
        self.vars.register(
            'w',
            Helper.g('w_{},{}', 'C',
                     np.array(demands).flatten().tolist(), len(demands),
                     len(demands)))
        self.vars.register(
            'r',
            Helper.g('r_{},{}', 'C',
                     np.array(demands).flatten().tolist(), len(demands),
                     len(demands)))

        # Route
        self.vars.register(
            'rx',
            Helper.g('rx_{},{},{}', 'B', 1, r_max, n_candidate_stops + 2,
                     n_candidate_stops + 2))
        self.vars.register(
            'rx0',
            Helper.g('rx0_{},{},{}', 'B', 1, r_max, n_candidate_stops,
                     n_candidate_stops))
        self.vars.register(
            'rq', Helper.g('q_{},{}', 'C', 0, r_max, n_candidate_stops))

        self.vars.register('f', Helper.g('f_{}', 'C', 0, r_max))

        self.vars.register('c', Helper.g('c_{}', 'B', 0, r_max))
        self.vars.register(
            'z1',
            Helper.g('z1_{},{},{}', 'C', 1, r_max, n_candidate_stops,
                     n_candidate_stops))
        self.vars.register(
            'z2',
            Helper.g('z2_{},{},{}', 'C', 1, r_max, n_candidate_stops,
                     n_candidate_stops))
Пример #8
0
    def generate_variables(self, **kwargs):
        r_max = kwargs['r_max']
        max_cap = kwargs['max_cap']
        candidate_stops = kwargs['candidate_stops']
        demand_centroids = kwargs['demand_centroids']
        demands = kwargs['demands']
        candidate_routes = kwargs['candidate_routes']
        is_circular = kwargs['is_circular']
        n_buses = kwargs['n_buses']
        costs = kwargs['costs']

        n_candidate_stops = len(candidate_stops)
        n_demands = len(demands)
        n_candidate_routes = len(candidate_routes)

        costs_w = np.array(costs)[:n_demands, :n_demands]

        self.vars.register(
            'x',
            Helper.g('x_{},{},{},{}', 'B', 0, n_demands, n_demands,
                     n_candidate_stops + n_demands,
                     n_candidate_stops + n_demands))
        self.vars.register('w',
                           Helper.g('w_{},{}', 'C', 0, n_demands, n_demands))
        self.vars.register('r',
                           Helper.g('r_{},{}', 'C', 0, n_demands, n_demands))

        self.vars.register('w',
                           Helper.g('w_{},{}', 'C', 0, n_demands, n_demands))
        self.vars.register('r',
                           Helper.g('r_{},{}', 'C', 0, n_demands, n_demands))
        self.vars.register('hod',
                           Helper.g('hod_{},{}', 'C', 0, n_demands, n_demands))

        self.vars.register('t', Helper.g('t_{}', 'C', 0, r_max))
        self.vars.register('h', Helper.g('h_{}', 'C', 0, r_max))

        # Route
        self.vars.register(
            'rx',
            Helper.g('rx_{},{},{}', 'B', 0, r_max, n_candidate_stops + 2,
                     n_candidate_stops + 2))
        self.vars.register(
            'rx0',
            Helper.g('rx0_{},{},{}', 'B', 0, r_max, n_candidate_stops,
                     n_candidate_stops))
        # self.vars.register('rq', Helper.g('q_{},{}', 'C', 0, r_max, n_candidate_stops))

        self.vars.register('f', Helper.g('f_{}', 'C', 0, r_max))

        #self.vars.register('c', Helper.g('c_{}', 'B', 0, r_max))
        self.vars.register(
            'z1',
            Helper.g('z1_{},{},{}', 'C', 0, r_max, n_buses + 1,
                     n_candidate_routes))
        self.vars.register(
            'z2',
            Helper.g('z2_{},{},{},{},{}', 'C', 0, n_demands, n_demands, r_max,
                     n_candidate_stops, n_candidate_stops))
        self.vars.register(
            'z3',
            Helper.g('z3_{},{},{}', 'C', 0, r_max, n_candidate_stops,
                     n_candidate_stops))
        self.vars.register(
            'z4',
            Helper.g('z4_{},{},{}', 'C', 0, r_max, n_candidate_stops,
                     n_candidate_stops))
        self.vars.register(
            'z5',
            Helper.g('z5_{},{},{}', 'C', 0, r_max, n_candidate_stops,
                     n_candidate_stops))

        self.vars.register(
            's',
            Helper.g(
                's_{},{}', 'C',
                np.multiply(
                    np.array(demands).flatten(),
                    np.exp(costs_w / np.max(costs_w)).flatten()).tolist(),
                n_demands, n_demands))
        # self.vars.register('s', Helper.g('s_{},{}', 'C', np.array(demands).flatten().tolist(), n_demands, n_demands))

        self.vars.register(
            'xc', Helper.g('xc_{},{}', 'B', 0, r_max, n_candidate_routes))
        self.vars.register(
            'zc', Helper.g('zc_{},{}', 'C', 0, r_max, n_candidate_routes))
        self.vars.register('xn',
                           Helper.g('xn_{},{}', 'B', 0, r_max, n_buses + 1))