• Data Structure & Algorithm Classes (Live)
  • System Design (Live)
  • DevOps(Live)
  • Explore More Live Courses
  • Interview Preparation Course
  • Data Science (Live)
  • GATE CS & IT 2024
  • Data Structure & Algorithm-Self Paced(C++/JAVA)
  • Data Structures & Algorithms in Python
  • Explore More Self-Paced Courses
  • C++ Programming - Beginner to Advanced
  • Java Programming - Beginner to Advanced
  • C Programming - Beginner to Advanced
  • Full Stack Development with React & Node JS(Live)
  • Java Backend Development(Live)
  • Android App Development with Kotlin(Live)
  • Python Backend Development with Django(Live)
  • Complete Data Science Program(Live)

Mastering Data Analytics

Devops engineering - planning to production, cbse class 12 computer science.

Related Articles

Scheduling in Greedy Algorithms

In this article, we will discuss various scheduling algorithms for Greedy Algorithms . Many scheduling problems can be solved using greedy algorithms.

Problem statement: Given N events with their starting and ending times, find a schedule that includes as many events as possible. It is not possible to select an event partially. Consider the below events:

Algorithms that work with every case:

Algorithm 1 : 

Algorithm 2 :

Algorithm 3 :

Solve DSA problems on GfG Practice.

Please Login to comment...

Data Structures & Algorithms in Python - Self Paced

Complete interview preparation - self paced, master c++ programming - complete beginner to advanced, data structures and algorithms - self paced, competitive programming - live, system design - live, complete test series for product-based companies, complete test series for service-based companies, complete machine learning & data science program, dsa live for working professionals - live, master java programming - complete beginner to advanced, python programming foundation -self paced, java backend development - live, master c programming with data structures, full stack development with react & node js - live, improve your coding skills with practice, start your coding journey now.

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Teacher time schedule algorithm

This is a problem I've had on my mind for a long time. Being the son of a teacher and a programmer, it occurred to me early on... but I still haven't found a solution for it.

So this is the problem. One needs to create a time schedule for a school, using some constraints. These are generally divided in two categories:

Sanity Checks

Preferences

Now, after a few years of not finding a solution (and learning a thing or two in the meanwhile...), I realized that this smells like a NP-hard problem.

Is it proven as NP-hard?

Does anyone have an idea on how to crack this thing?

Looking at this question made me think about this problem, and whether genetic algorithms would be usable in this case. However it would be pretty hard to mutate possibilities while maintaining the sanity check rules. Also it's not clear to me how to distinguish incompatible requirements.

A small addendum to better specify the problem. This is applied to Italian school style classrooms where all students are associated in different classes (for example: year 1 section A) and the teachers move between classes. All students of the same class have the same schedule, and have no choice over which lessons to attend.

Community's user avatar

10 Answers 10

I am one of the developer that works on the scheduler part of a student information system. During our original approach of the scheduling problem, we researched genetic algorithms to solve constraint satisfaction problems, and even though we were successful initially, we realized that there was a less complicated solution to the problem (after attending a school scheduling workshop)

Our current implementation works great, and uses brute force with smart heuristics to get a valid schedule in a short amount of time. The master schedule (assignment of the classes to the teachers) is first built, taking in consideration all the constraints that each teacher has while minimizing the possibility of conflicts for the students (based of their course requests). The students are then scheduled in the classes using the same method.

Doing this allows you to have the machine build a master schedule first, and then have a human tweak it if needed.

The scheduler current implementation is written in perl, but other options we visited early on were Prolog and CLIPS (expert system)

Laurent's user avatar

I think you might be missing some constraints.

One would prefer where possible to have teachers scheduled to classes for which they are certified.

One would suspect that the classes that are requested, and the expected headcount in each would be significant.

I think the place to start would be to list all of your constraints, figure out a data structure to represent them.

Then create some sort of engine to that builds a trial solution, then evaluates it for fitness according to the constraints.

You could then throw the fun genetic algorithms part at it, and see if you can get the fitness to increase over time as the genes mix.

Start with a small set of constraints, and increase them as you see success (if you see success)

There might be a way to take the constraints and shoehorn them together with something like a linear programming algorithm.

I agree. It sounds like a fun challenge

EvilTeach's user avatar

This is a mapping problem: you need to map to every hour in a week and every teacher an activity (teach to a certain class or free hour ).

Split the problem:

In steps 2 and 3 show each iteration to the user: items left in the list, positions on the map and the next computed move and let the user intervene.

I did not try this, but this would be my initial approach.

Ovidiu Pacurar's user avatar

I've tackled similar planning/scheduling problems in the past and the AI technique that is often best suited for this class of problem is "Constraint Based Reasoning".

It's basically a brute force method like Laurenty suggested, but the approach involves applying constraints in an efficient order to cause the infeasible solutions to fail fast - to minimise the computation required.

Googling "Constraint Based Reasoning" brings up a lot of resources on the technique and its application to scheduling problems.

