I got a pyomo model with an objective can be seen as follows:
model.objective.pprint()
objective : Size=1, Index=None, Active=True
Key : Active : Sense : Expression
None : True : minimize : 50*InvestmentFlow.invest[pv1,bus_pv] -
9*flow[bus_pv,grid_exp,0] -
9*flow[bus_pv,grid_exp,1] -
9*flow[bus_pv,grid_exp,2]
I would like to add a constant into this objective expression like lets say 3000, after creating the model (but before solving it). Is something like that possible?
Any ideas?
Alright I found the answer, following adds the constant value into the objective function
model.objective.expr.__add__(3000)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.