You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the number of non-linear constraints is bigger than (2nb + 2nl) an error is shown on the command window:
We made up a case with two buses and one line, just to check the performance of the an optimization problem with a lot of non-linear constraints and we got the error message. As it's show in the command window, the optimization problem was already solved, so the problem was easily correct. We add few lines into the function ipoptopf_solver and it seems to work fine for the cases we have tried:
This is the environment we're using:
The following example is a simple test that we created to reproduce the error, we used the matpower case9 to prove the error, but if a bigger case is used there won't be any problem.
clc,clear
mpc = loadcase(case9);
mp = mpoption;
mp.opf.ac.solver = 'IPOPT';
mpc = add_userfcn(mpc, 'ext2int', @userfcn_error_ext2int);
mpc = add_userfcn(mpc, 'formulation', @userfcn_error_formulation);
res = runopf(mpc,mp);
function mpc = userfcn_error_ext2int(mpc, mpopt, args)
% Not use for the example
end
function om = userfcn_error_formulation(om, mpopt, args)
n = 20; % number of non-linear constraints
%% x
x0 = ones(n,1);
xmin = 2*ones(n,1);
% xmax =
%% y
y0 = zeros(n,1);
ymin = y0;
% ymax =
%% variables
om.add_var('X',n,x0,xmin,[]);
om.add_var('Y',n,y0,ymin,[]);
%% constraints
fcn = @(x)f_fcn(x);
hess = @(x, lambda)f_hess(x, lambda);
om.add_nln_constraint('xy', n, 'true', fcn, hess, {'X','Y'}); % x_i = (y_i)^2
end
%% -------------- Jacobian and Hessian for equations --------------
function [g, dg] = f_fcn(x)
[x, y] = deal(x{:});
n = length(x);
if nargout == 1
g = x - y.^2;
else
g = x - y.^2;
m1 = eye(n);
m2 = - 2*diag(y);
dg = [m1 m2];
end
end
function d2H = f_hess(x, lambda)
[X, Y] = deal(x{:});
n = length(X);
m0 = zeros(n);
m1 = -2*eye(n);
d2H = [ m0 m0;
m0 m1];
end
I hope everything is clear.
Sergio.
The text was updated successfully, but these errors were encountered:
rdzman
changed the title
Problem related with fcn ipoptopf_solver
sometimes fatal indexing error in OPF with additional nonlinear constraints
Aug 16, 2019
Thanks, @Segama, for bringing this to our attention. The fix was slightly different from what you proposed and was needed for the other OPF solvers as well as IPOPT.
When the number of non-linear constraints is bigger than (2nb + 2nl) an error is shown on the command window:
We made up a case with two buses and one line, just to check the performance of the an optimization problem with a lot of non-linear constraints and we got the error message. As it's show in the command window, the optimization problem was already solved, so the problem was easily correct. We add few lines into the function ipoptopf_solver and it seems to work fine for the cases we have tried:
This is the environment we're using:
The following example is a simple test that we created to reproduce the error, we used the matpower case9 to prove the error, but if a bigger case is used there won't be any problem.
I hope everything is clear.
Sergio.
The text was updated successfully, but these errors were encountered: