For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > Optimization Question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Optimization Question
Jason Jett

2005-04-25, 4:02 pm

I am new to setting up optimization problems in Matlab. I need to
Maximize a function (i know I can multiply by -1 to turn linprog into
a maximization).
Following is my problem. I believe i should use linprog. Also the
trouble I have is how to handle the bounded constraints labled A,B,C:
maximize:
f(x) = 3.5 x1 + 8.5 x2 + 8 x3
subject to constraints:
A -100 <= -40 +0.4 X1 - 0.4 X2 + .20 X3 <= 100
B -125 <= 40 -0.4 X1 + 0.4 X2 + .8 X3 <= 125
C -90 <= 60 -.6X1 X1 + .6 X2 + .2 X3 <=90

0 <= X1 <=50
0 <= X2 <=75
0 <= X3 <=125

Any help in the setup would be appreciated
Marcelo Marazzi

2005-04-25, 8:59 pm

Your range constraints are of the form

b1 <= A*x <= b

Now, you can pass A*x<=b directly to linprog
as inequalities.

As to b1 <= A*x, it's equivalent to

A*x + s = b1 (1)
s >= 0 (2)

where "s" is a 3-by-1 vector of slack variables.
The constraint (1) is passed as an equality,
and (2) as a bound on the s variables.

-marcelo


Jason Jett wrote:
> I am new to setting up optimization problems in Matlab. I need to
> Maximize a function (i know I can multiply by -1 to turn linprog into
> a maximization).
> Following is my problem. I believe i should use linprog. Also the
> trouble I have is how to handle the bounded constraints labled A,B,C:
> maximize:
> f(x) = 3.5 x1 + 8.5 x2 + 8 x3
> subject to constraints:
> A -100 <= -40 +0.4 X1 - 0.4 X2 + .20 X3 <= 100
> B -125 <= 40 -0.4 X1 + 0.4 X2 + .8 X3 <= 125
> C -90 <= 60 -.6X1 X1 + .6 X2 + .2 X3 <=90
>
> 0 <= X1 <=50
> 0 <= X2 <=75
> 0 <= X3 <=125
>
> Any help in the setup would be appreciated

Marcus M. Edvall

2005-04-25, 8:59 pm

Hi Jason,

TOMLAB by default supports double-sided linear constraints. See 'help
lpAssign'.

Best wishes, Marcus
Tomlab Optimization Inc.
<http://tomlab.biz>

Jason Jett wrote:
>
>
> I am new to setting up optimization problems in Matlab. I need to
> Maximize a function (i know I can multiply by -1 to turn linprog
> into
> a maximization).
> Following is my problem. I believe i should use linprog. Also the
> trouble I have is how to handle the bounded constraints labled
> A,B,C:
> maximize:
> f(x) = 3.5 x1 + 8.5 x2 + 8 x3
> subject to constraints:
> A -100 <= -40 +0.4 X1 - 0.4 X2 + .20 X3 <= 100
> B -125 <= 40 -0.4 X1 + 0.4 X2 + .8 X3 <= 125
> C -90 <= 60 -.6X1 X1 + .6 X2 + .2 X3 <=90
>
> 0 <= X1 <=50
> 0 <= X2 <=75
> 0 <= X3 <=125
>
> Any help in the setup would be appreciated

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com