# ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of Sandia, LLC, the U.S. Government retains certain rights in this
# software. This software is distributed under the 3-clause BSD License.
# ____________________________________________________________________________________
import logging
from pyomo.core.base import (
Transformation,
TransformationFactory,
Constraint,
Block,
Param,
SortComponents,
ComponentUID,
)
from pyomo.mpec.complementarity import Complementarity
from pyomo.gdp import Disjunct
logger = logging.getLogger('pyomo.core')
#
# This transformation reworks each Complementarity block to
# add a constraint that ensures the complementarity condition.
# Specifically,
#
# x1 >= 0 OR x2 >= 0
#
# becomes
#
# x1 >= 0
# x2 >= 0
# x1*x2 <= 0
#