フィルターのクリア

How to solve the following device scheduling problem?

3 ビュー (過去 30 日間)
Paramvir Singh
Paramvir Singh 2018 年 5 月 21 日
コメント済み: Hiba Haider 2023 年 1 月 20 日
I have three devices to be scheduled for a period of 10 intervals. Each device has a max duration limit. Each device has to be operated within a fixed time slot within the total time. Also, there is a minimum up time for each device.
I am getting an infeasible solution with the following code.
clc
clear
powerprob=optimproblem;
E=[3 2 3 5 2 3 5 2 3 2]; % Electricity price
P=[1 2 3 ]; % Rating of devices
D=[3 4 2 ]; % Duration of device per day
V=zeros(10,3); % For starting the device within a desired time interval
TstartM=[2 3 1 ];
TfinishM=[8 8 7 ];
DurationM=[1 1 1];
for jj=1:3
for kk=1:10
if kk<TstartM(jj)
V(kk,jj)=0;
elseif kk>TfinishM(jj)
V(kk,jj)=0;
elseif kk>=TstartM(jj) && kk<=TfinishM(jj)
V(kk,jj)=DurationM(jj);
end
end
end
V
Pgrid=optimvar('Pgrid',10,1,'LowerBound',0,'UpperBound',7);
A=optimvar('A',10,3,'Type','integer','LowerBound',0,'UpperBound',1); % ON/OFF status of devices
Z=A.*V;
HLD=((A.*V)*P'); % Load Data for each interval for all devices combined
gridcost=sum((Pgrid).*E');
powerprob.Objective=gridcost;
powerprob.Constraints.A1=sum(A.*V)==D; % Duration Constraint
% min up time
powerprob.Constraints.D1=optimconstr(10,5);
for jj=1:3
for kk=1:10 % based on possible startups; no penalty at end for running over
MinUpTimeM=[2 2 2];
if kk>10-MinUpTimeM(jj)
sumidx=kk:10
else
sumidx=kk:kk+MinUpTimeM(jj)-1;
end
powerprob.Constraints.D1(kk,jj)=...
Z(kk,jj) - sum(Z(sumidx,jj)/length(sumidx))<=0;
end
end
showconstr(powerprob.Constraints.D1)
powerprob.Constraints.C3=Pgrid==HLD;
% Options for the optimization algorithm, here we set the max time it can run for
options=optimoptions('intlinprog','Maxtime',10);
% Call the optimization solver to find the best solution
[sol,TotalCost,exitflag,output]=solve(powerprob,'Options',options);
sol
struct2table(sol)
A=sol.A
If, I replace 'Z' with 'A' in the minimum up time constraint, then I get a solution that is violating my Duration constraint.
Also, if in the constraint
powerprob.Constraints.A1=sum(A.*V)==D; % Duration Constraint
sum(A.*V) is replaced with sum(A) only
then the duration and minimum up time constraints are followed but the Devices no longer operate within the given fixed time slots.
Kindly help me sort out the issue, as I am unable to find the error in my code.
  1 件のコメント
Hiba Haider
Hiba Haider 2023 年 1 月 20 日
can you help me i have same problem

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by