.stop_criterion
A Norm Based Gap Function method
Reference documentation for a simple norm based gap function (where if the norm is set to 1, i.e. \(p=1\), we take the absolute difference).
This gap function utilises a norm based approach to computing the gap. It depends on the assignment method what variables are used to compute the gap. In general the user has to choose the norm (norm 1, norm 2, …, norm p) to apply and we also allow the user to choose whether or not the result is to be averaged or not, i.e., divide the result by the number of entries considered. It also hosts a stop criterion to determine when the gap is deemed small enough to be considered sufficient. This criterion is user configurable as well. Mathematically, the norm based gap is defined as follows:
\(\Large \delta = {1 \over |\mathbf{x}|} \sqrt[\leftroot{-3}\uproot{3}p]{ (x_1^{i-1}-x_1^i)^p + ... + (x_{|\mathbf{x}|}^{i-1}-x_{|\mathbf{x}|}^i)^p}\)
with
\(\delta = \textrm{gap},\\ p = \textrm{norm to apply, e.g. norm 2 requires } p=2,\\ i = \textrm{iteration},\\ \mathbf{x} = \textrm{vector of the variable }x \textrm{ we take the gap over between iterations, e.g., travel time cost},\\\)
When the averaged option is not activated, the portion of the equation where we multiply by \({1 \over |\mathbf{x}|}\) is left out
Name | Value | Type | Unit |
---|---|---|---|
Stop criterion | Object instance | Default Stop Criterion | N/A |
Norm (\(p\)) |
1 | Integer |
N/A |
Averaged |
TRUE |
boolean |
N/A |
This class exposes the following methods
Name | Description |
---|---|
.set_norm(+) |
Override the default norm \(p\) |
.set_averaged(+) |
Override the default averaged setting |
This class exposes the following properties:
Property | Availability | Description |
---|---|---|
.stop_criterion |
Always | Access to the stop criterion instance |
from planit import *
# choose to run PLANit with a the Static Link Transmission Model assignment method
# This has the norm based gap as a default already
= Planit()
planit_instance set(TrafficAssignment.SLTM)
planit_instance.project.
# while not needed it can be set explicitly via
# planit_instance.project.assignment.set(GapFunction.NORM_BASED)
# change the norm to use from 1 to 2
2) planit_instance.project.assignment.gap_function.set_norm(
Traffic Assignment on what traffic
assignment methods are available
StopCriterion default
implementation
Class GapFunctionWrapper
in
projectwrappers.py
A Norm Based Gap Function method
A Norm Based Relative Gap Function method
A Norm Based Relative Gap Function method