'Initialize numeric value of an object
i am trying to do things with a model (written in python and solved with pyomo and guroby) in which i have several costs calculated in this form:
cost_i=sum(M.VariableCost[technology,year]*M.V_Activity[technology,year])
Where M.V_Activity is a model decision variable and the cost is the sum for each technology and year defined in the model.
The objective function, is the sum of several costs, in this form:
economic_cost = cost_i+ cost_j+ cost_x
I want to add an other term to the function, this will be called "environmental cost" and will have the same order of magnitude of the "economic cost", because i want the new term to have a weight comparable to the others in the final objective function, that will be written in the form:
final_cost = economic_cost+ENVIRONMENTAL_COST
I'm trying to establish the order of magnitude of economic_cost trough a cycle,in order to find the exponent that i have to apply at the Environmental_cost in order to make it count, the cycle is in this form:
if value(economic_cost) >10:
...do things
else:
...do others
The model raise the error:
No value for uninitialized NumericValue object V_Capacity [...]
Where V_Capacity is the term that appears in the cost formulation i have written above (the first one).
I know the problem is in the if value() row ,since when i call the value of the economic_cost, this has not been calculated yet. I would need something that act as a placeholder until a value is defined, but really don't know what to do.
Someone knows how to solve and to let the model run?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
