I am using Pyomo and I have the following lines
outputVariables_list = [model.param1, model.variable1]
optimal_values_list = [[pyo.value(model_item[key]) for key in model_item] for model_item in outputVariables_list]
When I run it I get a warning that I don't understand:
WARNING: DEPRECATED: Using __getitem__ to return a set value from its
(ordered) position is deprecated. Please use at() (deprecated in 6.1,
will be removed in 7.0)
I tried the following line but this led to an error:
optimal_values_list = [[pyo.at(model_item[key]) for key in model_item] for model_item in outputVariables_list]
Further, I tried to use pyo.value(model_item.at[key])
and pyo.value(model_item.at(key)
and both lead to AttributeError: 'IndexedParam' object has no attribute 'at'
Do you know how to solve this problem?
Edit: the full list of pyomo components that I use can be seen in the following line (the name indicates if it is a parameter, variable or set):
outputVariables_list_BT2 = [model.param_helpTimeSlots_BT2, model.variable_heatGenerationCoefficient_SpaceHeating_BT2, model.variable_heatGenerationCoefficient_DHW_BT2, model.variable_help_OnlyOneStorage_BT2, model.variable_temperatureBufferStorage_BT2, model.variable_usableVolumeDHWTank_BT2, model.variable_electricalPowerTotal_BT2, model.variable_pvGeneration_BT2, model.variable_windPowerAssigned_BT2, model.param_heatDemand_In_W_BT2, model.param_DHWDemand_In_W_BT2, model.param_electricalDemand_In_W_BT2, model.param_pvGenerationNominal_BT2, model.param_outSideTemperature_In_C, model.param_windAssignedNominal_BT2, model.param_COPHeatPump_SpaceHeating_BT2, model.param_COPHeatPump_DHW_BT2, model.param_electricityPrice_In_Cents, model.set_timeslots]
Reminder: Hi all, I still have 2 question about this issue:
What I don't understand is that Pyomo tells me to use "at" instead of 2__getitem__", but this not work as I get errors when using at. This is a quite confusing recommendation.
Is there a way how to surpress the warnings by telling pyomo just not to display them? The set I am using always has a natural order (timeslots), so the warning does not seem to be relevant for my application, and the dataframes look exactly how they should. I just have to make sure not to update pyomo to version 7.0. So in this case ignoring the warnings seem to be a good option if I can't manage to use "at" as it is recommended by Pyomo (but which does not work so far)
Can anyone help me on these questions? I'll appreciate every further comment