Determine if a problem or expression complies with the disciplined geometric programming rules.

is_dgp(object)

## Arguments

object

A Problem or Expression object.

## Value

A logical value indicating whether the problem or expression is DCP compliant, i.e. no unknown curvatures.

## Examples

x <- Variable(pos = TRUE)
y <- Variable(pos = TRUE)
prob <- Problem(Minimize(x*y), list(x >= 5, y >= 5))
is_dgp(prob)
#> [1] TRUE
solve(prob, gp = TRUE)
#> $2064 #> [1] 5 #> #>$2065
#> [1] 5
#>
#> $2070 #> [1] 1 #> #>$2076
#> [1] 1
#>
#> $value #> [1] 25 #> #>$status
#> [1] "optimal"
#>
#> $getValue #> function (objet) #> { #> if (is(objet, "Variable") || is(objet, "Constraint")) #> return(result[[as.character(id(objet))]]) #> if (is_zero(objet)) { #> dims <- dim(objet) #> valResult <- matrix(0, nrow = dims[1], ncol = dims[2]) #> } #> else { #> arg_values <- list() #> idx <- 1 #> for (arg in objet@args) { #> arg_val <- if (is_constant(arg)) #> value(arg) #> else { #> getValue(arg) #> } #> if (is.null(arg_val) || (any(is.na(arg_val)) && !is_constant(objet))) #> return(NA) #> else { #> arg_values[[idx]] <- arg_val #> idx <- idx + 1 #> } #> } #> valResult <- to_numeric(objet, arg_values) #> } #> if (all(intf_dim(valResult) == c(1, 1))) #> intf_scalar_value(valResult) #> else valResult #> } #> <bytecode: 0x7f7a8cb6cdd0> #> <environment: 0x7f7acdd21f90> #> #>$getDualValue
#> function (objet)
#> {
#>     if (!is(objet, "Constraint"))
#>         stop("getDualValue: argument should be a Constraint!")
#>     getValue(objet)
#> }
#> <bytecode: 0x7f7a8cb6e2a8>
#> <environment: 0x7f7acdd21f90>
#>
#> $solver #> [1] "MOSEK" #> #>$solve_time
#> [1] 0.0001189709
#>
#> $setup_time #> [1] NA #> #>$num_iters
#> [1] NA
#>