case1=optimproblem;
T=[1:24]';
L=[1:2]';
C_Ip=[0.079 0.065 0.05 0.037 0.033 0.035 0.037 0.043 0.05 0.063 0.075 0.076 0.075 0.075 0.076 0.065 0.063 0.061 0.065 0.075 0.087 0.093 0.09 0]';
D_S=[2.3 1.9]';
x_S=optimvar('x_S',length(T),'Type','integer','LowerBound',0,'UpperBound',1);
d_S=optimvar('d_S',length(T),'Type','continuous','LowerBound',0);
c_T=optimvar('c_T',length(T),'Type','continuous','LowerBound',0);
case1.Constraints.C1=optimconstr(length(T));
for i=1:length(T)
if T(i)>=1 & T(i)<=23
case1.Constraints.C1(i)=sum(x_S)==1;
else
case1.Constraints.C1(i)=sum(x_S(i))==0;
end
end
case1.Constraints.COF=optimconstr(length(T));
for i=1:length(T)
case1.Constraints.COF(i)=c_T(i)==d_S(i).*C_Ip(i);
end
case1.Objective=sum(c_T);
options=optimoptions('intlinprog');
[solu,exitflag,output]=solve(case1,'Options',options);