Error during MILP using function INTLINPROG
이전 댓글 표시
When I run a program using function INTLINPROG, it appear the following words: " INTLINPROG encountered an internal error that caused the solution to lose integer and/or linear constraint feasibility. We are sorry for the inconvenience. Please contact technical support for assistance with your problem, quoting the code "-2_4". " What is the problem?
댓글 수: 3
Walter Roberson
2016년 7월 5일
Can you post your code (and data) so we can test?
Huy Nguyen
2019년 3월 18일
Can you help me? this is my code. I made the same mistake.
tic;
clc;
clear all;
close all;
%% Thong so cua bai toan
Ppvf = xlsread('datamoi','A2:A25');
Pwtf = xlsread('datamoi','B2:B25');
Pl = xlsread('datamoi','C2:C25');
Price = xlsread('price');
Ppvmax = 1.1*Ppvf; Ppvmin = 0.9*Ppvf;
Pwtmax = 1.1*Pwtf; Pwtmin = 0.9*Pwtf;
Cgs = Price(:,1)'; %%Gia ban dien cho luoi
Cgb = Price(:,2)'; %%Gia mua dien tu luoi
Cpv = Price(:,3)'; %%Chi phi cua nang luong mat troi
Cwt = Price(:,4)'; %%Chi phi cua nang luong gio
Cch = Price(:,5)'; %%Chi phi sac pin
Cdis = Price(:,6)'; %%Chi phi xa pin
Pch_max = 4; Pdis_max = 4; Pgb_max = 2; Pgs_max = 10^9;
Emax = 5; Emin = 1; E1 = 2.5; E25 = 2.5;
nch = 0.95; ndis = 0.95; delta_t = 1; s = 0.0000;
M = 10^9;
%% Xac dinh UB, LB, Aeq, beq, Aineq, bineq
f1 = [-Cpv -Cwt -Cch -Cdis -Cgb Cgs];
f2 = zeros(1,527);
f = [f1 f2];
intcon = 168:215;
intcon = 408:671;
LB = [Ppvmin.*ones(24,1); Pwtmin.*ones(24,1); zeros(24,1); zeros(24,1); zeros(24,1); zeros(24,1); ones(23,1)*Emin; zeros(48,1); -Inf*ones(96,1); -Inf*ones(24,1); zeros(24,1); -Inf*ones(24,1); -Inf*ones(24,1); zeros(264,1)];
UB = [Ppvmax.*ones(24,1); Pwtmax.*ones(24,1); ones(24,1)*Pch_max; ones(24,1)*Pdis_max; ones(24,1)*Pgb_max; ones(24,1)*Pgs_max; ones(23,1)*Emax; ones(48,1); zeros(96,1); Inf*ones(24,1); Inf*ones(24,1); zeros(24,1); Inf*ones(24,1); ones(264,1)];
%% Cac rang buoc bat dang thuc
%% Rang buoc bat dang thuc ban dau
Aineq1_1 = zeros(24,671);
Aineq1_1(:,97:120)= eye(24);
Aineq1_1(:,168:191)= -Pgb_max*eye(24);
%% ------------------------------------------------------------------------
Aineq1_2 = zeros(24,671);
Aineq1_2(:,121:144)= eye(24);
Aineq1_2(:,168:191)= Pgs_max*eye(24);
%% ------------------------------------------------------------------------
Aineq1_3 = zeros(24,671);
Aineq1_3(:,49:72)= eye(24);
Aineq1_3(:,192:215)= -Pch_max*eye(24);
%% ------------------------------------------------------------------------
Aineq1_4 = zeros(24,671);
Aineq1_4(:,73:96) = eye(24);
Aineq1_4(:,192:215)= Pdis_max*eye(24);
%% ------------------------------------------------------------------------
Aineq1_5 = zeros(23,671);
Aineq1_5(:,145:167)= -eye(23);
%% ------------------------------------------------------------------------
Aineq1_6 = zeros(23,671);
Aineq1_6(:,145:167)= eye(23);
%% ------------------------------------------------------------------------
%% hihi
Aineq1 = [Aineq1_1; Aineq1_2; Aineq1_3; Aineq1_2; Aineq1_5; Aineq1_6];
%% ------------------------------------------------------------------------
%% Rang buoc bien doi ngau
%% ------------------------------------------------------------------------
Aineq2_1 = zeros(24,671);
Aineq2_1(:,216:239)= eye(24);
Aineq2_1(:,312:335)= eye(24);
%% ------------------------------------------------------------------------
Aineq2_2 = zeros(24,671);
Aineq2_2(:,240:263)= eye(24);
Aineq2_2(:,312:335)= -eye(24);
%% ------------------------------------------------------------------------
Aineq2_3 = zeros(24,671);
Aineq2_3(:,264:287)= eye(24);
Aineq2_3(:,312:335)= -eye(24);
Aineq2_3(:,384:407)= -nch*eye(24);
%% ------------------------------------------------------------------------
Aineq2_4 = zeros(24,671);
Aineq2_4(:,288:311)= eye(24);
Aineq2_4(:,312:335)= eye(24);
Aineq2_4(:,384:407)= (1/ndis)*eye(24);
%% ------------------------------------------------------------------------
Aineq2_5 = zeros(24,671);
Aineq2_5(:,336:359)= eye(24);
Aineq2_5(:,360:383)= eye(24);
Aineq2_5(:,384:407)= -eye(24);
%% ------------------------------------------------------------------------
%% hihi
Aineq2 = [Aineq2_1; Aineq2_2; Aineq2_3; Aineq2_4; Aineq2_5]; %% Rang buoc bien doi ngau
%% ------------------------------------------------------------------------
Aineq3_1 = zeros(24,671);
Aineq3_1(:,216:239)= -eye(24);
Aineq3_1(:,408:431)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_2 = zeros(24,671);
Aineq3_2(:,97:120)= -eye(24);
Aineq3_2(:,168:191)= Pgb_max*eye(24);
Aineq3_2(:,408:431)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_3 = zeros(24,671);
Aineq3_3(:,240:263)= -eye(24);
Aineq3_3(:,432:455)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_4 = zeros(24,671);
Aineq3_4(:,121:144)= -eye(24);
Aineq3_4(:,168:191)= -Pgs_max*eye(24);
Aineq3_4(:,432:455)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_5 = zeros(24,671);
Aineq3_5(:,264:287)= -eye(24);
Aineq3_5(:,456:479)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_6 = zeros(24,671);
Aineq3_6(:,49:72)= -eye(24);
Aineq3_6(:,192:215)= Pch_max*eye(24);
Aineq3_6(:,456:479)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_7 = zeros(24,671);
Aineq3_7(:,288:311)= -eye(24);
Aineq3_7(:,480:503)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_8 = zeros(24,671);
Aineq3_8(:,73:96)= -eye(24);
Aineq3_8(:,192:215)= -Pdis_max*eye(24);
Aineq3_8(:,480:503)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_9 = zeros(24,671);
Aineq3_9(:,336:359)= -eye(24);
Aineq3_9(:,504:527)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_10 = zeros(24,671);
I = [zeros(1,23); -eye(23)];
Aineq3_10(:,145:167)= I;
Aineq3_10(:,504:527)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_11 = zeros(24,671);
Aineq3_11(:,360:383)= -eye(24);
Aineq3_11(:,528:551)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_12 = zeros(24,671);
I = [zeros(1,23); -eye(23)];
Aineq3_12(:,145:167)= I;
Aineq3_12(:,528:551)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_13 = zeros(24,671);
Aineq3_13(:,97:120)= -eye(24);
Aineq3_13(:,552:575)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_14 = zeros(24,671);
Aineq3_14(:,216:239)= -eye(24);
Aineq3_14(:,312:335)= -eye(24);
Aineq3_14(:,552:575)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_15 = zeros(24,671);
Aineq3_15(:,121:144)= -eye(24);
Aineq3_15(:,576:599)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_16 = zeros(24,671);
Aineq3_16(:,240:263)= -eye(24);
Aineq3_16(:,312:335)= eye(24);
Aineq3_16(:,576:599)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_17 = zeros(24,671);
Aineq3_17(:,49:72)= -eye(24);
Aineq3_17(:,600:623)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_18 = zeros(24,671);
Aineq3_18(:,264:287)= -eye(24);
Aineq3_18(:,312:335)= eye(24);
Aineq3_18(:,384:407)= nch*eye(24);
Aineq3_18(:,600:623)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_19 = zeros(24,671);
Aineq3_19(:,73:96)= -eye(24);
Aineq3_19(:,624:647)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_20 = zeros(24,671);
Aineq3_20(:,288:311)= -eye(24);
Aineq3_20(:,312:335)= -eye(24);
Aineq3_20(:,624:647)= -M*eye(24);
Aineq3_20(:,384:407)= -(1/ndis)*eye(24);
%% ------------------------------------------------------------------------
Aineq3_21 = zeros(24,671);
I = [zeros(1,23); -eye(23)];
Aineq3_21(:,145:167)= I;
Aineq3_21(:,648:671)= M*eye(24);
%% ------------------------------------------------------------------------
Aineq3_22 = zeros(24,671);
Aineq3_22(:,336:359)= -eye(24);
Aineq3_22(:,360:383)= -eye(24);
Aineq3_22(:,384:407)= eye(24);
Aineq3_22(:,648:671)= -M*eye(24);
%% ------------------------------------------------------------------------
Aineq3A = [Aineq3_1;Aineq3_2;Aineq3_3;Aineq3_4;Aineq3_5;Aineq3_6;Aineq3_7;Aineq3_8;Aineq3_9;Aineq3_10;Aineq3_11];
Aineq3B = [Aineq3_12;Aineq3_13;Aineq3_14;Aineq3_15;Aineq3_16;Aineq3_17;Aineq3_18;Aineq3_19;Aineq3_20;Aineq3_21;Aineq3_22];
Aineq3 = [Aineq3A; Aineq3B];
%% hihi
Aineq = [Aineq1; Aineq2; Aineq3]; %% Rang buoc bat dang thuc
%% ---------------------
bineq1 = [zeros(24,1); Pgs_max*ones(24,1); zeros(24,1); Pdis_max*ones(24,1); -Emin*ones(23,1); Emax*ones(23,1)];
Cch = Cch';Cdis=Cdis';Cgb=Cgb';Cgs=Cgs';Cpv=Cpv';Cwt=Cwt';
bineq2 = [Cgb.*ones(24,1); -Cgs.*ones(24,1); Cch.*ones(24,1); Cdis.*ones(24,1); zeros(24,1)];
bineq3A = [M*ones(24,1); zeros(24,1); M*ones(24,1); -Pgs_max*ones(24,1); M*ones(24,1); zeros(24,1); M*ones(24,1); -Pdis_max*ones(24,1); M*ones(24,1); E1 - Emin; -Emin*ones(23,1) ; M*ones(24,1)];
bineq3B = [E1 - Emax; -Emax*ones(23,1) ; M*ones(24,1); -Cgb.*ones(24,1); M*ones(24,1); Cgs.*ones(24,1); M*ones(24,1); -Cch.*ones(24,1); M*ones(24,1); -Cdis.*ones(24,1); M*ones(24,1); zeros(24,1)];
bineq3 = [bineq3A; bineq3B];
bineq = [bineq1; bineq2; bineq3];
%% ------------------------------------------------------------------------
%% Rang buoc dang thuc
Aeq1 = zeros(24,671);
Aeq1(:,1:24) = eye(24);
Aeq1(:,25:48) = eye(24);
Aeq1(:,49:72) = -eye(24);
Aeq1(:,73:96) = eye(24);
Aeq1(:,97:120) = eye(24);
Aeq1(:,121:144) = -eye(24);
%% --------------------------------------
Aeq2 = zeros(24,671);
N = [-(1-s)*eye(22) zeros(22,1)];
P = [zeros(22,1) eye(22)];
Aeq2_1_1 = N + P;
Aeq2_1 = [1 zeros(1,22); Aeq2_1_1; zeros(1,22) -(1-s)];
Aeq2(:,145:167) = Aeq2_1;
Aeq2(:,49:72) = -nch*delta_t*eye(24);
Aeq2(:,73:96) = (1/ndis)*delta_t*eye(24);
%% ---------------------------------------
Aeq = [Aeq1; Aeq2];
beq = [Pl; E1; zeros(22,1); -E25];
%% ------------------------------------------
%% Thuc hien bo giai MILP
%options = optimoptions('intlinprog','Display','off');
[x,fval,exitflag,output] = intlinprog(f,intcon,Aineq,bineq,Aeq,beq,LB,UB);
% x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub,x0,options)
%x = intlinprog(f,intcon,Aineq,bineq,Aeq,beq,LB,UB);
Walter Roberson
2019년 3월 26일
You are probably going to need to contact Support on this, as the routine that needs to be debugged is not available as MATLAB source for me to read.
답변 (2개)
Alan Weiss
2016년 11월 28일
1 개 추천
Sometimes this problem occurs if you set nondefault tolerances. But, without seeing your option settings or function call, I have no other suggestions to offer.
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 6
AAbreu
2017년 1월 16일
I have the same error when I use the R2016a version, but not with the R2014b.
f = [ -52.708430655531288
-48.555170855325855
-38.392142472987473
-22.211336152054230
0
0
0
0
0.500000000000000];
vvars =[5 6 7 8];
A =[1 0 0 0 0 0 0 0 0];
b = 0.606094944786532
Aeq=[1 0 0 0 -2 0 0 0 0
0 1 0 0 0 -2 0 0 0
0 0 1 0 0 0 -2 0 0
0 0 0 1 0 0 0 -2 0];
beq =[0
0
0
0];
lb =[0
0
0
0
0
0
0
0
0];
ub = [2
2
2
2
1
1
1
1
Inf];
[xLinInt,fval,exitFlagInt,output] = intlinprog(f,vvars,A,b,Aeq,beq,lb,ub)
Walter Roberson
2017년 1월 17일
AAbreu, thank you for posting specific code and data. I confirm that what you posted triggers the problem on my system.
Unfortunately the relevant routine that detects the error is pcode'd, so I cannot examine the source to see what it is really checking (and so cannot figure out what the work-around might be.)
I think you are probably going to need to contact Support on this.
AAbreu
2017년 1월 17일
Thank you Walter Roberson. I'm going to contact them.
Bernhard Fäßler
2017년 2월 7일
Hi AAbreu, have you received an answer? I am currently struggling with quiet the same problem (also Matlab R2016a).
christian colombo
2017년 2월 11일
Same error but using linprog instead of intlinprog (Matlab R2016b)
Huy Nguyen
2019년 3월 18일
0 개 추천
When I run a program using function INTLINPROG, it appear the following words: " INTLINPROG encountered an internal error that caused the solution to lose integer and/or linear constraint feasibility. We are sorry for the inconvenience. Please contact technical support for assistance with your problem, quoting the code "-2_4". " What is the problem?
댓글 수: 1
DianChao Lin
2019년 8월 27일
I have the same problem in R2016b. After I tried another version R2019a (with the same code), the problem disappeared.
So my suggestion is: changing the matlab's version.
카테고리
도움말 센터 및 File Exchange에서 Argument Definitions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!