Filter löschen
Filter löschen

fixiing a component of input vector in fmincon

4 Ansichten (letzte 30 Tage)
Saber
Saber am 11 Mär. 2015
Kommentiert: Saber am 12 Mär. 2015
Hi all,
I am using fmincon to optimize a nonlinear program as:
fun = @(x)obj_fun(x);
[w,fval] = fmincon(fun,w0,[],[],[],[],lb,ub,[],options);
I would like to know if there is possible to fix a component of x ?
let's assume x is in R^4 and the third component is fixed to 1. something like this:
x = (x1,x2,1,x3,x4)

Akzeptierte Antwort

Brendan Hamm
Brendan Hamm am 11 Mär. 2015
There are multiple options for this (one is to simply fix it within your objective function). The other is to use your equality constraint of the form Aeq*x=beq. Set:
Aeq = [0 0 1 0 0];
beq = 1;
[w,fval] = fmincon(fun,w0,[],[],Aeq,beq,lb,ub,[],options);
The actual constraints are allowed to be violated within a specified tolerance. See the options for fmincon if you would like to control the tolerance.
  1 Kommentar
Saber
Saber am 12 Mär. 2015
Thanks a lot for the answer. This is exactly what I was looking for.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by