The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Questions about TOMLAB
Replies: 1   Last Post: Aug 9, 2009 3:52 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 6
Registered: 7/23/09
Questions about TOMLAB
Posted: Jul 27, 2009 10:40 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am studying timetabling by the examples given in tomsym, but I seem to have misunderstanding in the definition of tomArray.
If a 1*1 tomarray 'overwork' :
which is:overwork = tomArray() with tomSym data:
sum(vec(sum(teach([... 20 by 5 array ...]),1)),1)-4
How can I write my program to compare each value of 'overwork' with the value zero,
I tried to use 'overwork>0' or 'overwork(i)>0' but it can't work. How can I chage it into a matrix or something like that.
Is it possible to use a variable which class is of 'tomArrayIdx' to indicate the subsindex of a matrix in matlab?

My problem in detail:
I have studied your case in tomSym,which is to establish a college timetable. ( use tomArrayIdx to create a tomarray of multidimensions. I tried to apply it into a similiar case I have encountered.
The timetable in my program: there are 3 teachers, 5 courses(each lesson has 2,2,3,2,2 lessons per week respectively),these teachers can teach any of these 5 courses.there are 5 workdays a week and each day has 4 slots.
Objective1:The desirable time for students to have courses are the 2nd and 3rd slots each day. so we have to minimize the courses' appearing on the 1st and 4th slots each day.
Objective2:The desirable schedule in the part of the 3 teachers are to teach only 2,2,3 courses per week respectively.This can't be satisfied,due to the prescribed courses per week is 2+2+3+2+2,and it's larger than 2+2+3.but I tried to minimize 'overwork' time.

My program using tomlab:
teacher=[4 2;4 1;6 1]; %three teachers,first column 4 4 6 are their desirable schedule perweek, second column is the kind of classrooms they wanted to teach in(1 is for multimedia classroom,2 is for auditorium)
course=[2 50 2;2 30 1;3 40 1;2 25 2;2 60 1]; %5 courses and their properties,first column:lessons per week,second column:number of students attending the class,third column is the kind of classroom the courses to be taught in(1 is for multimedia classroom,2 is for auditorium)
slots=4*5; %numbers of slots:4 classes per day, 5 workdays a week
room=[100 2;100 1;100 1;50 2;50 1;50 1;50 1;... %18 rooms and their properties,first column:maximum number of seats in the classroom.second column:the property of the classrooms(1 is for multimedia classroom,2 is for auditorium)
60 1;60 1;60 2;60 1;60 3;40 3;...
40 3;40 3;40 2;50 1;40 1];
bnds1={0<=teach<=1}; %variables are binary
bnds2={sum(sum(sum(teach(t,l,s,r),s),t),r)==course(:,1)}; %all courses must be taught
bnds3={sum(sum(teach(t,l,s,r),t),l)<=1}; %only one lesson in the classroom at one time
bnds4={sum(sum(teach(t,l,s,r),r),l)<=1}; %one teacher can only teach one lesson at a time
bnds5={room(r,1)>=course(r,3)}; %###REPORTS ERROR###seats in the classroom must be greater than the number of students attending the course
not_so_good_slots=tomArrayIdx('s',[1,4,5,8,9,12,13,16,17,20]); %this is the same with your example in tomsym:establishing a college timetable
for i=1:3
overwork=sum(sum(sum(teach(t,l,s,r),s),l),r)-teacher(i,1); %###REPORTS ERROR###minimize the overtime of the teachers
if overwork>0

When i enter
for i=1:3
if overwork>0
it says:
??? Function 'gt' is not defined for values of class 'tomArray'.

Error in ==> gt at 18
[varargout{1:nargout}] = builtin('gt', varargin{:});

When i entered:
it says
??? Error using ==> subsindex
Function 'subsindex' is not defined for values of class 'tomArrayIdx'.

Could you give me some suggestions on how to implement these on tomlab?
Thanks for your attention.Any suggestions are appreciated.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.