Failure in initial objective function evaluation. FMINCON cannot continue.

Hi Everyone,
I have been trying to get this minimization problem to work and I keep getting this same error message: "Failure in initial objective function evaluation. FMINCON cannot continue."
Now I have the following definitions:
%
v = [power_i; load_i; theta_i; theta_j];
v0 = [power_r; load_r; theta_ir; theta_jr; cost_r];
options = optimoptions(@fmincon,'Algorithm','sqp');
[power_i, load_i, theta_i, theta_j, fval, exitflag, output] = fmincon(@objfun,v0,A,b,Aeq,beq,[], [], @confuneq, options);
With the associated objective:
function f = objfun(v, cost_r)
f = sum((cost_r.')*power_i) - sum(load_i) + (theta_i - theta_j);
end
and constraints:
%
function [c, ceq] = confuneq(power_i, load_i, theta_i, theta_j, F_max, F_min, F_j,z, Gs, phi, p_k, p_max, p_min)
% Inequality contraints
c = [sum(power_i - load_i) - F_max;
theta_i - theta_j - (pi./3);
theta_j - theta_i - (pi./3);
p_min - power_i;
power_i - p_max;
(power_i - load_i) - F_max;
(load_i - power_i) - F_min];
% Equality contraints
ceq = [(power_i - load_i) + (z.*theta_j) - (z.*theta_i) + (z.*phi);
p_k - sum(power_i - load_i) + sum(F_j) - load_i - Gs];
end
Could anybody help point me in the right direction? Thanks!

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 8 月 18 日
fmincon calls the given function with one argument, the vector of values to be evaluated. You have
function f = objfun(v, cost_r)
so your function expects two arguments.
You probably need
[power_i, load_i, theta_i, theta_j, fval, exitflag, output] = fmincon(@(v) objfun(v, cost_r), v0, A, b, Aeq, beq, [], [], @confuneq, options);

カテゴリ

質問済み:

2017 年 8 月 18 日

回答済み:

2017 年 8 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by