School Timetable Problem

I am trying to write a programme for a school. Here is the problem: All subejcts are organised into options. A subject can be in any number of options, from one to all of them. All the options are at different times, and I need an algorythma that will take the students chosen options, get the times available from a database of what subject/what option(s), and try and fit them together. Then it needs to tell them if they can fit all their subjects in, and, if so, show them all the possible arrangements for them. If not, it needs to tell them what the conflicts are. Any suggesitons? I am happy to clarify if needed. I don't neccessarily need code, pseudo code will do just fine - I need method.
Arachn1dAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

setiawanCommented:
Arachn1d, I have also make something like you asked (in Java).

Ok, so you want to show all subject into option button, I suggest you to put it into one group for each subject.
so user can't choose 2 same subject.

you can use matrix to check the subject have been chosen, so If the matrix is already filled, then you know there is conflict.
matrix [6][7]
   Mon Tue Wed Thu Fri Sat
 1
 2
 3
 4
 5
 6
 7

  regards

   danny
 
0
Arachn1dAuthor Commented:
Not quite - An option is 2-3 preiods a week - the actual timetable doesnt matter. Also, Subjects amy be available in several options - like english. The student would say they want to enter english, and it would try and sort out all the subjects to fit in together - if they do. If they dont, it would tell them of the conflicts, if there is more than one way to fit them all together, it will show them all the options.
0
Arachn1dAuthor Commented:
I've worked out most of this problem, all I need to know now is how to produce every possible re-arrangement of x digits (x could be from 2 to anything) - eg 123,132,213,231,312,321 for 3 digits. So I need a loop that will alter an array to the latest rearrangement of digits so I can work on them. Help!
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ggilmanCommented:
This should do it for you. In my test I had a text box for the input and a listbox for the combination output.

Private Sub Command1_Click()
    List1.Clear
    Call doit("", Text1.Text)
End Sub
Private Sub doit(ByVal st As String, ByVal en As String)
'This is a recursive routine that will create all combinations
'of a given string.
    Dim i As Long           'Counter to loop though remaining charchters
    Dim startStr As String  'Part of string already found
    Dim endStr As String    'Part of string left to be disected
   
    'Loop for all charchters left to be disected
    For i = 1 To Len(en)
        'Grab 1 charchter from endString and put it on startString
        startStr = st & Mid(en, i, 1)
       
        'Recalculate endString
        endStr = Left(en, i - 1) & Mid(en, i + 1)
       
        If endStr = "" Then 'Ran out of charchters to disect
            List1.AddItem startStr
        Else
            Call doit(startStr, endStr) 'More charchters to disect, try again.
        End If
    Next i
End Sub
0
ggilmanCommented:
Just change the List1.AddItem list to store startStr into an array for the combinations you want.
0
Arachn1dAuthor Commented:
Thanks very much, I found this answer perfect for my situation (and a very clever implementation as well!) - If you can submit that as an answer, I'll accept it with thanks!
0
ggilmanCommented:
Glad to help.

--ggilman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Arachn1dAuthor Commented:
A! A+! A++ :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.