**Introduction**

Optimization is defined as Minimizing (or Maximizing) an objective function subject to some constraints .If the objective function and the all the constrains are linear it is called linear programming. If the objective function is quadratic and the all the constraints are linear, it is known as quadratic programming. Let us learn how to use the linear and quadratic programming routines of the MATLAB.

**Linear programming**

The command for implementing the matlab linear programming routine is ‘

*’.*__linprog__Let us consider a linear programming problem with ‘n’ variables, ‘m’ inequality constraints, ‘k’ equality constraints, and the lower ,upper bounds LB and UB.

The linear programming is defined in matlab like this

*min f'*x subject to: A*x <= b, Aeq*x = beq ,LB≤ x ≤ UB*

x-=[x

_{1}x_{2}x_{3}….x_{n}]^{T}x is a column matrix of 1 X n) to be determined.f=[c

_{1}c_{2}c_{3}….c_{n}] f is a vector(row matrix of n X 1)A is the matrix of inequalities having a size of m X n

Aeq is the matrix of equalities having a size of k X n

LB-=[l

_{1}l_{2}l_{3}….l_{n}]^{T}x is a column matrix of 1 X n)UB= [u

_{1}u_{2}, u_{3}….u_{n}]^{T}x is a column matrix of 1 X n)Example

f=[10 5 12 13 20];

A= [10 6 1 0 8

2 8 4 7 0

6 9 8 4 7

5 7 0 9 4

9 2 1 5 8

8 4 2 4 5

5 9 2 8 7

0 9 6 5 4

8 4 3 2 3

4 9 2 7 2];

b=[70 63 104 80 81 68 101 81 53 71]';

Aeq=[1 1 1 1 1]

beq=15;

LB=[0 0 0 0 0]'

UB=[20 20 20 20 20]'

**X=linprog(f,A,b,Aeq,beq,LB,UB)**

Solution

Optimization terminated.

X =

2.1683

0.0000

9.6931

2.8416

0.2970

**Quadratic programming**

The command for implementing the matlab quadratic programming routine is ‘

*’.Let us consider a quadratic programming problem with ‘n’ variables, ‘m’ inequality constraints, ‘k’ equality constraints, and the lower, upper bounds LB and UB.*__quadprog__The quadratic programming is defined in matlab like this

*min 0.5*x'*H*x + f'*x subject to: A*x <= b, Aeq*x = beq ,LB≤ x ≤ UB*

x-=[x

_{1}x_{2}x_{3}….x_{n}]^{T}x is a column matrix of 1 X n) to be determined.H= is a square matrix of n X n

f=[c

_{1}c_{2}c_{3}….c_{n}] f is a vector(row matrix of n X 1)A is the matrix of inequalities having a size of m X n

Aeq is the matrix of equalities having a size of k X n

LB-=[l

_{1}l_{2}l_{3}….l_{n}]^{T}x is a column matrix of 1 X n)UB= [u

_{1}u_{2}, u_{3}….u_{n}]^{T}x is a column matrix of 1 X n)Example

Minimize x

_{1}^2+x_{1}x_{2}+x_{22}+3x_{1}+5x_{2}Subject to the constraints

x

_{1}+x_{2}=20;2x

_{1}+3x_{2}≤100[0 0]

^{T}≤x_{1},x_{2}≤[50 50]^{T}H=[2 1;1 2];

f=[3 5];

A= [2 3];

b=[100];

Aeq=[1 1]

beq=20;

LB=[0 0 0 0 0]';

UB=[50 50]';

**[X ff]=quadprog(H,f,A,b,Aeq,beq,LB,UB)**

Solution

X =

11.0000

9.0000

ff is the objective function value

ff = 379.0000

## 4 comments:

Wow! Finally I got a web site from where I be capable of genuinely take valuable data

concerning my study and knowledge.

Here is my web blog - review of provillus

I'm amazed, I have to admit. Rarely do I encounter a blog that's

both educative and engaging, and let me tell you, you've hit the nail on the head. The issue is an issue that not enough folks are speaking intelligently about. I'm very happy that I stumbled across this in my search for something relating to this.

Feel free to visit my webpage :: clips.bakbanaan.net

Great post.

my web blog ... http://phen375reviews-online.blogspot.com/

Hello everyone, it's my first visit at this web page, and article is genuinely fruitful for me, keep up posting such content.

Have a look at my web page ... zetaclear reviews

## Post a Comment