The control parameters of MILP

2 次查看(过去 30 天)
What are the values of the control parameters of the MILP: The applied algorithm ? The tolerances? The stopping criteria? Others...
%% Input data.
P1=1; P2=2; P3=3; P4=1.5;
L1=2; L2=4; L3=3; L4=3;
E1=3; E2=6; E3=5; E4=6;
P=[P1 P1 P1 P1; P2 P2 P2 P2; P3 P3 P3 P3; P4 P4 P4 P4];
%% Write the objective function vector.
f= P(:)';
%% Write the linear inequality constraints.
A=zeros(length(P),numel(P));
itr=0;
for w=1:length(P):numel(P)
h= zeros(1,numel(P));
h(w:w+length(P)-1)= f(w:w+length(P)-1);
itr=itr+1;
A(itr,:)=h;
end
b=[E1;E2;E3;E4];
%% Write the linear equality constraints.
beq=[L1 L2 L3 L4];
Aeq= zeros(length(beq),numel(P));
for i=1:length(beq)
Q= zeros(length(beq),length(P));
Q(i,:)=P(i,:);
q= Q(:)';
Aeq(i,:)=q;
end
%% Write the bound constraints.
lb = zeros(numel(P),1);
ub = ones(numel(P),1);
intcon=1;intcon=2;intcon=3;intcon=4;intcon=5;intcon=6;intcon=7;intcon=8;intcon=9;intcon=10;intcon=11;intcon=12;intcon=13;intcon=14;intcon=15;intcon=16;
%% Call intlinprog.
x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub);
LP: Optimal objective value is 12.000000. Optimal solution found. Intlinprog stopped at the root node because the objective value is within a gap tolerance of the optimal value, options.AbsoluteGapTolerance = 0 (the default value). The intcon variables are integer within tolerance, options.IntegerTolerance = 1e-05 (the default value).
%% Generat results in form of Matrix
S =reshape(x,length(beq),length(P));
%% Generat results in from of Figure
M=S.*P;
figure (1)
title ('energy consumption ')
stairs(M(1,:))
hold on
stairs(M(2,:))
hold on
stairs(M(3,:))
hold on
stairs(M(4,:))
xlabel('Time','FontSize',16)
ylabel('Power (kW)','FontSize',16)
legend({'A1','A2','A3','A4'})

采纳的回答

Torsten
Torsten 2023-1-9
  4 个评论
Imanitxka imane
Imanitxka imane 2023-1-10
Yes i found LPMaxIterations and RootLPMaxIterations in the link. My question is how can i get this values from the above code ??
Torsten
Torsten 2023-1-10
编辑:Torsten 2023-1-10
I don't understand.
The last column of the options-table under
tells you the default values set in intlinprog for the two parameters.
Or simply use
options = optimoptions('intlinprog')
options =
intlinprog options: Set properties: No options set. Default properties: AbsoluteGapTolerance: 0 BranchRule: 'reliability' ConstraintTolerance: 1.0000e-04 CutGeneration: 'basic' CutMaxIterations: 10 Display: 'iter' Heuristics: 'basic' HeuristicsMaxNodes: 50 IntegerPreprocess: 'basic' IntegerTolerance: 1.0000e-05 LPMaxIterations: 'max(30000,10*(numberOfEqualities+numberOfInequalities+numberOfVariables))' LPOptimalityTolerance: 1.0000e-07 MaxFeasiblePoints: Inf MaxNodes: 10000000 MaxTime: 7200 NodeSelection: 'simplebestproj' ObjectiveCutOff: Inf ObjectiveImprovementThreshold: 0 OutputFcn: [] PlotFcn: [] RelativeGapTolerance: 1.0000e-04 RootLPAlgorithm: 'dual-simplex' RootLPMaxIterations: 'max(30000,10*(numberOfEqualities+numberOfInequalities+numberOfVariables))'

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by