Drake
 All Classes Files Functions Variables
MixedIntegerConvexProgram Class Reference

This class is meant to represent general mixed-integer linear, quadratic, quadratically-constrained, and second-order-cone programs. More...

Inheritance diagram for MixedIntegerConvexProgram:
Collaboration diagram for MixedIntegerConvexProgram:

Public Member Functions

function MixedIntegerConvexProgram (has_symbolic)
 Construct a new mixed-integer convex program. More...
 
function addVariable (obj, name, type_, size_, lb, ub, start_)
 Build a struct to hold the sizes and indices of our decision variables This is a new approach that I'm experimenting with, which should offer a mix of the advantages of symbolic and matrix-based optimization frameworks. More...
 
function addVariableIfNotPresent (obj, varargin)
 
function addLinearConstraints (obj, A, b, Aeq, beq)
 
function addCones (obj, cones)
 
function addConesByIndex (obj, idx)
 
function addPolyCones (obj, polycones)
 Add polygonal approximations of second-order cones. More...
 
function addPolyConesByIndex (obj, idx, N)
 Polycones only support approximations of cones with two variables on the left-hand side and one on the right-hand side. More...
 
function addConesOrPolyConesByIndex (obj, idx, N)
 
function addQuadcon (obj, quadcon)
 
function setLinearCost (obj, c)
 
function setLinearCostEntries (obj, idx, val)
 
function addCost (obj, Q, c, objcon)
 
function addSymbolicConstraints (obj, expr)
 
function addSymbolicCost (obj, expr)
 
function addSymbolicObjective (obj, expr)
 
function convertPolyCones (obj)
 Build linear constraints for our polygonal cone approximations. More...
 
function solve (obj)
 
function solveGurobi (obj, params)
 
function getGurobiModel (obj)
 
function extractResult (obj, x)
 
function solveYalmip (obj, params)
 
function solveMosek (obj)
 
function getMosekModel (obj)
 
function setSolver (obj, solver)
 
function compareSolvers (obj)
 

Public Attributes

Property vars
 
Property nv
 the number of variables More...
 
Property c
 the linear cost vector c'x More...
 
Property Q
 the quadratic cost matrix x'Qx More...
 
Property A
 linear inequalities Ax <= b More...
 
Property b
 
Property Aeq
 linear equalities Ax == b More...
 
Property beq
 
Property quadcon
 quadratic constraints x'Qc x + q' x <= rhs More...
 
Property objcon
 constant term in the objective More...
 
