<jupyter_start><jupyter_text>>>  MaaSSim tutorial  quickstart<jupyter_code>%load_ext autoreload
%autoreload 2
import os, sys # add MaaSSim to path (not needed if MaaSSim is already in path)
module_path = os.path.abspath(os.path.join('../..'))
if module_path not in sys.path:
    sys.path.append(module_path)<jupyter_output><empty_output><jupyter_text>prepare<jupyter_code>from MaaSSim.utils import get_config, load_G, prep_supply_and_demand, generate_demand, generate_vehicles, initialize_df  # simulator
from MaaSSim.data_structures import structures as inData
from MaaSSim.simulators import simulate
from MaaSSim.visualizations import plot_veh
import logging
import pandas as pd
import ExMAS
params = get_config('../../data/config/delft.json')  # load configuration
params.times.pickup_patience = 3600 # 1 hour of simulation
params.simTime = 4 # 1 hour of simulation
params.nP = 500 # reuqests (and passengers)
params.nV = 100 # vehicles
params.t0 = pd.Timestamp.now()
params.shareability.avg_speed = params.speeds.ride
params.shareability.shared_discount = 0.3
params.shareability.delay_value = 1
params.shareability.WtS = 1.3
params.shareability.price = 1.5 #eur/km
params.shareability.VoT = 0.0035 #eur/s
params.shareability.matching_obj = 'u_pax' #minimize VHT for vehicles
params.shareability.pax_delay = 0
params.shareability.horizon = 600
params.shareability.max_degree = 4
params.shareability.nP = params.nP
params.shareability.share = 1
params.shareability.without_matching = True
inData = load_G(inData, params)  # load network graph 
inData = generate_demand(inData, params, avg_speed = False)
inData.vehicles = generate_vehicles(inData,params.nV)
inData.vehicles.platform = inData.vehicles.apply(lambda x: 0, axis = 1)
inData.passengers.platforms = inData.passengers.apply(lambda x: [0], axis = 1)
inData.requests['platform'] = inData.requests.apply(lambda row: inData.passengers.loc[row.name].platforms[0], axis = 1) 
inData.platforms = initialize_df(inData.platforms)
inData.platforms.loc[0]=[1,'Uber',30]
params.shareability.share = 1
params.shareability.without_matching = True
inData = ExMAS.main(inData, params.shareability, plot=False) # create shareability graph (ExMAS)<jupyter_output>14-10-20 11:50:10-INFO-Initializing pairwise trip shareability between 500 and 500 trips.
14-10-20 11:50:10-INFO-creating combinations
14-10-20 11:50:10-INFO-249500	 nR*(nR-1)
14-10-20 11:50:15-INFO-Reduction of feasible pairs by 99.70%
14-10-20 11:50:15-INFO-Degree 2 	Completed
14-10-20 11:50:15-INFO-trips to extend at degree 2 : 1828
14-10-20 11:50:17-INFO-At degree 2 feasible extensions found out of 448 searched
14-10-20 11:50:17-INFO-Degree 3 	Completed
14-10-20 11:50:17-INFO-trips to extend at degree 3 : 448
14-10-20 11:50:18-INFO-At degree 3 feasible extensions found out of 45 searched
14-10-20 11:50:18-INFO-Degree 4 	Completed
14-10-20 11:50:18-INFO-Max degree reached 4
14-10-20 11:50:18-INFO-Trips still possible to extend at degree 4 : 45<jupyter_text>simulate<jupyter_code>sim = simulate(params = params, inData = inData, logger_level = logging.WARNING) # simulate
df = sim.runs[0].rides

for i in range(params.nV):
    paxes = df[df.veh==i].paxes
    if paxes.apply(lambda x: len(x)).max()>1:
        break
plot_veh(inData.G, df[df.veh ==19], lw = 1)
params.shareability.share = 0
sim2 = simulate(params = params, inData = inData, logger_level = logging.WARNING) # simulate
df = sim2.runs[0].rides

for i in range(params.nV):
    paxes = df[df.veh==i].paxes
    if paxes.apply(lambda x: len(x)).max()==1:
        break
plot_veh(inData.G, df[df.veh ==8], lw = 1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11992263056092843, 'fraction_numerical': 0.06963249516441006, 'mean_word_length': 5.146010186757215, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '453268', 'license': 'MIT', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1294, 'n_words': 305, 'path': 'docs/tutorials/07_Shared_rides_with_ExMAS.ipynb', 'repo_name': 'ABedychaj/MaaSSim', 'size': '3619'}