Nonlinear constrained vector optimization using Optimization Toolbox
Mostra commenti meno recenti
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 Commenti
Ingrid Tigges
il 16 Set 2014
Would it be possible for you to provide a reproduction example? This helps answering this kind of questions a lot.
Sam
il 16 Set 2014
Risposte (2)
Sean de Wolski
il 16 Set 2014
>>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 Commenti
Sam
il 16 Set 2014
Adam Cutbill
il 16 Set 2014
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
il 16 Set 2014
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 Commento
Matt J
il 16 Set 2014
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.
Categorie
Scopri di più su Solver-Based Optimization Problem Setup in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!