Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,597 changes: 888 additions & 709 deletions fasttrips/Assignment.py

Large diffs are not rendered by default.

26 changes: 17 additions & 9 deletions fasttrips/Error.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

__copyright__ = "Copyright 2016 Contributing Entities"
__license__ = """
__license__ = """
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -17,12 +17,14 @@
limitations under the License.
"""


class Error(Exception):
"""
Base class for exceptions in fast-trips.
"""
pass


class NetworkInputError(Error):
"""
Exception raised for errors in the network input.
Expand All @@ -33,8 +35,9 @@ class NetworkInputError(Error):
"""

def __init__(self, filename, msg):
self.expr = filename
self.msg = msg
self.expr = filename
self.msg = msg


class DemandInputError(Error):
"""
Expand All @@ -46,8 +49,9 @@ class DemandInputError(Error):
"""

def __init__(self, filename, msg):
self.expr = filename
self.msg = msg
self.expr = filename
self.msg = msg


class ConfigurationError(Error):
"""
Expand All @@ -59,8 +63,9 @@ class ConfigurationError(Error):
"""

def __init__(self, filename, msg):
self.expr = filename
self.msg = msg
self.expr = filename
self.msg = msg


class NotImplementedError(Error):
"""
Expand All @@ -69,8 +74,10 @@ class NotImplementedError(Error):
Attributes:
msg -- explanation of the error
"""

def __init__(self, msg):
self.msg = msg
self.msg = msg


class UnexpectedError(Error):
"""
Expand All @@ -79,5 +86,6 @@ class UnexpectedError(Error):
Attributes:
msg -- explanation of the error
"""

def __init__(self, msg):
self.msg = msg
self.msg = msg
31 changes: 16 additions & 15 deletions fasttrips/Examples/Bear/run_bear.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
from fasttrips import Run

network = "cub"
demand = "earlier"
config = "A"
demand = "earlier"
config = "A"
out_folder = "bear_cub_earlier_B"

ex_dir = os.path.abspath(os.path.dirname(__file__))
print "Running Fast-Trips in %s" % (ex_dir.split(os.sep)[-1:])
ex_dir = os.path.abspath(os.path.dirname(__file__))
print
"Running Fast-Trips in %s" % (ex_dir.split(os.sep)[-1:])

Run.run_fasttrips(
input_network_dir = os.path.join(ex_dir,"networks",network),
input_demand_dir = os.path.join(ex_dir,"demand",demand),
run_config = os.path.join(ex_dir,"configs",config,"config_ft.txt"),
input_weights = os.path.join(ex_dir,"configs",config,"pathweight_ft.txt"),
output_dir = os.path.join(ex_dir,"output"),
output_folder = out_folder,
pathfinding_type = "stochastic",
overlap_variable = "count",
overlap_split_transit = True,
iters = 1,
dispersion = 0.50)
input_network_dir=os.path.join(ex_dir, "networks", network),
input_demand_dir=os.path.join(ex_dir, "demand", demand),
run_config=os.path.join(ex_dir, "configs", config, "config_ft.txt"),
input_weights=os.path.join(ex_dir, "configs", config, "pathweight_ft.txt"),
output_dir=os.path.join(ex_dir, "output"),
output_folder=out_folder,
pathfinding_type="stochastic",
overlap_variable="count",
overlap_split_transit=True,
iters=1,
dispersion=0.50)
30 changes: 15 additions & 15 deletions fasttrips/Examples/Bunny_Hop/run_bunny_hop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
from fasttrips import Run

network = "bunny_hop"
demand = "forward_bunnies"
config = "base"
demand = "forward_bunnies"
config = "base"
out_folder = "small_bunny_hop_fwd"

ex_dir = os.path.abspath(os.path.dirname(__file__))
print ("Running Fast-Trips in %s" % (ex_dir.split(os.sep)[-1:]))
ex_dir = os.path.abspath(os.path.dirname(__file__))
print("Running Fast-Trips in %s" % (ex_dir.split(os.sep)[-1:]))

Run.run_fasttrips(
input_network_dir = os.path.join(ex_dir,"networks",network),
input_demand_dir = os.path.join(ex_dir,"demand",demand),
run_config = os.path.join(ex_dir,"configs",config,"config_ft.txt"),
input_weights = os.path.join(ex_dir,"configs",config,"pathweight_ft.txt"),
output_dir = os.path.join(ex_dir,"output"),
output_folder = out_folder,
pathfinding_type = "stochastic",
overlap_variable = "count",
overlap_split_transit = True,
iters = 1,
dispersion = 0.50)
input_network_dir=os.path.join(ex_dir, "networks", network),
input_demand_dir=os.path.join(ex_dir, "demand", demand),
run_config=os.path.join(ex_dir, "configs", config, "config_ft.txt"),
input_weights=os.path.join(ex_dir, "configs", config, "pathweight_ft.txt"),
output_dir=os.path.join(ex_dir, "output"),
output_folder=out_folder,
pathfinding_type="stochastic",
overlap_variable="count",
overlap_split_transit=True,
iters=1,
dispersion=0.50)
33 changes: 17 additions & 16 deletions fasttrips/Examples/Seattle_Region/run_seattle_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
from fasttrips import Run

network = "psrc_1_1"
demand = "psrc_1_1"
config = "base"
demand = "psrc_1_1"
config = "base"
out_folder = "seattle_base"

ex_dir = os.path.abspath(os.path.dirname(__file__))
print "Running Fast-Trips in %s" % (ex_dir.split(os.sep)[-1:])
ex_dir = os.path.abspath(os.path.dirname(__file__))
print
"Running Fast-Trips in %s" % (ex_dir.split(os.sep)[-1:])

Run.run_fasttrips(
input_network_dir = os.path.join(ex_dir,"networks",network),
input_demand_dir = os.path.join(ex_dir,"demand",demand),
run_config = os.path.join(ex_dir,"configs",config,"config_ft.txt"),
input_weights = os.path.join(ex_dir,"configs",config,"pathweight_ft.txt"),
input_functions = os.path.join(ex_dir,"configs",config,'config_ft.py'),
output_dir = os.path.join(ex_dir,"output"),
output_folder = out_folder,
pathfinding_type = "stochastic",
overlap_variable = "count",
overlap_split_transit = True,
iters = 1,
dispersion = 0.50)
input_network_dir=os.path.join(ex_dir, "networks", network),
input_demand_dir=os.path.join(ex_dir, "demand", demand),
run_config=os.path.join(ex_dir, "configs", config, "config_ft.txt"),
input_weights=os.path.join(ex_dir, "configs", config, "pathweight_ft.txt"),
input_functions=os.path.join(ex_dir, "configs", config, 'config_ft.py'),
output_dir=os.path.join(ex_dir, "output"),
output_folder=out_folder,
pathfinding_type="stochastic",
overlap_variable="count",
overlap_split_transit=True,
iters=1,
dispersion=0.50)
41 changes: 21 additions & 20 deletions fasttrips/Examples/Springfield/run_springfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@
from fasttrips import Run

# DIRECTORY LOCATIONS
EXAMPLE_DIR = os.path.abspath(os.path.dirname(__file__))
EXAMPLE_DIR = os.path.abspath(os.path.dirname(__file__))

INPUT_NETWORK = os.path.join(EXAMPLE_DIR, 'networks', 'vermont')
INPUT_DEMAND = os.path.join(EXAMPLE_DIR, 'demand', 'general')
INPUT_CONFIG = os.path.join(EXAMPLE_DIR, 'configs', 'A')
OUTPUT_DIR = os.path.join(EXAMPLE_DIR, 'output')
OUTPUT_FOLDER = "general_run"
INPUT_NETWORK = os.path.join(EXAMPLE_DIR, 'networks', 'vermont')
INPUT_DEMAND = os.path.join(EXAMPLE_DIR, 'demand', 'general')
INPUT_CONFIG = os.path.join(EXAMPLE_DIR, 'configs', 'A')
OUTPUT_DIR = os.path.join(EXAMPLE_DIR, 'output')
OUTPUT_FOLDER = "general_run"

# INPUT FILE LOCATIONS
CONFIG_FILE = os.path.join(INPUT_CONFIG, 'config_ft.txt')
INPUT_WEIGHTS = os.path.join(INPUT_CONFIG, 'pathweight_ft.txt')
CONFIG_FILE = os.path.join(INPUT_CONFIG, 'config_ft.txt')
INPUT_WEIGHTS = os.path.join(INPUT_CONFIG, 'pathweight_ft.txt')

print "Running Fast-Trips in %s" % (EXAMPLE_DIR.split(os.sep)[-1:])
print
"Running Fast-Trips in %s" % (EXAMPLE_DIR.split(os.sep)[-1:])

Run.run_fasttrips(
input_network_dir= INPUT_NETWORK,
input_demand_dir = INPUT_DEMAND,
run_config = CONFIG_FILE,
input_weights = INPUT_WEIGHTS,
output_dir = OUTPUT_DIR,
output_folder = OUTPUT_FOLDER,
pathfinding_type = "stochastic",
overlap_variable = "count",
overlap_split_transit = True,
iters = 3,
dispersion = 0.50)
input_network_dir=INPUT_NETWORK,
input_demand_dir=INPUT_DEMAND,
run_config=CONFIG_FILE,
input_weights=INPUT_WEIGHTS,
output_dir=OUTPUT_DIR,
output_folder=OUTPUT_FOLDER,
pathfinding_type="stochastic",
overlap_variable="count",
overlap_split_transit=True,
iters=3,
dispersion=0.50)
Loading