# Quadratic Programming and Cone Programming

Before you begin to solve an optimization problem, you must choose the appropriate approach: problem-based or solver-based. For details, see First Choose Problem-Based or Solver-Based Approach.

For the problem-based approach, create problem variables, and then
represent the objective function and constraints in terms of these symbolic
variables. For the problem-based steps to take, see Problem-Based Optimization Workflow. To
solve the resulting problem, use `solve`

.

For the solver-based steps to take, including defining the objective
function and constraints, and choosing the appropriate solver, see Solver-Based Optimization Problem Setup. To solve the
resulting problem, use `quadprog`

or `coneprog`

.

## Functions

## Live Editor Tasks

Optimize | Optimize or solve equations in the Live Editor (Since R2020b) |

## Objects

`SecondOrderConeConstraint` | Second-order cone constraint object (Since R2020b) |

## Topics

### Problem-Based Quadratic Programming

**Quadratic Programming with Bound Constraints: Problem-Based**

Shows how to solve a problem-based quadratic programming problem with bound constraints using different algorithms.**Large Sparse Quadratic Program, Problem-Based**

Shows how to solve a large sparse quadratic program using the problem-based approach.**Bound-Constrained Quadratic Programming, Problem-Based**

Example showing large-scale problem-based quadratic programming.**Quadratic Programming for Portfolio Optimization, Problem-Based**

Example showing problem-based quadratic programming on a basic portfolio model.**Diversify Portfolios Using Optimization Toolbox**

This example shows three techniques of asset diversification in a portfolio using optimization functions.

### Solver-Based Quadratic Programming

**Quadratic Minimization with Bound Constraints**

Example of quadratic programming with bound constraints and various options.**Quadratic Programming with Many Linear Constraints**

This example shows the benefit of the active-set algorithm on problems with many linear constraints.**Warm Start quadprog**

Shows that warm start can be effective in a large quadratic program.**Warm Start Best Practices**

Describes how best to use warm start for speeding repeated solutions.**Quadratic Minimization with Dense, Structured Hessian**

Example showing how to save memory in a structured quadratic program.**Large Sparse Quadratic Program with Interior Point Algorithm**

Example showing how to save memory in a quadratic program by using a sparse quadratic matrix.**Bound-Constrained Quadratic Programming, Solver-Based**

Example showing solver-based large-scale quadratic programming.**Quadratic Programming for Portfolio Optimization Problems, Solver-Based**

Example showing solver-based quadratic programming on a basic portfolio model.

### Problem-Based Second-Order Cone Programming

**Minimize Energy of Piecewise Linear Mass-Spring System Using Cone Programming, Problem-Based**

Presents a problem-based example of cone programming.**Discretized Optimal Trajectory, Problem-Based**

This example shows how to solve a discretized optimal trajectory problem using the problem-based approach.**Compare Speeds of coneprog Algorithms**

This section gives timing information for a sequence of cone programming problems using various`LinearSolver`

option settings.**Write Constraints for Problem-Based Cone Programming**

Requirements for`solve`

to use`coneprog`

for problem solution.

### Solver-Based Second-Order Cone Programming

**Minimize Energy of Piecewise Linear Mass-Spring System Using Cone Programming, Solver-Based**

Solve a mechanical mass-spring problem using cone programming.**Convert Quadratic Constraints to Second-Order Cone Constraints**

Convert quadratic constraints into`coneprog`

form.**Convert Quadratic Programming Problem to Second-Order Cone Program**

Convert a quadratic programming problem to a second-order cone problem.

### Code Generation

**Code Generation for quadprog Background**

Prerequisites to generate C code for quadratic optimization.**Generate Code for quadprog**

Learn the basics of code generation for the`quadprog`

optimization solver.**Generate Single-Precision quadprog Code**

Generate single-precision code for quadratic programming problems.**Code Generation for coneprog Background**

Prerequisites to generate C code for cone programming.**Generate Code for coneprog**

Provides an example of code generation in`coneprog`

.**Warm Start Best Practices**

Describes how best to use warm start for speeding repeated solutions.**Optimization Code Generation for Real-Time Applications**

Explore techniques for handling real-time requirements in generated code.

### Problem-Based Algorithms

**Problem-Based Optimization Algorithms**

Learn how the optimization functions and objects solve optimization problems.**Write Constraints for Problem-Based Cone Programming**

Requirements for`solve`

to use`coneprog`

for problem solution.**Supported Operations for Optimization Variables and Expressions**

Explore the supported mathematical and indexing operations for optimization variables and expressions.

### Algorithms and Options

**Quadratic Programming Algorithms**

Minimizing a quadratic objective function in*n*dimensions with only linear and bound constraints.**Second-Order Cone Programming Algorithm**

Description of the underlying algorithm.**Optimization Options Reference**

Explore optimization options.