B u `@sdZddlmZmZmZmZddlmZddlZddl m Z e dZ e ejde ddfd d Zde fd d Zde fd dZe fddZdS)z7Module with diagnostic utilities for infeasible models.) ConstraintVarvalueTraversalStrategy)fabsN)identify_variableszpyomo.util.infeasiblegư>Fcs\xT|jtdddD]>}t|jdd}t|jdd}t|jdd}d} d} d} d} |dkrbd} nL|jr~t|||krd} n0|r|||krd} | r|||krd} t | | | | fsqt |j d} d}|r|d7}|rd |d 7}t |jdd }d fd d|D| d<| r"dn|| d<|j| d<|jrd | d<| d<| d<|| d<|j| d<| rvd| d<n| rBd| d<n|r|| d<|j| d<| rd| d<n| rd| d<nd| d<nd | d<| d<| d<| r*|| d<|j| d<| rd| d<n| r d| d<nd| d<nd | d<| d<| d<||jf| qWdS)aPrint the infeasible constraints in the model. Uses the current model state. Uses pyomo.util.infeasible logger unless one is provided. Args: m (Block): Pyomo block or model to check tol (float): feasibility tolerance log_expression (bool): If true, prints the constraint expression log_variables (bool): If true, prints the constraint variable names and values T)ctypeactive descend_intoF) exceptionN)namezICONSTR {name}: {lb_value}{lb_operator}{body_value}{ub_operator}{ub_value}zB - EXPR: {lb_expr}{lb_operator}{body_expr}{ub_operator}{ub_expr}z - VAR {name}: {value}z{var_printout})Z include_fixedc3s |]}j|j|jdVqdS))r rN)formatr r).0v) vars_template9/tmp/pip-unpacked-wheel-n62dbgi3/pyomo/util/infeasible.py Fsz-log_infeasible_constraints..Z var_printoutzmissing variable value body_valueZ body_exprZlb_valueZlb_exprZ lb_operatorZub_valueZub_exprz =/= Z ub_operatorz =?= z /= LB {}zVAR {}: {} s    _*