Stringent Software's user avatar

Answering my own question:

The FET project mentioned by gnud uses this algorithm:

Some words about the algorithm: FET uses a heuristical algorithm, placing the activities in turn, starting with the most difficult ones. If it cannot find a solution it points you to the potential impossible activities, so you can correct errors. The algorithm swaps activities recursively if that is possible in order to make space for a new activity, or, in extreme cases, backtracks and switches order of evaluation. The important code is in src/engine/generate.cpp. Please e-mail me for details or join the mailing list. The algorithm mimics the operation of a human timetabler, I think.

Following up the "Constraint Based Reasoning" lead by Stringent Software on Wikipedia lead me to these pages which have an interesting paragraph:

Solving a constraint satisfaction problem on a finite domain is an NP-complete problem in general. Research has shown a number of polynomial-time subcases, mostly obtained by restricting either the allowed domains or constraints or the way constraints can be placed over the variables. Research has also established relationship of the constraint satisfaction problem with problems in other areas such as finite model theory and databases.

This reminds me of this blog post about scheduling a conference , with a video explanation here .

How I would do it:

Have the population include two things:

This way we can't have conflicts (a teacher in 2 places, or a class having two subjects at the same time).

The fitness function would include:

Maybe take the standard deviation for all of them since they should be balanced.

Osama Al-Maadeed's user avatar

Genetic Algorithms are very well suited to problems such as this. Once you come up with a decent representation of the chromosome (in this case, probably a vector representing all of the available class slots) you're most of the way there.

Don't worry about maintaining sanity checks during the mutation phase. Mutation is random. Sanity and preference checks both belong in the selection phase. A failed sanity check would drastically lower the fitness of an individual, while a failed preference would only mildly lower the fitness.

Incompatible requirements are a different problem altogether. If they're completely incompatible, you'll get a population that doesn't converge on anything useful.

Trevor Oke's user avatar

Good luck. Being the son of a father with this sort of problem is what took me to the research group that I ended up in ...

When I was a kid my father scheduled match officials in a local sports league, this had a similarly long list of constraints and I tried to write something to help. When I got to University I even used it as my final year project eventually settling on a Monte Carlo implementation (using a Simulated Annealing model).

The basic idea is that if it's not NP, it's pretty close, so rather than assuming there is a solution, I would set out to find the best within a given timeframe. I would weight all the constraints with costs for breaking them: sanity checks would have huge costs, the preferences would have lower costs (but increasing for more breaks, so breaking it once would be less than half the cost of breaking it twice).

The basic idea is that I started with a 'random' solution and costed it; then made changes by swapping a small number of assignments, re-valued it and then, probalistically accepted or declined the change.

After thousands of iterations you inch closer to an acceptable solution.

Believe me, though, that this class of problems has research groups churning out PhDs so you're in very good company.

You might also find some interest in the Linear Programming arena, e.g. simplex and so on.

Unsliced's user avatar

Yes, I think this is NP complete - or at least to find the optimal solution is NP complete.

I worked on a similar problem in college when i told a friend's father (who was a teacher) that I could solve his scheduling problems for him if he did not find a suitable program for it (this was back in 1990 or so)

I had no idea what I got myself into. Luckily for us all I had to do was find one solution that fit the constraints. But in my testing I was always worried about determining IF there was a solution at all. He never had too many constraints and the program used different heuristics and back tracking. It was a lot of fun.

I think Bill Gates also worked on a system like this in high school or college for his high school. Not sure though.

Good luck. All my notes are gone and I never got around to implementing a solution that I could market. It was a specialty project that I re-coded as I learned new languages (Basic, Scheme, C, VB, C++)

Have fun with it

Tim's user avatar

i see that this problem can be solved by Prolog program by connecting it to a database and the program can make the schedule given a set of constraints read abt "Constraint satisfaction Problem prolog"

Muslims's user avatar

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged algorithm scheduling np-hard or ask your own question .

Hot Network Questions

algorithm assignment scheduling problem

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Tay Tze Hao

Jan 10, 2021

Classroom scheduling using heuristics and genetic algorithm

This article is written based on the assumption that the reader has an understanding of genetic algorithms. The code is available on https://github.com/taytzehao/School_scheduling/tree/main

Problem Statement

This problem is centered around making a school schedule for my secondary school using heuristic and genetic algorithm methods.

Unlike scheduling for universities, this school schedule is packed throughout the day with a fixed break in the middle of the morning. The format would be as of the following diagram

Where lower form refers to grades 7–9 and upper form refers to grades 10-12. Recess for the upper form students is at the 6th period while the lower form is at the 5th period. Upper form students have extra classes on Wednesday and Thursday.

The schedule has to conform to the following rules:

Initializing the classes

A form (aka grade) can have multiple classrooms that have a different class name. Therefore, the classroom inherits from From. Each classroom contain would have multiple subjects that have to be taught while each subject can be taught in multiple classes. The same interaction goes for the teacher and the classroom.

