MPEC: Mathematical Programs with Equilibrium Constraints

Mathematical Programs with Equilibrium Constraints (MPECs) are formulations that can be used to model certain classes of discrete events. MPECs can be more efficient than solving mixed integer formulations of the optimization problems because it avoids the combinatorial difficulties of searching for optimal discrete variables.


SIGN Operator

! MPEC formulation for SIGN function
! y = SIGN(x) returns a value y, where:
!    1 if the corresponding element of X is greater than zero
!   -1 if the corresponding element of X is less than zero
Model sign
  Parameters
    x = -2
  End Parameters

  Variables
    y >= -1, <= 1

    s_a >= 0
    s_b >= 0
  End Variables

  Equations
    ! test sign operator, y = sign(x)
    x = s_b - s_a

    minimize s_a*(1+y) + s_b*(1-y)
  End Equations
End Model

Absolute Value (ABS) Operator

! MPEC formulation for ABS function
! y = ABS(x) returns a value y, where:
!    y = x if the corresponding element of X is greater than zero
!    y = -x if the corresponding element of X is less than zero
Model abs
  Parameters
    x = -2
  End Parameters

  Variables
    y

    s_a >= 0
    s_b >= 0
  End Variables

  Equations
    ! test abs operator, y = abs(x)
    x = s_b - s_a
    y = s_a + s_b

    minimize s_a*s_b
  End Equations
End Model

Minimum Selector (MIN) Operator

! MPEC formulation for MIN function
! y = MIN(x1,x2) returns a value y, where:
!    y = x1 if x1 < x2
!    y = x2 if x2 < x1
Model signum
  Parameters
    x1 = -2
    x2 = -1
  End Parameters

  Variables
    y

    ! slack variables
    s_a >= 0
    s_b >= 0
  End Variables

  Equations
    ! test min operator, y = min(x1,x2)
    x2 - x1 = s_b - s_a
    y = x1 - s_a

    minimize s_a*s_b
  End Equations
End Model

Maximum Selector (MAX) Operator

! MPEC formulation for MAX function
! y = MAX(x1,x2) returns a value y, where:
!    y = x1 if x1 > x2
!    y = x2 if x2 > x1
Model signum
  Parameters
    x1 = -2
    x2 = 4
  End Parameters

  Variables
    y

    ! slack variables
    s_a >= 0
    s_b >= 0
  End Variables

  Equations
    ! test max operator, y = max(x1,x2)
    x2 - x1 = s_a - s_b
    y = x1 + s_a

    minimize s_a*s_b
  End Equations
End Model