'Creating a placeholder to solve No value for uninitialized object
i am facing a problem that i found thanks to the error: ValueError: No value for uninitialized NumericValue object V_Capacity This error start presenting when i introduce in my model, before calculating the objective function, a math function with the statement "value", as below: economic_cost=fixed_costs
ec = value(economic_cost)
imc = value(overall_impact_cost)
exp_ec = math.ceil(math.log10(ec))
exp_impc = math.ceil(math.log10(imc))
a = pow(10, exp_ec)
b = pow(10, exp_impc)
c = pow(10, 4)
first_term = economic_cost * (c/a)
second_term = overall_impact_cost * (c/b)
period_costs = first_term+second_term
return period_costs
where both the terms economic & overall impact costs are calculated in a similar way with this formulation:
fixed_costs = sum(
M.V_Capacity[r, S_t, S_v]
* (
value(M.CostFixed[r, p, S_t, S_v])
* (
value(MPL[r, p, S_t, S_v])
if not GDR
else (x ** (P_0 - p + 1) * (1 - x ** (-value(MPL[r, p, S_t, S_v]))) / GDR)
)
)
for r, S_p, S_t, S_v in M.CostFixed.sparse_iterkeys()
if S_p == p
)
It seems i am evaluating the pameter fixed_cost, related to the parameter V_Capacity , before this last has been constructed. In order to solve, i have read in stack that i must create a placeholder, but really don't know how to do. Anyone could help? Kind regards, Daniele
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
