bnds3={sum(sum(teach(t,l,s),t),l)<=1};
% Teacher constraint, one teacher per slot
bnds={bnds1,bnds2,bnds3};
not_so_good_slots=tomArrayIdx('l',[1,4,5,8,9,12,13,16,17,20]);
objective1=sum(vec(teach(l,t,not_so_good_slots)));
%the goal is to minimize teaching courses in these no so good slots
max_work=[2 2 3];
objective2=0;
for i=1:3
overwork=sum(sum(teach(i,l,s),s),l)-max_work(i)
if overwork>0
objective2=objective2+10*abs(overwork);
end
end
但是,当我输入objective1=sum(vec(teach(l,t,not_so_good_slots)));后,提示:
Error in ==> tomArray.subsref at 78
checkIndexes(o);
我输入
for i=1:3
overwork=sum(sum(teach(i,l,s),s),l)-max_work(i)
if overwork>0
objective2=objective2+10*abs(overwork);
end
end
后提示
??? Function 'gt' is not defined for values of class 'tomArray'.
Error in ==> gt at 18
[varargout{1:nargout}] = builtin('gt', varargin{:});