Question

In: Computer Science

For a college, develop an intelligent timetable generator. Some of the parameters to be considered are...

  1. For a college, develop an intelligent timetable generator. Some of the parameters to be considered are number of staff, number of subjects, number of batches – practical/theory (shift – yes/no), number of subjects the staff would teach, number of hours the staff has load, number of classrooms and laboratories. The system needs to tackle clashes as well. in python plz fast

Solutions

Expert Solution

Note:- This not the exact program that is asked for but surely it will help you, it is a simple time table generator. You can see it and take a idea that how you can make a time table generator program.

The timetable has time slots of 15 minutes, from 8:00 to 18:15.I don’t want to create a spreadsheet with as many rows as the 15-minutes-slots there are in the timetable!

I’ve coded a Python class that represents time, and which has methods for addition and logical comparison:

class Time:

    def __init__(self, hour, minutes):

        self.hour = hour

        self.minutes = minutes

    

    def normalize(self):

        hour = self.hour

        minutes = self.minutes

        

        quotient = minutes / 60

        if quotient > 0:

            hour += quotient

            minutes = minutes % 60

        

        self.hour = hour

        self.minutes = minutes

        

        return self

    

    def __add__(self, t):

        """add two times (sum)"""

        hour = self.hour + t.hour

        minutes = self.minutes + t.minutes

        res = Time(hour, minutes)

        res.normalize()

        return res

    

    def __mul__(self, k):

        """multiply a time and an integer constant k (product)"""

        hour = self.hour * k

        minutes = self.minutes * k

        res = Time(hour, minutes)

        res.normalize()

        return res

    

    def __lt__(self, t):

        """less than"""

        if self.hour < t.hour or (self.hour == t.hour and self.minutes < t.minutes):

            return True

        else:

            return False

    

    def __eq__(self, t):

        """equal"""

        if self.hour == t.hour and self.minutes == t.minutes:

            return True

        else:

            return False

    

    def __le__(self, t):

        """less or equal"""

        return self < t or self == t

    

    def __gt__(self, t):

        """greater than"""

        return not self <= t

    

    def __ge__(self, t):

        """greater or equal"""

        return self > t or self == t

    

    def __ne__(self, t):

        """not equal"""

        return not self == t

    

    def __str__(self):

        hour = fill(str(self.hour), 2, '0')

        minutes = fill(str(self.minutes), 2, '0')

        return '%s:%s' % (hour, minutes)

I’ve implemented all the basic logical operators for comparison, because they’re very easy to implement, but we won’t be needing all of them.

In addition, I’ve also coded the __str__ method, which allows you to convert Time objects into Python strings by just using the str() function. This method needs a function called fill, which is intended to pad or fill a string with some character, so that the string reaches a given maximum size. That is, for example, when you have a string '8' that you want to be 2 characters long; you would fill it with zeroes until you reach that length: '08'. The code for this function is pretty simple:

def fill(s, size, c=' ', position='before'):

    """s: string; c: char"""

    if position == 'before':

        s = c * (size - len(s)) + s

    elif position == 'after':

        s += c * (size - len(s))

    return s

And, finally, this is the function to generate the time slots from a start time up to a given end time by some time increment:

def generate_timetable(start_time, interval=Time(0, 15), times=5, end_time=None):

    timetable = []

    

    if end_time is None:

        end_time = start_time + interval*times

    

    time = start_time

    while time < end_time:

        timetable.append(tuple([time, time + interval]))

        time += interval

    

    return timetable

In my case, I’ll just execute the following in the Python interpreter

start_time = Time(8, 0)

end_time = Time(18, 15)

for start, end in generate_timetable(start_time, end_time=end_time):

    print '%s-%s' % (start, end)

This prints the time slots that should go into each row of the spreadsheet, so I’ll just have to copy that, and I’ll be able to start filling my timetable!

Sorry for not giving the exact answer you want but something is better than nothing, I saw your question and can't controll my self from helping you. I hope you will appreciate my work if yes then please do upvote.

Thanks, have a nice day.

Best of luck for future.


Related Solutions

