.set_default_parameters+
BPR link performance function method
Description
This .set_default_parameters allows you to set the BPR function’s default parameters in various ways:
- Define defaults for all link segments,
- Define defaults for all link segments of a particular mode,
- Define defaults for all link segments of a particular mode and link segment type
In case 3) is not available, PLANit will see if 2) is available. If 2) is not available, PLANit will see if 1) is available. If 1) is also not available, PLANit will utilise the pre-set defaults.
Signature
.set_default_parameters(alpha, beta, mode_xml_id=None, link_segment_type_xml_id=None)
with
Parameter | Type | Unit | Compulsory | Description |
---|---|---|---|---|
alpha |
float |
None |
YES | Alpha parameter of BPR function |
beta |
float |
None |
YES | Beta parameter of BPR function |
mode_xml_id |
string |
None |
NO* | Mode (XML) id to relate parameter to |
link_segment_type_xml_id |
string |
None |
NO | Link Segment Type (XML) id to relate parameter to |
* mode_xml_id
becomes compulsory when link_segment_type_xml_id
is provided
Return type
None
Example 1
Set only network wide defaults
from planit import *
# prep
planit_instance = Planit()
planit_instance.project.set(TrafficAssignment.TRADITIONAL_STATIC)
# set physical cost to BPR link performance function
planit_instance.project.assignment.set(PhysicalCost.BPR)
# override the default alpha and beta
alpha = 0.87
beta = 5
planit_instance.project.assignment.physical_cost.set_default_parameters(alpha, beta)
Example 2
Set network wide defaults for a mode with XML id “1”
from planit import *
# prep
planit_instance = Planit()
planit_instance.project.set(TrafficAssignment.TRADITIONAL_STATIC)
# set physical cost to BPR link performance function
planit_instance.project.assignment.set(PhysicalCost.BPR)
# override the default alpha and beta
alpha = 0.87
beta = 5
planit_instance.project.assignment.physical_cost.set_default_parameters(alpha, beta, "1")
Example 3
Set default parameters for mode (XML) id “1” and link segment type (XML) id “4”
from planit import *
# prep
planit_instance = Planit()
planit_instance.set(TrafficAssignment.TRADITIONAL_STATIC)
# set physical cost to BPR link performance function
planit_instance.project.assignment.set(PhysicalCost.BPR)
# override the default alpha and beta
alpha = 0.87
beta = 5
planit_instance.project.assignment.physical_cost.set_default_parameters(alpha, beta, "1", "4")
See also
N/A
Source code
Class BPRCostWrapper
in projectwrappers.py
Last modified January 1, 0001