.get_values()

A Memory Output Formatter Iterator method

Description

The .get_values() method provides the data array populated with the output properties earmarked as result values for the current result row.

You typically call this method in combination with a loop mechanism such as a while loop, see Example.

Signature

.get_values()

Return type

Class py4j.java_collections.JavaArray : instance

Example

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()

modeXmlId = "1"
timePeriodXmlId = "2"

# find position of flow result
flow_pos = plan_it.project.memory.get_position_of_output_value_property(OutputType.LINK, OutputProperty.FLOW)

# find position of key; we use link segment (XML) id	
id_pos = plan_it.project.memory.get_position_of_output_key_property(OutputType.LINK, OutputProperty.LINK_SEGMENT_XML_ID)

# collect iterator and print results by looping over entries
the_iterator = plan_it.project.memory.iterator(modeXmlId, timePeriodXmlId, i, OutputType.LINK)
while the_iterator.has_next():
	the_iterator.next()
	print "id: ", the_iterator.get_keys()[id_pos], " flow: ", the_iterator.get_values()[flow_pos] 

See also

N/A

Source code

Class MemoryOutputIteratorWrapper in projectwrappers.py