Electric Generator Corporation The Electric Generator Corporation was founded in the early 1970s to develop and...
Electric Generator Corporation The Electric Generator Corporation was founded in the early 1970s to develop and market electrical products for industrial and commercial markets. Recently, the company has developed a new electric generator, the EGI, with a revolutionary design. Although its initial cost is $2,000 higher than any competing generator, reduced maintenance costs will offset the higher purchase price within 18 months. The Electric Generator sales force has been instructed to concentrate all effort on selling this new generator, as...
Consider a linear congruential random number generator with parameters a = 3, m = 16, and...
Consider a linear congruential random number generator with parameters a = 3, m = 16, and c=0. Select the seed X0 = 3, and generate 3 random variables using this generator. What is the period of this generator?
Q 418. Using an LCG generator with parameters a: 21, m: 100, c: 13 and x0:...
Q 418. Using an LCG generator with parameters a: 21, m: 100, c: 13 and x0: 7 generate (if possible) a random variate from each of the following distributions. For each sub question, you may restart the LCG stream (i.e. feel free to reuse the same random number for each sub-question) a. Normal (15, 5) b. Gamma (5, 4) c. Poisson (2) d. Weibull (2, 2) e.Triangular(1,2,5)                                                                                
Intelligent design theory is an argument used by some people to challenge the teaching of evolution...
Intelligent design theory is an argument used by some people to challenge the teaching of evolution in public schools. One of the supporters of this idea claims that certain biological structures, such as the bacterial flagellum, require so many complex parts working together in perfect synchronization that it is not possible that they could have evolved from simpler structures. This argument states that a simpler structure could not perform the same function, which is evidence of “irreducible complexity.” This is...
3. Develop a LCG random number generator in a spreadsheet for the following constants: Z0 =...
3. Develop a LCG random number generator in a spreadsheet for the following constants: Z0 = 17, a = 31, c= 5, and m = 73. Generate 72 random numbers. Change the value of a to 23 and describe what happens.
Develop a random number generator for a Poisson distribution with mean = 10. Generate five values...
Develop a random number generator for a Poisson distribution with mean = 10. Generate five values manually with a random number table. Please show work.
A synchronous generator has parameters as shown in table below. 1. Voltage Rating 30 kV, 3-phase...
A synchronous generator has parameters as shown in table below. 1. Voltage Rating 30 kV, 3-phase 5. Frequency 50 Hz 2. Power Rating 50 MVA 6. Rotor Round 3. Synchronous Reactance, XS 7 Ω /phase 7. Connection STAR 4. Armature resistance, Ra 1.5 Ω /phase 8. Excitation Type Permanent Magnet An inductive load of 30MW at 0.8 power factor at rated terminal voltage is connected to the synchronous generator to an infinite bus. Determine the excitation voltage per phase and...
3.What are some of the major privacy concerns in employing intelligent systems on mobile data? 4....
3.What are some of the major privacy concerns in employing intelligent systems on mobile data? 4. Identify common violations of user privacy from current literature and their impact on data science as a profession. Need 500 words
A project being considered by a US MNC in Mongolia has the following parameters: Expected Lifetime...
A project being considered by a US MNC in Mongolia has the following parameters: Expected Lifetime 5 years Initial Cost MNT 7.5 billion Exepcted Annual Cash Fow MNT 1.6 billion Required Return 20% Current Spot Rate of Mongolian Tugrik (MNT) $.00053 The spot rate of the Tugrik is expected to remain stable for 4 years; it is expected the Tugrik will appeciate by 10% relative to the USD in year 5. WHAT IS THE BREAKEVEN AFTER-TAX SALVAGE VALUEIN MONGOLIAN TUGRIK?
Below is the explanation as to why some costs are considered to be variable and some...
Below is the explanation as to why some costs are considered to be variable and some fixed. After reading below, please Illustrate using curves How does time enter into the definition.             Costs are considered variable if they can change with output. On the other hand, costs are considered fixed if they do not change with output. Time enters in the logic that all fixed costs become variable in long run. In short run, some costs cannot change with output...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT