def launch_basic(): width = 15 height = 10 num_agents = 2 pixel_ratio = 50 grid = CanvasGrid(agent_draw, width, height, width * pixel_ratio, height * pixel_ratio) server = ModularServer(ShapesModel, [grid], "Basic Example", num_agents, width, height) server.max_steps = 0 server.port = 8888 server.launch()
def launch_shape_model(): width = 15 height = 10 num_agents = 2 pixel_ratio = 50 grid = CanvasGrid(agent_draw, width, height, width * pixel_ratio, height * pixel_ratio) server = ModularServer(ShapesModel, [grid], "Shape Model Example", num_agents, width, height) server.max_steps = 0 server.port = 8521 server.launch()
def launch_shape_model(): width = 15 height = 10 num_agents = 2 pixel_ratio = 50 grid = CanvasGrid(agent_draw, width, height, width * pixel_ratio, height * pixel_ratio) server = ModularServer(ShapeExample, [grid], "Shape Model Example", {"N": num_agents, "width": width, "height": height}) server.max_steps = 0 server.port = 8521 server.launch()
def launch_shape_model(): width = 50 height = 17 num_agents = 2 pixel_ratio = 10 grid = CanvasGrid(agent_draw, width, height, width * pixel_ratio, height * pixel_ratio) server = ModularServer(ShapesModel, [grid], "Shape Model Example", model_params={ 'N': num_agents, 'width': width, 'height': height }) server.max_steps = 0 server.port = 8888 server.launch()
'Color': ['#00FF00', '#99FF99))'], 'stroke_color': '#666666', 'Filled': 'ture', 'heading_x': agent.heading[0], 'heading_y': agent.heading[1], 'text': agent.unique_id, 'text_color': 'white', 'scale': 0.8, } return portrayal width = 15 height = 10 num_agents = 2 pixel_ratio = 50 grid = CanvasGrid(agent_draw, width, height, width * pixel_ratio, height * pixel_ratio) server = ModularServer( ShapeExample, [grid], 'Shape Model Example', { 'N': num_agents, 'width': width, 'height': height }, ) server.max_steps = 0 server.port = 8521
def launch_city_model(): city_map = [] with open("city_map_21x21.txt", "r") as f: for line in f: l = [] for cell in line.strip().split('\t'): l.append(cell) city_map.append(l) height = len(city_map) width = len(city_map[0]) num_agents = 6 pixel_ratio = 5 city_roads, city_blocks, passenger_blocks, routes = getRoads( city_map, height, width) n_slider = UserSettableParameter('slider', "Number of Cabs", 5, 1, 10, 1) passenger_population = UserSettableParameter('slider', "Passenger Population", .1, 0, 1, .05) passenger_pooling = UserSettableParameter('slider', "Passenger Pooling %", .5, 0, 1, .1) # grid = CanvasGrid(agent_draw, width, height, # width * pixel_ratio, height * pixel_ratio) grid = CanvasGrid(agent_draw, width, height, 500, 500) chart_element = ChartModule([{ "Label": "Normal Passenger", "Color": "#000000" }, { "Label": "Pooling Passenger", "Color": "#0033cc" }, { "Label": "Average", "Color": "#990000" }]) chart_element_cars_carpooling = ChartModule([{ "Label": "Cars carpooling", "Color": "#0033cc" }, { "Label": "Cars not carpooling", "Color": "#000000" }, { "Label": "Empty cars", "Color": "#ffff33" }]) passengers_traveling = ChartModule([{ "Label": "Passengers Travelling (not pooling)", "Color": "#000000" }, { "Label": "Passengers Travelling (pooling)", "Color": "#0033cc" }, { "Label": "Passengers Travelling", "Color": "#19ff00" }]) over_travelled = ChartModule([{ "Label": "Overtravelled (in percentage)", "Color": "#990000" }]) server = ModularServer( CityModel, [ grid, chart_element, chart_element_cars_carpooling, passengers_traveling, over_travelled ], "SOAS Project - Rafael Bianchi", { "N": n_slider, "PassengerPopulation": passenger_population, "PassengerPooling": passenger_pooling, "PassengerBlocks": passenger_blocks, "width": width, "height": height, "city_map": city_map, "roads": city_roads, "city_blocks": city_blocks, "routes": routes }) server.max_steps = 0 server.port = 8521 server.launch()