Learn R Programming

CVXR (version 0.99-7)

Problem-class: The Problem class.

Description

This class represents a convex optimization problem.

Usage

Problem(objective, constraints = list())

# S4 method for Problem objective(object)

# S4 method for Problem objective(object) <- value

# S4 method for Problem constraints(object)

# S4 method for Problem constraints(object) <- value

# S4 method for Problem value(object)

# S4 method for Problem value(object) <- value

# S4 method for Problem is_dcp(object)

# S4 method for Problem is_qp(object)

# S4 method for Problem canonicalize(object)

# S4 method for Problem variables(object)

# S4 method for Problem parameters(object)

# S4 method for Problem constants(object)

# S4 method for Problem size_metrics(object)

# S4 method for Problem,character get_problem_data(object, solver)

# S4 method for Problem unpack_results(object, solver, results_dict)

Arguments

objective

A '>Minimize or '>Maximize object representing the optimization objective.

constraints

(Optional) A list of '>Constraint objects representing constraints on the optimization variables.

object

A '>Problem object.

value

A '>Minimize or '>Maximize object (objective), list of '>Constraint objects (constraints), or numeric scalar (value).

solver

A string indicating the solver that the problem data is for. Call installed_solvers() to see all available.

results_dict

A list containing the solver output.

Methods (by generic)

  • objective: The objective of the problem.

  • objective<-: Set the value of the problem objective.

  • constraints: A list of the constraints of the problem.

  • constraints<-: Set the value of the problem constraints.

  • value: The value from the last time the problem was solved.

  • value<-: Set the value of the optimal objective.

  • is_dcp: A logical value indicating whether the problem statisfies DCP rules.

  • is_qp: A logical value indicating whether the problem is a quadratic program.

  • canonicalize: The graph implementation of the problem.

  • variables: List of '>Variable objects in the problem.

  • parameters: List of '>Parameter objects in the problem.

  • constants: List of '>Constant objects in the problem.

  • size_metrics: Information about the size of the problem.

  • get_problem_data: Get the problem data passed to the specified solver.

  • unpack_results: Parses the output from a solver and updates the problem state, including the status, objective value, and values of the primal and dual variables. Assumes the results are from the given solver.

Slots

objective

A '>Minimize or '>Maximize object representing the optimization objective.

constraints

(Optional) A list of constraints on the optimization variables.

value

(Internal) Used internally to hold the value of the optimization objective at the solution.

status

(Internal) Used internally to hold the status of the problem solution.

.cached_data

(Internal) Used internally to hold cached matrix data.

.separable_problems

(Internal) Used internally to hold separable problem data.

.size_metrics

(Internal) Used internally to hold size metrics.

.solver_stats

(Internal) Used internally to hold solver statistics.

Examples

Run this code
# NOT RUN {
x <- Variable(2)
p <- Problem(Minimize(p_norm(x, 2)), list(x >= 0))
is_dcp(p)
x <- Variable(2)
A <- matrix(c(1,-1,-1, 1), nrow = 2)
p <- Problem(Minimize(quad_form(x, A)), list(x >= 0))
is_qp(p)
# }

Run the code above in your browser using DataLab