I´m trying to inspect an Instance of an AbstractModel on Pyomo for checking if parameters reading was OK.
For doing so, I´d like to print the parameters values considered in the instance into a txt file.
for doing so, I´ve tried:
for element in instance.component_objects(Param,descend_into=True):
element.pprint(filename=some_filename)
But what I get is that filename is not a valid argument for pprint. Any hints on what could I do?
pprint
expects an output stream to write to. Try:
with open('file.txt', 'w') as output_file:
element.pprint(output_file)