.get_last_iteration()
Memory Output Formatter method
Description
The .get_last_iteration() method provides you with the last iteration index of the PLANit run. Useful when retrieving data for that particular iteration via the iterator
Only call this method after the simulation run.
Signature
.get_last_iteration()
Return type
integer
Example 1
from planit import *
#prep
plan_it = Planit()
plan_it.project.set(TrafficAssignment.TRADITIONAL_STATIC)
plan_it.project.assignment.set(PhysicalCost.BPR)
plan_it.project.assignment.set(VirtualCost.FIXED)
plan_it.project.assignment.set(Smoothing.MSA)
# remove default formatter - activate memory output
plan_it.project.deactivate(OutputFormatter.PLANIT_IO)
plan_it.project.activate(OutputFormatter.MEMORY)
# run simulation
plan_it.project.run()
#collect iteration index of last recorded iteration
i = plan_it.project.memory.get_last_iteration()
# find position of flow result for mode 1, time period 2, iteration i
flow_pos = plan_it.project.memory.get_position_of_output_value_property(1, 2, i, OutputType.LINK, OutputProperty.FLOW)
See also
Memory Formatter Iterator iterator for the memory output formatter
Source code
Class MemoryOutputFormatterWrapper
in projectwrappers.py