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 Commenti

Would it be possible for you to provide a reproduction example? This helps answering this kind of questions a lot.
Sorry, what do you mean by a reproduction example?

Accedi per commentare.

Risposte (2)

>>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

Okay, I'm receiving the following error:
Index exceeds matrix dimensions.
Error in heuett_simple (line 2)
f = J_ext(4) + dot(delta_mu)/2;
Error in fmincon (line 635)
initVals.f = feval(funfcn{3},X,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON cannot continue.
I suppose that this is because I am supplying an element of a vector in the objective function -- J_ext(4). Any advice for optimization with vectors?
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.
Matt J
Matt J il 16 Set 2014
Modificato: Matt J il 16 Set 2014
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.
Sam
Sam il 16 Set 2014
Modificato: Sam il 16 Set 2014
Hi Matt,
I did use dbstop, and as I result I realized that there was a problem with my supplied objective function (there is no J_ext in the workspace after running the code), so I'll try your suggestion below to feed the unknowns as a single variable.

Accedi per commentare.

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

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.

Accedi per commentare.

Categorie

Richiesto:

Sam
il 16 Set 2014

Modificato:

Sam
il 16 Set 2014

Community Treasure Hunt

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

Start Hunting!

Translated by