The teach object would be a class that associates teacher, classroom, and subject altogether. Every time a class is assigned, the teach object would be appended to the teacher and classroom object to easily identify the information of the activity while pointing to the same object without creating duplicate data in separate classes.

A brief introduction to Genetic algorithm

Genetic algorithm is a metaheuristic method to solve optimization problems. It resembles the genetics to allow the solution to evolve, mutate, and improve over generations, much like a living organism.

It starts off with the step of initializing random sets of solutions called “population” with each solution called “individual”. The better individuals are firstly being selected to eliminate solutions that are bad. The individuals in the population then cross-breed with each other by mixing their solutions together. Then, the individuals mutate by randomly changing some of the genes. If the population solution fulfills the fitness criteria, the process ends there. However, if the fitness criteria is not fulfilled, the process would be reiterated back to the selection step.

Genetic algorithm solution

In the genetic algorithm solution, the problem is being broken down into 2 sections i.e.

a) The assignment of teachers to each subject of each class since each subject of each class can only be taught by 1 teacher as in Rule 5.

b)The assignment of classes to each class.

This is meant to reduce the problem space that the genetic algorithm needs to solve. This is because of the previous iteration of solutions that merged both the problems lead to premature convergence.

Teacher assignment

Initialization

Each teacher is provided a unique ID number to be encoded into the gene. Each gene is initialized with a random teacher. The length of the individual is equivalent to the sum of subjects of all classes. Eg, class A has 10 subjects and class B has 11 subjects, the individual would have 21 genes. Each position of the gene represents the teacher assigned to the subject. The population is being initialized to 300 individuals per population.

Fitness function

The fitness is decreased as to the following 2 criteria:

a) Subjects that require specialized skills that are assigned teachers who are specialized in it would decrease fitness score by 1.

b) Teachers that are assigned more than the maximum number of teaching hours would decrease the fitness by the number of exceeding hours.

As this is a regular encoding problem, the following operators are used for solving this problem

a) Uniform crossover

It selects 2 parents and randomly exchanges the element of both parents from the same position as of below. As compared to 1 or 2 points crossover, this method better promotes exploration.

b) Random mutation

A random teacher ID is selected and switched to another random teacher ID.

The Roulette method is used for selecting individuals from each population.

Class assignment

Encoding method

The classes are being encoded as a permutation type problem here with each ID representing a set of classes. This means for a subject that has “side_by_side=True” and 5 periods allocated to it, the subject would be assigned class sets of 2,2,1 with 3 unique IDs. So, each ID would contain 2 information, the teaching activity and the number of periods for the class set.

The position of each gene in the chromosome represents its location on the schedule. The gene of the next class is at the position after the last position of the former class. The diagram below shows an example of 2 classes that have 10 and 11 class sets

This encoding method is developed after rounds of iteration in order to prevent premature convergence of the population and reduces the problem space significantly by limiting the permutation to involve classes within the classroom.

The fitness function is also designed to maximize the fitness score. The fitness score is decreased as of the following conditions:

a) Each morning period that is assigned after recess decreases the fitness score by 1

b) Each period that intersects with the teaching schedule of the teacher decreases the fitness score by 1.

c) Decrease fitness for every subject that exceeds the limit of its classes per day by the number of excess periods.

d) Decrease the fitness by 1 for every class set that has 2 periods that do not have consecutive periods. For example, the Biology class in the diagram below is interrupted by the Recess would have the fitness decreased by 1.

All operations used in this problem are designed to only include the gene which is of the same classroom. The operators used for this are

a) Ordered Crossover. It selects a substring from parent 1 and maintains its position in the offspring. The remaining elements that are not in the substring would utilize the position of the rest of the elements from parent 2 as in the diagram below. The modified version of it is done for each class.

Heuristic mutation-Each individual would randomly select gamma amount of genes and permutate their position. The permutation with the best arrangement would be selected. The modified version of this mutation separately selects the genes from each class and permutates the arrangement for each class.

Tournament selection. Individuals are randomly selected from the population based on the tournament size. Out of this batch, the best individual is selected for the offspring. This process is repeated until the offspring size reaches the population size. The smaller the tournament size, the better the exploration of the offspring. This is because this gives a higher probability of 2 low fitness individuals to be selected, and thus improving the diversity of the population.

Migration ring. The migration ring emigrates k amount of individuals that are selected using the tournament method stated above to replace random individuals in its destination population. This can help to increase population diversity and reduce the likelihood of premature convergence. This is performed at the end of each iteration.

Heuristics solution

As the class assignment sequence diagram describes, the main goal of creating the process is to minimize the possibility of assigning classes to times that are not viable for the subject. The more clashes there are, the more computing power is required in order to swap blank periods with periods that are already assigned classes.

Every sequence would go through the following processes:

a) Loop through every class

b) Loop through every subject

c) Select the subject that fulfills the criteria as in the diagram

