copy

Purpose

Creates a copy of the optimization problem given as Opt object.

Syntax

new_problem = problem.copy
new_problem = copy(problem)

Description

Creates a copy new_problem of the given optimization problem. The new object is an exact copy of the optimization problem. Changing the original problem does not affect the new_problem.

Input Arguments

problem

Object of the Opt class that defines optimization problem.

Class: Opt

Output Arguments

new_problem

Object of the Opt that is an exact copy of problem.

Class: Opt

Example(s)

Example 1

Create LP optimization problem as ../../../../../fig/mpt/modules/solvers/@Opt/copy1.png. Get the data of the optimization problem written as matrices. The cost function ../../../../../fig/mpt/modules/solvers/@Opt/copy2.png
 f = [1; -1]; 
 The linear inequality constraints ../../../../../fig/mpt/modules/solvers/@Opt/copy3.png
      
 A = [1 2;-1 -0.3;-3 1]; b = [3; 1; 4]; 
 Create the optimization problem 
 problem = Opt('f',f,'A',A,'b',b) 
-------------------------------------------------
Linear program
	Num variables:                2
	Num inequality constraints:   3
	Num equality constraints:     0
	Solver:                     LCP
-------------------------------------------------
We want to have a new copy of problem.
 LPproblem = problem.copy 
-------------------------------------------------
Linear program
	Num variables:                2
	Num inequality constraints:   3
	Num equality constraints:     0
	Solver:                     LCP
-------------------------------------------------
The new LPproblem is exactly the same as problem. If we transform problem to LCP, its representation will change
 problem.qp2lcp 
-------------------------------------------------
Linear complementarity problem
	Num variables:                3
	Num inequality constraints:   0
	Num equality constraints:     0
	Solver:                     LCP
-------------------------------------------------
But we keep the original problem stored as LPproblem.

See Also

opt


© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch