I keep getting "An unexpected error has occurred: Index exceeds array bounds." error message
Show older comments
I am now trying to build up a benders decomposition.
However, it seems like the converging process cannot go on because I have an error while building up constraints for master problem.
When I try to look at the master problem's constraint, instead of the list of constraints(in a form of LMI), I only see "An unexpected error has occurred: Index exceeds array bounds"
However, there is no problem with debugging the file,(the problem is that the iteration goes on continuously because the convergence cannot take place. For the second iteration, I add the first benders cut to master problem by adding it to constraint like,
function [rhat, chat, uhat, alpha, objmp, lowerB, conm, solmp] = Masterproblem(iter,NN,Ab,Icost, Rcost, Ccost,Budget, r_save,c_save,subprob_save, lambda_save, mu_save)
%define parameters
R_max = 1000;
R_min = 50;
C_max = 3000;
C_min = 100;
%%define variable
u=binvar(NN,1);
r=sdpvar(NN,1,'full');
c=sdpvar(NN,1,'full');
alpha=sdpvar(1,1,'full');
bd=iter-1;
%benders cut update
bdcut=[];
for k=1:bd
bdcut=[bdcut, subprob_save(1,bd)+lambda_save(:,bd)'.*(1e3/3/Ab)*(r-r_save(:,bd))+mu_save(:,bd)'.*(1e3/3/Ab)*(c-c_save(:,bd))<=alpha];
end
%constraint
conm = [];
conm = [conm, Icost*sum(u)+Rcost*sum(r)+Ccost*sum(c)<=Budget];
conm = [conm, r<=R_max*u, r>=R_min*u];
conm = [conm, c<=C_max*u, c>=C_min*u];
conm = [conm, alpha>=-10000];
conm = [conm, bdcut];
options=sdpsettings('solver','gurobi', 'gurobi.Presolve',2,'gurobi.NumericFocus',3,'gurobi.MIPGap',1e-5,'gurobi.MIPGapAbs',1e-5,'gurobi.BarConvTol',1e-6,'gurobi.BarQCPConvTol',1e-6,'gurobi.FeasibilityTol',1e-5,'gurobi.IntFeasTol',1e-6,'gurobi.OptimalityTol',1e-8,'gurobi.Method',2,'gurobi.NodefileStart',0.7);
%'gurobi.MIPFocus',1,'gurobi.MIQCPMethod',0);
objective = Icost*sum(u)+Rcost*sum(r)+Ccost*sum(c) + alpha;
solmp=solvesdp(conm, objective, options); %options***
I also tried to switch the constraint below
bdcut=[bdcut, subprob_save(1,bd)+lambda_save(:,bd)'.*(1e3/3/Ab)*(r-r_save(:,bd))+mu_save(:,bd)'.*(1e3/3/Ab)*(c-c_save(:,bd))<=alpha];
into equation with numerical values like,
bdcut=[bdcut, 2607+[0, 22003, 43893, 61445]*r]<=alpha]; %(using the value I attained before confronting the troubled constraint)
However, it did not work, as well.
When I try to look at 'conm', the error message comes up. On the other hand, when I look at if the master problem has been solved or not, What I see is "Successfully solved(GUROBI-GUROBI)"
So, because I cannot find the constraint list, I am not even sure if the problem has been solved actually or not
Also, I am having same benders cut for every iteration, which makes no progress on searching for a right solution.
Please give me a clue what kind of problem this is!!!
Answers (0)
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!