d) Select period coordinates that suit all requirements. If no period is viable, the time of the other classes would be swapped with the period with blank classes. This would significantly increase the computing time.

e) Randomly select the coordinate and assign the period the classes

Morning classes are being assigned first as there is only 1 type of subject for each class that requires the classes to be in the morning. Plus, the requirement of having them in the morning reduces the number of viable periods to assign them to by half.

Next, double period classes are being assigned first before single period classes. This is because single period classes have a higher probability of taking away consecutive blank periods that would be used by the double period classes. Plus, single period classes have higher flexibility in terms of the timing as it does not need 2 consecutive blank classes.

Assessing the results

From the 2 performance graphs above, it is clear the using genetic algorithm utilizes significantly more computing power to solve the problem. Plus, it does not scale well as the number of classes increases as its time required grows exponentially with the number of classrooms.

This is mainly because of the random nature of genetic algorithm that would usually cause some collision with some other constraint while correcting the problem at hand.

It is concluded that the heuristic method would be suited and more scalable to arrange the school schedule. Some other points that could be used to improve this project for the future include:

a) Scale it up to more classes

b) Use simulated annealing algorithm method

c) Include teacher performance into assigning the teachers into each class. This is to ensure all classes are assigned a balanced amount of high and low-performing teachers.

d) Assign classes based on facilities availability according to subjects.

e) Minimization of walking distance by teachers

More from Tay Tze Hao

About Help Terms Privacy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store

Tay Tze Hao

Text to speech

Book cover

International Conference on Advanced Information Networking and Applications

AINA 2021: Advanced Information Networking and Applications pp 533–540 Cite as

Solving Job Scheduling Problem Using Genetic Algorithm

765 Accesses

Part of the Lecture Notes in Networks and Systems book series (LNNS,volume 227)

The efficient scheduling of independent computational jobs in a computing environment is an important problem where there are some deadlines for each job to become complete. Finding optimal schedules for such an environment is (in general) an NP-complete problem, and so heuristic approaches must be used. Genetic algorithms are known to give the best solutions to such problems. The purpose of this paper is to propound a solution to a job scheduling problem using genetic algorithms. The experimental results show that the most important factor on the time complexity of the algorithm is the size of the population and the number of generations.

This is a preview of subscription content, access via your institution .

Buying options

algorithm assignment scheduling problem

Abraham, A., Buyya, R., Nath, B.: Nature’s heuristics for scheduling jobs on computational grids. In: Proceedings of the 8th International Conference on Advanced Computing and Communications, pp. 45–52. Tata McGraw-Hill, India (2000)

Google Scholar  

Wang, L., Cai, J., Li, M., Liu, Z.: Flexible Job Shop Scheduling Problem Using an Improved Ant Colony Optimization, Scientific Programming, pp. 9016303 (2017)

Ritchie, G., Levine, J.: A fast, effective local search for scheduling independent jobs in heterogeneous computing environments. Proceedings of the 22nd Workshop of the UK Planning and Scheduling Special Interest Group (2003)

Aarts, E.H.L., Van Laarhoven, P.J.M., Lenstra, J.K., Ulder, N.L.J.: A computational study of local search algorithms for job shop scheduling. ORSA J. Comput. 6 , 118–125 (1994)

CrossRef   Google Scholar  

Rezaee, A., Ajelli, A.: Problem solving of graph correspondence using genetics algorithm and ACO algorithm. Int. J. Innov. Res. Sci. Eng. Technol. 2 (12), 7785–7791 (2013)

Jang, W., Jong, D., Lee, D.: Methodology to improve driving habits by optimizing the in-vehicle data extracted from OBDII using genetic algorithm. In: 2016 International Conference on Big Data and Smart Computing (BigComp). pp. 313–316 (2016)

Shamsieva, A.M., Arkov, V.U.: On genetic algorithm methodology for robust system design. In: 2011 IEEE 12th International Symposium on Computational Intelligence and Informatics (CINTI), pp. 421–426 (2011)

Abdoli, S., Hajati, F.: Offline signature verification using geodesic derivative pattern. In: 22nd Iranian Conference on Electrical Engineering (ICEE), Tehran, pp. 1018–1023 (2014)

Barzamini, R., Hajati, F., Gheisari, S., Motamadinejad, M.B.: Short term load forecasting using multi-layer perception and fuzzy inference systems for Islamic countries. J. Appl. Sci. 12 (1), 40–47 (2012)

Shojaiee, F., Hajati, F.: Local composition derivative pattern for palmprint recognition. In: 22nd Iranian Conference on Electrical Engineering (ICEE), Tehran, pp. 965–970 (2014)

Hajati, F., Raie, A.A., Gao, Y.: Pose-invariant 2.5 D face recognition using geodesic texture warping. In: 11th International Conference on Control Automation Robotics and Vision, Singapore, pp. 1837–1841 (2010)

