The control parameters of MILP
1 view (last 30 days)
Show older comments
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);
%% 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'})
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Robotics System Toolbox 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!