pyomo solve bi-level model mistakes

134 views
Skip to first unread message

rj lu

unread,
Nov 26, 2023, 1:27:20 PM11/26/23
to Pyomo Forum
WARNING: log_infeasible_constraints() called with a logger whose effective
    level is higher than logging.INFO: no output will be logged regardless of
    constraint feasibility
WARNING: DEPRECATED: Param 'yl0_star' declared with an implicit domain of
    'Any'. The default domain for Param objects is 'Any'.  However, we will be
    changing that default to 'Reals' in the future.  If you really intend the
    domain of this Paramto be 'Any', you can suppress this warning by
    explicitly specifying 'within=Any' to the Param constructor.  (deprecated
    in 5.6.9, will be removed in (or after) 6.0) (called from
    C:\Users\LaiQq\PycharmProjects\PostGraduate\venv\lib\site-
    packages\pyomo\core\base\indexed_component.py:633)
ERROR: evaluating object as numeric value: Master.yl0[208]
        (object: <class 'pyomo.core.base.var._GeneralVarData'>)
    No value for uninitialized NumericValue object Master.yl0[208]
ERROR: evaluating object as numeric value: Master.Theta_star
        (object: <class 'pyomo.core.base.objective.ScalarObjective'>)
    No value for uninitialized NumericValue object Master.yl0[208]
Traceback (most recent call last):
  File "C:/Users/PycharmProjects/PostGraduate/Bi_level/bilevel_model_small.py", line 556, in <module>
    solution = opt.solve(M, tee=True)
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pao\pyomo\solvers\mpr_solvers.py", line 117, in solve
    return super().solve(model, **options)
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pao\pyomo\solver.py", line 66, in solve
    lmp_results = opt.solve(lmp, **solver_options)
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pao\mpr\solvers\pccg.py", line 116, in solve
    UxR, UxZ, LxR, LxZ = execute_PCCG_solver(self.standard_form, self.config, results)
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pao\mpr\solvers\pccg_solver.py", line 495, in execute_PCCG_solver
    LB=value(Parent.Master.Theta_star)
  File "pyomo\core\expr\numvalue.pyx", line 153, in pyomo.core.expr.numvalue.value
  File "pyomo\core\expr\numvalue.pyx", line 138, in pyomo.core.expr.numvalue.value
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pyomo\core\base\expression.py", line 61, in __call__
    return self.expr(exception=exception)
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pyomo\core\expr\base.py", line 115, in __call__
    return evaluate_expression(self, exception)
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pyomo\core\expr\visitor.py", line 1242, in evaluate_expression
    ans = visitor.dfs_postorder_stack(exp)
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pyomo\core\expr\visitor.py", line 880, in dfs_postorder_stack
    flag, value = self.visiting_potential_leaf(_sub)
  File "C:\Users\PycharmProjects\PostGraduate\venv\lib\site-packages\pyomo\core\expr\visitor.py", line 1144, in visiting_potential_leaf
    return True, value(node, exception=self.exception)
  File "pyomo\core\expr\numvalue.pyx", line 153, in pyomo.core.expr.numvalue.value
  File "pyomo\core\expr\numvalue.pyx", line 140, in pyomo.core.expr.numvalue.value
ValueError: No value for uninitialized NumericValue object Master.yl0[208]



What are the reasons for these errors? How to solve it?

gov...@gmail.com

unread,
Dec 19, 2023, 1:29:25 PM12/19/23
to Pyomo Forum
Hi,
to me it seems that the error is not bilevel specific.

If this line appears in the model you want to solve
`LB=value(Parent.Master.Theta_star)`
and 'Master.Theta_star' expression is based on at least one variable (which it appears to be, namely on 'Master.yl0[208]'), the model can not be constructed and you need to reformulate it.

Model formulation can not contain evaluation of a variable, or evaluation of an expression containing variables. You only get values for variables from a feasible solution after solve (unless you set them manually, which is probably not what you want to do here).


What are the reasons for these errors? How to solve it?If
Reply all
Reply to author
Forward
0 new messages