R/223_reductions_dqcp2dcp_tighten.R

Defines functions .tighten_fns

#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dqcp2dcp/tighten.R
#####

## CVXPY SOURCE: reductions/dqcp2dcp/tighten.py
## Bisection interval tightening functions for DQCP

## Returns list(lower, upper) closures for tightening bisection interval
## CVXPY SOURCE: tighten.py tighten_fns()
.tighten_fns <- function(expr) {
  if (S7_inherits(expr, Ceil) || S7_inherits(expr, Floor) || S7_inherits(expr, Length)) {
    list(lower = ceiling, upper = floor)
  } else if (is_nonneg(expr)) {
    list(lower = function(t) pmax(t, 0), upper = identity)
  } else if (is_nonpos(expr)) {
    list(lower = identity, upper = function(t) pmin(t, 0))
  } else {
    list(lower = identity, upper = identity)
  }
}

Try the CVXR package in your browser

Any scripts or data that you put into this service are public.

CVXR documentation built on March 6, 2026, 9:10 a.m.