1 / 32

Job Scheduling and Chronobot

Job Scheduling and Chronobot. Outline. What are Chronobots? Job Scheduling Problems Examples Reductions * Hill Climbing * Bin Packing Efficiency Term Project. What are Chronobots?. The chronobot is a device for storing and borrowing time in addition to knowledge.

Download Presentation

Job Scheduling and Chronobot

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Job Scheduling and Chronobot

  2. Outline • What are Chronobots? • Job Scheduling Problems • Examples • Reductions • * Hill Climbing • * Bin Packing • Efficiency • Term Project

  3. What are Chronobots? • The chronobot is a device for storing and borrowing time in addition to knowledge. • Time can be exchanged or sold for money. • Logical extension of Blog, which only exchanges knowledge. • Exchange of individualized time.

  4. Formal Model and Characteristics of Chronobot • Identify time/knowledge for exchange. • Search for exchange partner(s). • Bidding and negotiations. • Manage the exchange of time/knowledge. • Evaluate the results. • Time/Knowledge Manager: manages not only one’s own time but also other people’s time through exchange. Perform information fusion to produce knowledge from multiple users. • E-learning and distance education; offers a virtual classroom that combines the features of chat room, white board, and multimedia display.4

  5. Example of Job Scheduling Problem • People who wish to contribute their time then place bids by submitting timetables indicating the time they may contribute. • The system then determines the best allocation of time from these bidders.

  6. Heuristics We Wish to Optimize There are several heuristics one may wish to optimize for allocating from these bids, depending on the application. • Minimize the number of bidders utilized. • Minimize the amount, in money or trade ratios, that one will pay. • Maximize compatibilities and minimize time if different persons can complete jobs in different amounts of time. • Combination of these heuristics.

  7. Problem Constraints Possible constraints in a job scheduling problem include: • Travel time between assignments if certain people will be assigned more than one job consecutively. • Some jobs require a specific time and place while other do not. • Compatibility issues.

  8. Example of Job Scheduling Problem • A person(s) who needs to borrow/buy time posts his workload schedule onto the system, describing the exact table of times he wishes to borrow/buy. See example.

  9. Example of Job Scheduling Problem • Bidders who wish to contribute time can post similar time-tables. In the example to the right the match is shown in bold. • Extensions to the problem may require other information to be posted: • If there are multiple people wanting to buy/borrow time, one may be interested in the transition time between jobs, such as the commute time between geological locations. • Buyers may be more flexible if their jobs can be completed at more than one possible time interval. • We may wish to assign a compatible score or a cost between each seller and each job, which can be included in part or whole in our scheduling heuristic.

  10. Brute-Force Algorithm • A brute-force algorithm for job scheduling iteratively attempts to assigns each time slot that the buyer(s) wish to buy (there are 4 in this example) to each potential seller and checks for consistency. • Runs in complexity O(S^T) where S is the number of sellers and T is the amount of time traded.

  11. Hill Climbing • Hill climbing is an optimization technique which belongs to the family of Local search (optimization). It attempts to maximize (or minimize) a heuristic function f(x) for discrete states x. • States are vertices in a graph where edges encode nearness or similarity. • Simple hill climbing may find local maximums. • Ways to overcome this problem include stochastic hill climbing, random walks, simulated annealing, and Ramdom-Restart hill climbing.

  12. Genetic Algorithm • Computer simulation of a population of abstract representations of candidate solutions evolving toward better solutions. • A typical genetic algorithm requires two things: • A genetic representation of the solution domain, traditionally a binary string • A fitness function to evaluate the solution domain • Usually starts from a population of randomly generated individuals and happens in generations. • In each generations, the fitness of every individual is evaluated and stochastically selected to form a new population.

  13. Simulated Annealing • Simulated Annealing addresses the issues of local maximums (minimums) by allowing for downhill (uphill) moves. • Inspired by annealing in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. • Each step of the simulated annealing algorithm replaces the current solution by a random “nearby” solution, chosen with a probability that depends on the difference between the corresponding function values and a global parameter T (temperature).

  14. Job Scheduling and Genetic Algorithms • In Job Scheduling, one can represent solutions as a string of sellers to indicate which seller will be covering each buyer-time period tuple. • Fitness can be defined as the number of conflicts in each candidate solution, being zero for a correct solution.

  15. Relationships to Bin Packing Problem Bin packing problem: • Given objects of different sizes • Given a bin size • Want to minimize the number of bins used to pack these objects. Common applications in Bin-Packing include • filling up containers • loading trucks with weight capacity • creating file backup in removable media

  16. Bin Packing Heuristics Common Heuristics for Bin-Packing include: • Next fit: place in right-most bin, starting a new bin if necessary (does not go back to old bins). • First fit: left-most bin that still has enough room. • Last fit: right-most bin that still has enough room, starting a new bin if necessary. • Best fit: fullest bin that still has room. • Worst fit: emptiest bin that still has room.

  17. Bin Packing Example • Suppose we have bins of capacity 10 and we wish to pack items of size 3, 6, 2, 1, 5, 7, 2, 4, 1, 9. • The optimal solution uses 4 bins (3+2+5, 6+4, 1+7+2, 1+9).

  18. Bin Packing as a Job Scheduling Problem • The Bin Packing problem can be thought as a special case of the Job Scheduling problem. • The items to be packed are jobs requiring a fixed amount of time to be scheduled, where there are no time/geographical constraints. • The bins are bidders, and all bidders can cover an fixed amount of time. • There is no transition time between jobs.

  19. Next-Fit Heuristic • Next-fit has the advantage of allowing us to finalize bins before we pack everything. This may be useful in some applications such as filling trucks for a delivery

  20. First-Fit Heuristic • First-Fit is an extension of Next Fit that allows us to go back to old bins if they will fit. However, we lose the advantage of being able to finalize bins unless they are completely filled.

  21. Efficiency of Algorithms • First Fit Decreasing strategy, operates by first sorting the items to be inserted in decreasing order by volume, and then inserting each item into the first bin in the list with sufficient remaining space. • no more than 11/9 OPT + 1 bins (where OPT is the number of bins given by the optimal solution • Sorting operation is time-expensive (O(n log n) on top of an O(n) algorithm), but without it one obtains a looser bound of 17/10 OPT + 2 bins.

  22. Tentative Term Project Plans • Heuristics for various different sets of Job Scheduling problems that are restricted in some way. • Possible restrictions include: • * No transition time. This is a practical assumption in online jobs. • * Fixed transition time. This is practical when the transition times are fairly small and close together, such as talking about jobs within the Pittsburgh area. In this case we can always use the worst-case transition time without too much sacrifice. • * Eliminate compatibility issues (i.e. everybody can complete jobs in same amount of time for same amount of cost or trade ratios.) This is a more reasonable assumption when all the jobs are closely related or mostly involve labor rather than knowledge.

  23. Term Project • Assumptions I made in job scheduling problem • Constant transition time between tasks; this is a reasonable assumption when transition times are relatively small, such as tasks within Pittsburgh. • Wish to minimize the number of sellers we use.

  24. Genetic Algorithms • Computer simulation of a population of abstract representations of candidate solutions evolving toward better solutions. • A typical genetic algorithm requires two things: • A genetic representation of the solution domain, traditionally a binary string • A fitness function to evaluate the solution domain

  25. Genetic Algorithms for Job Scheduling • We represent solutions as a string of sellers who will cover each buyer/time tuple. These solutions can produce offspring by mutation , such as random changes to one or two numbers in the solution, or crossover, meaning a merging of two solution. • The fitness function will need to measure two goals; how good is our solution to being a legitimate solution without any conflicts, and given it is a legitimate solution how good is it in terms of heuristics that we wish to maximize/minimize, such as the number of sellers used.

  26. Data Representation /* Number of time slots in the schedule */ public static int numTimeSlots; /* The amount of time we need to transistion between different tasks */ public static int transistionTime; /* Total number of buyers and sellers */ public static int numSellers; public static int numBuyers; /* Array of sellers, each one being an array for their timetable */ public static boolean[][] Sellers; /* Array of buyers, each one being an array for their timetable */ public static boolean[][] Buyers;

  27. Conflict checking /* Solutions are given as an array indicating the seller for each (buyer, time) tuple */ public static int numConflicts (int[][] BuyerTimes) { int count = 0; for (int B=0; B<numBuyers; B++) { for (int T=0; T<numTimeSlots; T++) { int S = BuyerTimes[B][T]; if (S==-1) { if (Buyers[B][T]) count++; /* No sellers covering this (buyer, time) tuple */ continue; } /* Seller not available at this time */ if (Sellers[S][T]==false) { count++; } /* Check for conflicts within the transition time interval */ for (int i=0; ((i<transistionTime) && ((T+i)<numTimeSlots)); i++) for (int B2=0; B2<numBuyers; B2++) { if (B==B2) continue; /* Same task; no need to check conflicts */ int S2 = BuyerTimes[B2][T+i]; if (S2==-1) continue; /* No conflict; no task at conflicting time */ if (S2==S) count++; /* Conflict of seller S with tasks from buyers B and B2 */ } } }

  28. Heuristic Functions • Return a negative integer if there is a conflict to indicate how many conflicts we have; otherwise return a non-negative integer to indicate how good our solution is. /* Heuristic function */ public static int score (int[][] BuyerTimes) { /* Return a low score if there are a lot of conflicts. */ int NC = numConflicts (BuyerTimes); if (NC > 0) return (-NC); /* Return a high score if fewer sellers are used in the correct solution. */ boolean[] SellerUsed = new boolean[numSellers]; for (int i=0; i<numSellers; i++) SellerUsed[i]=false; for (int B=0; B<numBuyers; B++) for (int T=0; T<numTimeSlots; T++) { int S = BuyerTimes[B][T]; if (S!=-1) SellerUsed[S] = true; } int count=0; for (int i=0; i<numSellers; i++) if (SellerUsed[i]) count++; /* The fewer the number of sellers used the higher the score should be */ return numSellers-count; }

  29. Genetic Algorithm • Mutation: Randomly change each entry with a probability of 1/(numBuyers*numTimeSlots). In other words, we change about one entry on the average case, but can, in theory, change all of the entries. • By doing it this way we allow all solution nodes to be connected and reduce the potential for local maximums. for (int i=0; i<numBuyers; i++) ░ for (int j=0; j<numTimeSlots; j++) { ░ ░ if (numBuyers*numTimeSlots*Math.random() < 1.0) Solution[i][j] = (int) ( numSellers * Math.random() ); ░ /* Randomly mutate some solution slots */ ░ } ░

  30. Testing • The algorithm is tested by assigning numTimeSlots = 20, transistionTime = 2, and varying the number of buyers and sellers. The timetables are determined randomly with each slot being available with a probability of 1/2. • The complexity is measured by the average number of iterations required to reach a non-conflicting solution.

  31. # Iterations to Reach Non-Conflicting Solution

  32. Observations • It appears that for cases where the number of sellers is a lot greater than the number of buyers, the complexity of this algorithm is independent of the number of sellers. • However, it appears to be difficult to decide when the algorithm has reached its local maximum as it often makes a jump after many iterations.

More Related