Ayatollahi, F., Raie, A.A., Hajati, F.: Expression-invariant face recognition using depth and intensity dual-tree complex wavelet transform features. J. Electr. Imaging 24 (2), 3–31 (2015)

Pakazad, S.K., Faez, K., Hajati, F.: Face detection based on central geometrical moments of face components. In: IEEE International Conference on Systems, Man and Cybernetics (SMC 2006), Taiwan (2006)

Hajati, F., Cheraghian, A., Gheisari, S., Gao, Y., Mian, A.S.: Surface geodesic pattern for 3D deformable texture matching. Pattern Recogn. 62 , 21–32 (2017)

Hajati, F., Faez, K., Pakazad, S.K.: An efficient method for face localization and recognition in color images. In: IEEE International Conference on Systems, Man and Cybernetics (SMC 2006), Taiwan (2006)

Hajati, F., Raie, A.A., Gao, Y.: Pose-invariant multimodal (2D + 3D) face recognition using geodesic distance map. J. Am. Sci. 7 (10), 583–590 (2011)

Download references

Author information

Authors and affiliations.

College of Engineering and Science, Victoria University Sydney, Sydney, Australia

Soheila Gheisari & Farshid Hajati

Department of Mechatronics Engineering, Faculty of New Sciences and Technologies, University of Tehran, Tehran, Iran

Alireza Rezaee

You can also search for this author in PubMed   Google Scholar

Corresponding author

Correspondence to Farshid Hajati .

Editor information

Editors and affiliations.

Department of Information and Communication Engineering, Fukuoka Institute of Technology, Fukuoka, Japan

Prof. Leonard Barolli

Department of Computer Science, Ryerson University, Toronto, ON, Canada

Dr. Isaac Woungang

Faculty of Business Administration, Rissho University, Tokyo, Japan

Dr. Tomoya Enokido

Rights and permissions

Reprints and Permissions

Copyright information

© 2021 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Cite this paper.

Gheisari, S., Rezaee, A., Hajati, F. (2021). Solving Job Scheduling Problem Using Genetic Algorithm. In: Barolli, L., Woungang, I., Enokido, T. (eds) Advanced Information Networking and Applications. AINA 2021. Lecture Notes in Networks and Systems, vol 227. Springer, Cham. https://doi.org/10.1007/978-3-030-75078-7_53

Download citation

DOI : https://doi.org/10.1007/978-3-030-75078-7_53

Published : 01 May 2021

Publisher Name : Springer, Cham

Print ISBN : 978-3-030-75077-0

Online ISBN : 978-3-030-75078-7

eBook Packages : Intelligent Technologies and Robotics Intelligent Technologies and Robotics (R0)

Share this paper

Anyone you share the following link with will be able to read this content:

Sorry, a shareable link is not currently available for this article.

Provided by the Springer Nature SharedIt content-sharing initiative

Google OR-Tools

Get Started with OR-Tools for Python

The following sections will get you started with OR-Tools for Python:

What is an optimization problem?

Solving an optimization problem in python, more python examples, identifying the type of problem you wish to solve.

