How can I solve optimization problem without using Symbolic Math Toolbox?

13 ビュー (過去 30 日間)
Monri
Monri 2017 年 11 月 22 日
回答済み: John D'Errico 2017 年 11 月 22 日
Is it possible to solve this optimization problem without using Symbolic Math Toolbox??
Thank you.

採用された回答

Alan Weiss
Alan Weiss 2017 年 11 月 22 日
編集済み: Alan Weiss 2017 年 11 月 22 日
Sure, you can use Optimization Toolbox. You also need the constraint that all the q_i are nonnegative, otherwise the problem is unbounded.
The most straightforward way is to use fmincon. Let
fn = @(q)(1 + 0.15*(q/4000).^4);
fun1 = @(q)integral(@(x)(30/100)*fn(x),0,q);
fun2 = @(q)integral(@(x)(25/100)*fn(x),0,q);
fn2 = @(q)(1 + 0.15*(q/6000).^4);
fun3 = @(q)integral(@(x)(30/100)*fn2(x),0,q);
fun = @(x)(fun1(x(1)) + fun2(x(2)) + fun3(x(3)));
Aeq = [1,1,1];
beq = 14000;
x0 = 14000/3*Aeq;
lb = [0,0,0]);
z = fmincon(fun,x0,[],[],Aeq,beq,lb)
Sorry if I got some details wrong, I am not sure that I was able to read the problem correctly (small lettering on my screen).
Alan Weiss
MATLAB mathematical toolbox documentation

その他の回答 (2 件)

John D'Errico
John D'Errico 2017 年 11 月 22 日
Is this your homework? If so, then you need to be doing your homework. If not, then you need to use common sense.
Why not do most of the work by pencil and paper?
Each of those integrals is trivial. The first, integral for example:
30/100*(1+0.15*(q/4000)^4)
The integral is high school calc.
3/10*q + 3/10*3/20*q^5/5*/(4000)^4
With limits of 0 & q1, we get
q1^5*9/2.56e17 + q1*3/10
The other two are quite similar, yielding 5th degree polynomials in q2 and q3. Thus...
q2^5*3/1.024e17 + q2/4
q3^5/1.44e17 + q3*3/10
So you wish to solve the minimization problem
q1^5*9/2.56e17 + q1*3/10 + q2^5*3/1.024e17 + q2/4 + q3^5/1.44e17 + q3*3/10
Subject to the linear constraint:
q1 + q2 + q3 = 14000
So, first, consider that there is no minimum, if these variables can go to -inf. That should be obvious, even with the equality constraint. So assume they are constrained to be non-negative.
The simple answer is to just use fmincon now. But you could also formulate it in terms of a Lagrange multiplier. Either way will work. A good starting guess should be easy, because the solution will surely be close to q1=q2=q3.
Using fmincon, the solution is easily found as:
3657.5656004969 4856.08772111945 5486.34667838365
NO. I'm not going to do it for you, since this easily could be homework.

Walter Roberson
Walter Roberson 2017 年 11 月 22 日
Reduce it by one variable by making the substitution q3 = 14000-q1-q2
Now each of the terms can be integrated independently of the others. Each of them is a simple quartic that can be easily integrated in formula by inspection; then substitute the endpoints. You get a 5th order multinomial in two variables out.
Now you can use any of the minimization techniques, such as fminsearch() or fminunc(). Or you could inspect it and see that it has two terms of the form
positiveconstant * q1^5 + positiveconstant * q2^5
and if you think for a moment you will come up with the point at which the expression will be minimized: q1 = q2 = q3 = -infinity

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!