Property cones
 indices of second-order cones (see http://www.gurobi.com/documentation/5.6/reference-manual/matlab_gurobi) More...
 
Property polycones
 indices of polygonal approximations of second-order cones. The structure of these constraints are designed to mimic the second-order constraints in obj.cones, but they use a polygonal linear outer approximation of the conic constraint. The number of pieces in each approximation is set by N. More...
 
Property symbolic_constraints
 a list of symbolic constraints constructed with yalmip More...
 
Property symbolic_objective
 a symbolic objective term constructed in yalmip More...
 
Property x_sol
 
Property solver
 

Protected Attributes

Property has_symbolic
 
Property symbolic_vars
 

Detailed Description

This class is meant to represent general mixed-integer linear, quadratic, quadratically-constrained, and second-order-cone programs.

It allows you to define symbolic constraints using Yalmip, which are typically easy to prototype, or to define low-level constraints by directly constructing the A, b, Aeq, beq, etc. matrices, which is typically much faster. For an example of usage, see the MixedIntegerFootstepPlanningProblem subclass.

Constructor & Destructor Documentation

Construct a new mixed-integer convex program.

Parameters
has_symbolicwhether to create symbolic variables in yalmip corresponding to all of the variables in the problem. If obj.has_symbolic is true, you can use both symbolic and non-symbolic (and thus faster) constraints as you wish. If obj.has_symbolic is not true, then you cannot, and you must instead construct all of your constraint and objective matrices directly.
Return values
obj

Member Function Documentation

function addCones ( obj  ,
cones   
)
Return values
obj
function addConesByIndex ( obj  ,
idx   
)
Return values
obj
function addConesOrPolyConesByIndex ( obj  ,
idx  ,
 
)
Return values
obj
function addCost ( obj  ,
Q  ,
c  ,
objcon   
)
Return values
obj
function addLinearConstraints ( obj  ,
A  ,
b  ,
Aeq  ,
beq   
)
Return values
obj
function addPolyCones ( obj  ,
polycones   
)

Add polygonal approximations of second-order cones.

Return values
obj
function addPolyConesByIndex ( obj  ,
idx  ,
 
)

Polycones only support approximations of cones with two variables on the left-hand side and one on the right-hand side.

That is, we can only approximate the constraint that norm([x2, x3]) <= x1 with the linear constraints A[x2; x3] <= b

Return values
obj
function addQuadcon ( obj  ,
quadcon   
)
Return values
obj
function addSymbolicConstraints ( obj  ,
expr   
)
Return values
obj
function addSymbolicCost ( obj  ,
expr   
)
Return values
obj
function addSymbolicObjective ( obj  ,
expr   
)
Return values
obj
function addVariable ( obj  ,
name  ,
type_  ,
size_  ,
lb  ,
ub  ,
start_   
)

Build a struct to hold the sizes and indices of our decision variables This is a new approach that I'm experimenting with, which should offer a mix of the advantages of symbolic and matrix-based optimization frameworks.

The idea is that we have a single Matlab struct (named just 'vars' for convenience) and each variable in the optimization has a corresponding named field in vars. For each variable, we have subfields as follows: type: 'B', 'I', or 'C' for binary, integer, or continuous variables size: a 2x1 vector describing the shape of the variable i: the indices corresponding to the variable, as a matrix of the same size as the 'size' field above. lb: lower bound, as a matrix of the same size as 'size' ub: upper bound, a matrix start: the initial values as a matrix of the same size as 'size'

After optimization, there will be an additional field added to each variable, called 'value', which will contain the final values after optimization.

The 'i' field of indices is useful because when we actually set up the problem in gurobi or another solver, all of the optimization variables are combined into one long vector. This index field lets us easily address parts of that vector. For example, to set the entry in a constraint matrix A corresponding to the jth row and kth column of variable 'foo' to 1, we can do the following: A(1, v.foo.i(j,k)) = 1;

Return values
obj
function addVariableIfNotPresent ( obj  ,
varargin   
)
Return values
obj
function compareSolvers ( obj  )
Return values
solved_prob
solver_time
obj_val
function convertPolyCones ( obj  )

Build linear constraints for our polygonal cone approximations.

Return values
obj
function extractResult ( obj  ,
 
)
Return values
obj
function getGurobiModel ( obj  )
Return values
model
function getMosekModel ( obj  )
Return values
prob
function setLinearCost ( obj  ,
c   
)
Return values
obj
function setLinearCostEntries ( obj  ,
idx  ,
val   
)
Return values
obj
function setSolver ( obj  ,
solver   
)
Return values
obj
function solve ( obj  )
Return values
obj
solvertime
objval
function solveGurobi ( obj  ,
params   
)
Return values
obj
solvertime
objval
function solveMosek ( obj  )
Return values
obj
solvertime
objval
function solveYalmip ( obj  ,
params   
)
Return values
obj
solvertime
objval

Member Data Documentation

Property A

linear inequalities Ax <= b

Property Aeq

linear equalities Ax == b

Property b
Property beq
Property c

the linear cost vector c'x

Property cones
Property has_symbolic
protected
Property nv

the number of variables

Property objcon

constant term in the objective

Property polycones

indices of polygonal approximations of second-order cones. The structure of these constraints are designed to mimic the second-order constraints in obj.cones, but they use a polygonal linear outer approximation of the conic constraint. The number of pieces in each approximation is set by N.

Property Q

the quadratic cost matrix x'Qx

Property quadcon

quadratic constraints x'Qc x + q' x <= rhs

Property solver
Property symbolic_constraints

a list of symbolic constraints constructed with yalmip

Property symbolic_objective

a symbolic objective term constructed in yalmip

Property symbolic_vars
protected
Property vars
Property x_sol

The documentation for this class was generated from the following file: