Hi Mike, thank you for looking at my problem. I'm fine with you helping me. The version of Python is 2.6. I will give you an example of what the final product should look like.
>>> allocate()
Enter the filename of the student preferences: tuts_eg1
Enter the filename of the tutorial info: tuts_eg1
T1 5 3
T2 10 3
T3 5 1
T4 10 2
T5 5 8
Command : m 3 2 T5 T3
2 moved
T3 5 3
T5 5 6
Command : m 2 2 T5 T4
and so on until all students have been allocated to their preferences and according to tutorial size.
As I said previously there are files with information about tutorials and one about student preferences. The first file has
T1 5
T2 10
T3 5
T4 10
T5 5
on it
and the second file has
Student 99999 T5 T4 T1
Student 99998 T5
Student 99997 T3
Student 99996 T2 T3 T5
etc. on it
This means that student 99999 preferences are to go to T5 then T4 then lastly T1 and so on with the other students
Any help greatly appreciated.
For instance, the T1, T2, T3, etc is for the Tutorial, the 5, 10, 5, 10, 5 is the maximum number of students allowed, and the 3, 3, 1, 2, 8 is the current number of students... Is this right?
(2) Can you explain the "Command : m 3 2 T5 T3" ?
m = move (are there any other commands?)
3 = ??
2 = ??
T5 = Tutorial 5
T3 = Tutorial 3
(3) What happens when a student only wants to attend a single tutorial, but that tutorial is already full?
Informati&on Analyst
10+ years experience programming in a variety of languages
Thanks very much. I don't know if you still want answers to the questions you asked but I will try to answer them anyway.
The initial first preference allocation shows too many students in T5 and too few in T3 and T4. The first command attempts to move three students from T5 to T3 whose second preferences were for T3. There were only two students in this category and they were moved. The second command tries to move two students from T5 to T4 whose second preference is for T4. Two students were moved.
It is assumed that all students can come to at least one tutorial.
After reading in the files, the program makes an initial allocation using first preferences and then enters a phase where the interface prompts for a command and the user enters a command to be processed by the program.
Commands are
e exit the program
s display the current allocations
m num pref_level from to
Hi Mike, I finally have a copy of the task I have to do. I have uploaded it as well as what I have done so far, thanks to your help. The comments you provided on your last script were great. The links are below.
http://wikisend.com/download/492878/Tutorial Allocator.doc
http://wikisend.com/download/494948/Program so far.doc
If you could help me with tasks 1.2.5 and 1.2.6 that would be great
Thanks
Hi Mike,
Thank you so much again. I will accept but just want to ask a couple more things first if that's OK. Please bear with me and forgive my ignorance. Now that all the functions are been written (extract_preferences, allocate_first_prefs etc.) how do you put it all together so that it will run as a program?
For example - I type in allocate () and then python automatically returns "Enter the filename of the student preferences:" and I input prefs_eg1 then python returns with "Enter the filename of the tutorial info" and I input tuts_eg1. Python then prints the tutorial info and so on continuing through the program until you get down to command : e (to exit the program). Basically I suppose how do you write a module to lauch or start the program. Do you think that is what is meant by 1.2.6 - write a function allocate () that will start the entire program?