Nonlinear constrained vector optimization using Optimization Toolbox
이전 댓글 표시
I am attempting to reproduce a nonlinear constrained vector optimization result obtained in Heuett/Qian (2006) using the fmincon solver's SQP algorithm in the Optimization Toolbox.
The general optimization problem is given by

and the specific objective function of interest in this case is given by

where J, J+ , J-, Jext, and delta_mu are all vectors, Jext_D is an element of vector Jext, and S and K^T are matrices supplied by the nature of the system in question.
I have coded the objective function in heuett_simple.m:
function f = heuett_simple(J_ext, delta_mu)
f = J_ext(4) + dot(delta_mu)/2;
end
since Jext_D will be the fourth element of the vector J_ext
and the constraints in heuett_constraints.m:
function [c, ceq] = heuett_constraints(J, J_plus, J_minus, J_ext, delta_mu)
model = sbmlimport('heuett_simple.xml');
S = getstoichmatrix(model);
S = full(S);
K = [-0.7163, -0.3345;
-0.3205, -0.4347;
0.4710, -0.6349;
-0.3958, 0.1001;
-0.0752, 0.5348];
c = [];
ceq(1) = S*J + J_ext;
ceq(2) = transpose(K)*delta_mu;
ceq(3) = diag(exp(delta_mu))*J_plus - J_minus;
ceq(4) = J - J_plus + J_minus;
end
The specifications of model, S, and K are specific to the problem I am working on. S is a 4x5 matrix of type double. When I execute this problem using the Toolbox with the following setup (without bounds for the time being)

I receive the error
Index exceeds matrix dimensions.
Any idea what is causing my problem?
댓글 수: 2
Ingrid Tigges
2014년 9월 16일
Would it be possible for you to provide a reproduction example? This helps answering this kind of questions a lot.
Sam
2014년 9월 16일
답변 (2개)
Sean de Wolski
2014년 9월 16일
>>dbstop if error
Then run the code. This will stop on the line throwing the error and you can look at the index v. the size of your matrix and see what's happening.
댓글 수: 4
Sam
2014년 9월 16일
Adam Cutbill
2014년 9월 16일
Can't you specific advice without recreating your inputs. My advice would be to put a breakpoint in your objfun and confun and make sure all the inputs are as you expect. Go from there.
I suppose that this is because I am supplying an element of a vector in the objective function -- J_ext(4).
@Sam,
You still haven't followed Sean's advice about using dbstop. Had you done so, there would be nothing to "suppose". The program would pause at line 2 in heuett_simple() and you could show us directly what J_ext contains.
Matt J
2014년 9월 16일
One of the errors you have is that you are feeding the unknowns to the objective function and constraints in multiple input arguments, e.g.,
function f = heuett_simple(J_ext, delta_mu)
f = J_ext(4) + dot(delta_mu)/2;
end
All the unknowns must be fed in as a a single variable, like in the following
function f = heuett_simple(unknowns)
J_ext=unknowns(1:N);
delta_mu=unknowns(N+1:end);
f = J_ext(4) + dot(delta_mu)/2;
end
and similarly with your constraints.
댓글 수: 1
Matt J
2014년 9월 16일
Another error is that you have selected an initial point [0,0] consisting of only 2 elements, when you apparently have considerably more than 2 unknowns.
카테고리
도움말 센터 및 File Exchange에서 Solver-Based Optimization Problem Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!