jiao
Lv 4
jiao asked in 電腦與網際網路軟體 · 1 decade ago

MATLAB的最佳化(linprog,quadprog)問題

我現在在學最佳化設計須要用到matlab求最小值請問 linprog 跟

quadprog 的正確用法.

還有請問

min f(x)=10*d1+10*d2+0.5*(d1^2+d2^2)

constraint function

-24000*d1- 48000*d2<=-239990

-225*d1-225*d2<=-2248

-2*d1+d2<=10

0<=d1<=990

0<=d2<=990

求d1 , d2的最小值,要用那一種matlab最佳化方法解比較好.

會感激不盡

Update:

我在跑下列程式時會出現(Warning: Large-scale method does not currently solve this problem formulation, using medium-scale method instead.),要如何解決.

1 Answer

Rating
  • dtsien
    Lv 6
    1 decade ago
    Best Answer

    f(x) is nonlinear 要用 quadprog ----

    H = [1 0; 0 1]

    f = [10; 10]

    A = [-24000 -48000; -225 -225; -2 1]

    b = [-239990; -2248; 10]

    lb = zeros(2,1)

    ub = [10; 10]

    % Next, invoke a quadratic programming routine.

    [x,fval,exitflag,output,lambda] = quadprog(H,f,A,b,[],[],lb,ub)

    H =

    1 0

    0 1

    f =

    10

    10

    A =

    -24000 -48000

    -225 -225

    -2 1

    b =

    -239990

    -2248

    10

    lb =

    0

    0

    ub =

    10

    10

    Optimization terminated successfully.

    x =

    4.9956

    4.9956

    fval =

    124.8667

    exitflag =

    1

    output =

    iterations: 2

    algorithm: 'medium-scale: active-set'

    firstorderopt: []

    cgiterations: []

    lambda =

    lower: [2x1 double]

    upper: [2x1 double]

    eqlin: [0x1 double]

    ineqlin: [3x1 double]

Still have questions? Get your answers by asking now.