I can interpret this question in a number of ways:
(1) You are performing a sequence of solves, and you want to plot the solution for a particular variable as a function of iteration number.
(2) You have a collection of variables in your model that represent a time series, and you want to plot the solution over that time series.
There is no shortage of examples on stackoverflow and the matplotlib website that describe how to generate plots. On the pyomo side, it simply comes down to extracting values from the model variables and storing them into lists (or numpy arrays) that you can pass into the matplotlib plot functions. For case (2), this might look like:
x = list()
y = list()
for t in sorted(model.TIME):
x.append(t)
y.append(model.some_variable[t].value)
… plot y vs. x
Gabe
Hi everyone,
I'm currently using pyomo (cplex and cbc as main solvers for my experiments), and I want to plot all encountered solutions over time !
what's the best way to get the list of solutions and the corresponding time ?
Thank you all in advance,
Best regards,
Hakim
Note : I'm using jupyter notebook (ipython, python 3)
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
pyomo-forum...@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.