The goal of optimization is to find the best solution to a problem out of a large set of possible solutions. (Sometimes you'll be satisfied with finding any feasible solution; OR-Tools can do that as well.)

Here's a typical optimization problem. Suppose that a shipping company delivers packages to its customers using a fleet of trucks. Every day, the company must assign packages to trucks, and then choose a route for each truck to deliver its packages. Each possible assignment of packages and routes has a cost, based on the total travel distance for the trucks, and possibly other factors as well. The problem is to choose the assignments of packages and routes that has the least cost.

Like all optimization problems, this problem has the following elements:

The objective —the quantity you want to optimize. In the example above, the objective is to minimize cost. To set up an optimization problem, you need to define a function that calculates the value of the objective for any possible solution. This is called the objective function . In the preceding example, the objective function would calculate the total cost of any assignment of packages and routes.

An optimal solution is one for which the value of the objective function is the best. ("Best" can be either a maximum or a minimum.)

The constraints —restrictions on the set of possible solutions, based on the specific requirements of the problem. For example, if the shipping company can't assign packages above a given weight to trucks, this would impose a constraint on the solutions.

A feasible solution is one that satisfies all the given constraints for the problem, without necessarily being optimal.

The first step in solving an optimization problem is identifying the objective and constraints.

Next, we give an example of an optimization problem, and show how to set up and solve it in Python.

A linear optimization example

One of the oldest and most widely-used areas of optimization is linear optimization (or linear programming ), in which the objective function and the constraints can be written as linear expressions. Here's a simple example of this type of problem.

Maximize 3x + y subject to the following constraints:

The objective function in this example is 3x + y . Both the objective function and the constraints are given by linear expressions, which makes this a linear problem.

Main steps in solving the problem

For each language, the basic steps for setting up and solving a problem are the same:

Python program

This section walks through a Python program that sets up and solves the problem.

Here are the steps:

Complete program

The complete program is shown below.

Running the program

You can run the program above as follows:

The program returns the values of x and y that maximize the objective function:

For more Python examples that illustrate how to solve various types of optimization problems, see Examples .

There are many different types of optimization problems in the world. For each type of problem, there are different approaches and algorithms for finding an optimal solution.

Before you can start writing a program to solve an optimization problem, you need to identify what type of problem you are dealing with, and then choose an appropriate solver — an algorithm for finding an optimal solution.

Below you will find a brief overview of the types of problems that OR-Tools solves, and links to the sections in this guide that explain how to solve each problem type.

Linear optimization

Constraint optimization, mixed-integer optimization, network flows.

As you learned in the previous section , a linear optimization problem is one in which the objective function and the constraints are linear expressions in the variables.

The primary solver in OR-Tools for this type of problem is the linear optimization solver, which is actually a wrapper for several different libraries for linear and mixed-integer optimization , including third-party libraries.

Learn more about linear optimization

A mixed integer optimization problem is one in which some or all of the variables are required to be integers. An example is the assignment problem , in which a group of workers needs be assigned to a set of tasks. For each worker and task, you define a variable whose value is 1 if the given worker is assigned to the given task, and 0 otherwise. In this case, the variables can only take on the values 0 or 1.

Learn more about mixed-integer optimization

Constraint optimization, or constraint programming (CP), identifies feasible solutions out of a very large set of candidates, where the problem can be modeled in terms of arbitrary constraints. CP is based on feasibility (finding a feasible solution) rather than optimization (finding an optimal solution) and focuses on the constraints and variables rather than the objective function. However, CP can be used to solve optimization problems, simply by comparing the values of the objective function for all feasible solutions.

Learn more about constraint optimization

Assignment problems involve assigning a group of agents (say, workers or machines) to a set of tasks, where there is a fixed cost for assigning each agent to a specific task. The problem is to find the assignment with the least total cost. Assignment problems are actually a special case of network flow problems .

Learn more about assignment

Bin packing is the problem of packing a set of objects of different sizes into containers with different capacities. The goal is to pack as many of the objects as possible, subject to the capacities of the containers. A special case of this is the Knapsack problem , in which there is just one container.

Learn more about bin packing

Scheduling problems involve assigning resources to perform a set of tasks at specific times. An important example is the job shop problem , in which multiple jobs are processed on several machines. Each job consists of a sequence of tasks, which must be performed in a given order, and each task must be processed on a specific machine. The problem is to assign a schedule so that all jobs are completed in as short an interval of time as possible.

Learn more about scheduling

Routing problems involve finding the optimal routes for a fleet of vehicles to traverse a network, defined by a directed graph. The problem of assigning packages to delivery trucks, described in What is an optimization problem ? , is one example of a routing problem. Another is the traveling salesperson problem .

Learn more about routing

Many optimization problems can be represented by a directed graph consisting of nodes and directed arcs between them. For example, transportation problems, in which goods are shipped across a railway network, can be represented by a graph in which the arcs are rail lines and the nodes are distribution centers.

In the maximum flow problem , each arc has a maximum capacity that can be transported across it. The problem is to assign the amount of goods to be shipped across each arc so that the total quantity being transported is as large as possible.

Learn more about network flows

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-01-18 UTC.

Information

Initiatives

You are accessing a machine-readable page. In order to be human-readable, please install an RSS reader.

All articles published by MDPI are made immediately available worldwide under an open access license. No special permission is required to reuse all or part of the article published by MDPI, including figures and tables. For articles published under an open access Creative Common CC BY license, any part of the article may be reused without permission provided that the original article is clearly cited. For more information, please refer to https://www.mdpi.com/openaccess .

Feature papers represent the most advanced research with significant potential for high impact in the field. A Feature Paper should be a substantial original Article that involves several techniques or approaches, provides an outlook for future research directions and describes possible research applications.

Feature papers are submitted upon individual invitation or recommendation by the scientific editors and must receive positive feedback from the reviewers.

Editor’s Choice articles are based on recommendations by the scientific editors of MDPI journals from around the world. Editors select a small number of articles recently published in the journal that they believe will be particularly interesting to readers, or important in the respective research area. The aim is to provide a snapshot of some of the most exciting work published in the various research areas of the journal.

algorithm assignment scheduling problem

algorithms-logo

Article Menu

algorithm assignment scheduling problem

Find support for a specific problem in the support section of our website.

Please let us know what you think of our products and services.

Visit our dedicated information section to learn more about MDPI.

JSmol Viewer

Multi-objective task scheduling optimization in spatial crowdsourcing.

algorithm assignment scheduling problem

1. Introduction

2. related work, 2.1. task matching in sc, 2.2. task scheduling problem in sc, 2.3. the binary-objective optimization problem in sc, 3. the motso model in sc, 3.1. the ranking strategy algorithm, 3.1.1. task execution duration (ted) and ranked task execution duration (rted), 3.1.2. task entropy (te) and ranked task entropy (rte), 3.1.3. the ranked tables, 3.2. multi-objective particle swarm optimization, 4. performance evaluation.

4.1. The Performance of the Ranking Strategy Algorithm

4.2. Performance of the MOTSO Model

4.2.1. maximizing the number of completed tasks, 4.2.2. minimizing the total travel costs (ttcs), 4.2.3. minimizing the standard deviation of the workload balance, 5. conclusions, author contributions, data availability statement, conflicts of interest, abbreviations.

Share and Cite

Alabbadi, A.A.; Abulkhair, M.F. Multi-Objective Task Scheduling Optimization in Spatial Crowdsourcing. Algorithms 2021 , 14 , 77. https://doi.org/10.3390/a14030077

Alabbadi AA, Abulkhair MF. Multi-Objective Task Scheduling Optimization in Spatial Crowdsourcing. Algorithms . 2021; 14(3):77. https://doi.org/10.3390/a14030077

Alabbadi, Afra A., and Maysoon F. Abulkhair. 2021. "Multi-Objective Task Scheduling Optimization in Spatial Crowdsourcing" Algorithms 14, no. 3: 77. https://doi.org/10.3390/a14030077

Article Metrics

Article access statistics, further information, mdpi initiatives, follow mdpi.

MDPI

Subscribe to receive issue release notifications and newsletters from MDPI journals

Stack Exchange Network

Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Is there a greedy algorithm to solve the assignment problem?

The assignment problem is defined as:

There are n people who need to be assigned to n jobs, one person per job. The cost that would accrue if the ith person is assigned to the jth job is a known quantity C[i,j] for each pair i, j = 1, 2, ..., n. The problem is to find an assignment with the minimum total cost.

There is a question asking to design a greedy algorithm to solve the problem. It also asks if the greedy algorithm always yields an optimal solution and for the performance class of the algorithm. Here is my attempt at designing an algorithm:

Algorithm Design

Am I correct in saying that my algorithm is of O(n^2)? Am I also correct in saying that a greedy algorithm does not always yield an optimal solution? I used my algorithm on the following cost matrix and it is clearly not the optimal solution. Did I Do something wrong?

Applying greedy algorithm to cost matrix

Frank's user avatar

The answer of your post question (already given in Yuval comment) is that there is no greedy techniques providing you the optimal answer to an assignment problem.

The commonly used solution is the Hungarian algorithm, see

Harold W. Kuhn, "The Hungarian Method for the assignment problem", Naval Research Logistics Quarterly, 2: 83–97, 1955

for the original paper.

Otherwise your solution seems correct to me, and as usually with greedy algorithms, it will provide you a feasible solution which you may hope to not be "too far" from the global optimal solution.

Seb Destercke's user avatar

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged algorithms greedy-algorithms assignment-problem or ask your own question .

Hot Network Questions

algorithm assignment scheduling problem

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

IMAGES

  1. -Scheduling Algorithm Block Diagram.

    algorithm assignment scheduling problem

  2. Assignment Problem and Hungarian Algorithm

    algorithm assignment scheduling problem

  3. A* Algorithm Example PPT

    algorithm assignment scheduling problem

  4. linear programming

    algorithm assignment scheduling problem

  5. Priority Scheduling (Solved Problem 2)

    algorithm assignment scheduling problem

  6. Scheduling Algorithms with types in details and suitable examples

    algorithm assignment scheduling problem

VIDEO

  1. 4.2 C Types of Scheduling Algorithm

  2. Scheduling Algorithm

  3. Scheduling Algorithms(2021.08.18)

  4. Analysis of Algorithm (WEEK#6, PART#4) Methods to Compute Time Complexity Examples

  5. genetic algorithm assignment video

  6. Operating Systems

COMMENTS

  1. PDF Scheduling Problems and Solutions

    There is an algorithm that optimally solves the problem with time complexity O((n ⋅log(max p j))k) for some fixed k. NP-hard in the ordinary sense (pseudo polynomial time complexity): The problem cannot be optimally solved by an algorithm with polynomial time complexity but with an algorithm of time complexity O((n ⋅max p j)k).

  2. Hungarian Algorithm for Assignment Problem

    Step 4: Since we only need 2 lines to cover all zeroes, we have NOT found the optimal assignment. Step 5: We subtract the smallest uncovered entry from all uncovered rows. Smallest entry is 500. -500 0 2000 -500 1500 500 0 0 0 Then we add the smallest entry to all covered columns, we get 0 0 2000 0 1500 500 500 0 0 Now we return to Step 3:.

  3. Assignment problem

    The assignment problem consists of finding, in a weightedbipartite graph, a matchingof a given size, in which the sum of weights of the edges is minimum. If the numbers of agents and tasks are equal, then the problem is called balanced assignment. Otherwise, it is called unbalanced assignment.[1]

  4. algorithms

    The problem is NP-hard, at least for a particular simplified configuration. Assume that each m l is effectively infinite - we can scan a particular libraries' books all on the day we get access. Let all d l = 1 - each library takes one day to get access to, meaning we get access to exactly n libraries.

  5. Scheduling in Greedy Algorithms

    Many scheduling problems can be solved using greedy algorithms. Problem statement: Given N events with their starting and ending times, find a schedule that includes as many events as possible. It is not possible to select an event partially. Consider the below events: In this case, the maximum number of events is two.

  6. Job-shop scheduling

    The basic form of the problem of scheduling jobs with multiple (M) operations, over M machines, such that all of the first operations must be done on the first machine, all of the second operations on the second, etc., and a single job cannot be performed in parallel, is known as the flow-shop schedulingproblem.

  7. Scheduling algorithm/problem

    change that solution by just changing a few assignments and recalculate the ponderation if 2. is better than 1. and repeat starting with 2. as the root solution if you're blocked, you can "visit" other solutions by making important changes to the initial solution. Share Improve this answer Follow answered Oct 20, 2009 at 22:03 Vladimir

  8. PDF CMSC 451: Lecture 7 Greedy Algorithms for Scheduling Tuesday, Sep ...

    Fig. 2: An example of the greedy algorithm for interval scheduling. The nal schedule is f1;4;7g. Second, we consider optimality. The proof's structure is worth noting, because it is common to many correctness proofs for greedy algorithms. It begins by considering an arbitrary solution, which may assume to be an optimal solution.

  9. PDF 3.1 Introduction 3.2 Minimum Makespan Scheduling

    3.2 Minimum Makespan Scheduling A central problem in scheduling theory is to design a schedule such that the last nishing time of the given jobs (also called makespan) is minimized. This problem is called the minimum makespan scheduling. Problem De nition Given processing times for n jobs, p1;p2;:::;pn, and an integer m, nd an assignment of the ...

  10. scheduling

    This is a mapping problem: you need to map to every hour in a week and every teacher an activity (teach to a certain class or free hour ). Split the problem: Create the list of teachers, classes and preferences then let the user populate some of the preferences on a map to have as a starting point.

  11. An ILP representation of a DAG scheduling problem

    The Restricted Assignment Scheduling Problem (RASP), the problem that was proposed by Bertogna () as an example of the kinds of complex multiprocessor scheduling problems that arise in the analysis of modern safety-critical real-time systems, may be described in the following manner.We have a real-time workload that is modeled as a directed acyclic graph \(G=(V,E)\), in which the vertices ...

  12. PDF A Genetic Algorithm for the Teacher Assignment Problem for a University

    different subproblems: course timetabling, class-teacher timetabling, student scheduling, teacher assignment, and classroom assignment. This paper focuses primarily on the teacher assignment problem.

  13. Classroom scheduling using heuristics and genetic algorithm

    In the genetic algorithm solution, the problem is being broken down into 2 sections i.e. a) The assignment of teachers to each subject of each class since each subject of each class can only be taught by 1 teacher as in Rule 5. b)The assignment of classes to each class.

  14. Algorithms

    Optimization problems are ubiquitous in logistics, where the scheduling, sequencing and assignment of activities and resources have a significant impact on operational efficiency. These optimization problems are encountered across the entirety of the modern supply chain: sequencing orders on production lines, scheduling cranes in container ...

  15. PDF An approximation algorithm for the generalized assignment problem

    Key words: Approximation algorithms, generalized assignment problem, scheduling unrelated parallel machines. 1. Introduction The generalized assignment problem can be viewed as the following problem of scheduling parallel machines with costs. Each of n independent jobs is to be processed by exactly one

  16. Solving Job Scheduling Problem Using Genetic Algorithm

    Genetic algorithms are known to give the best solutions to such problems. The purpose of this paper is to propound a solution to a job scheduling problem using genetic algorithms. The experimental results show that the most important factor on the time complexity of the algorithm is the size of the population and the number of generations.

  17. Get Started with OR-Tools for Python

    Assignment. Assignment problems involve assigning a group of agents (say, workers or machines) to a set of tasks, where there is a fixed cost for assigning each agent to a specific task. The problem is to find the assignment with the least total cost. Assignment problems are actually a special case of network flow problems. Learn more about ...

  18. Algorithms

    To solve the previous problem, we developed a new method, i.e., the multi-objective task scheduling optimization (MOTSO) model that consists of two algorithms, namely, the multi-objective particle swarm optimization (MOPSO) algorithm with our fitness function Alabbadi, et al. and the ranking strategy algorithm based on the task entropy concept ...

  19. Is there a greedy algorithm to solve the assignment problem?

    2. The answer of your post question (already given in Yuval comment) is that there is no greedy techniques providing you the optimal answer to an assignment problem. The commonly used solution is the Hungarian algorithm, see. Harold W. Kuhn, "The Hungarian Method for the assignment problem", Naval Research Logistics Quarterly, 2: 83-97, 1955.