0

As mentioned in the tags, this is homework, using only standard java libraries.

The task is to create a program that schedules orders (which consist of pizzas) to be cooked in different ovens. Orders have a dealine, which must be met and pizzas have a cook time and a cooldown time, inherently all pizzas must be cooked by the deadline but cannot be cooked so early that their time out of the oven exceeds the cooldown time. If it is determined that it is not possible to fulfil the order by the deadline an exception is thrown. The main problem I cannot get my head around is how would I make the program reschedule the ovens to fit a new order in.

I cannot think of how to start this and would really appreciate any help!

2
  • honestly, if you don't say at least what you tried or post some code you have problem with, I think will be difficult to receive answer to your question. Commented Sep 25, 2011 at 13:21
  • You say you are not able figure out rescheduling. Describe with code initial scheduling and then ask for specific help with rescheduling Commented Sep 25, 2011 at 13:29

3 Answers 3

1

A good place to start is to turn that middle paragraph into objects with behavior and state defied, eg

class Order 
List<Pizza> pizzas;

class Oven 
int maxPizzas;
List<Pizza> cooking;
cook(pizza: Pizza);

class Pizza 
int cookTimeMins; 
int coolTimeMins;
long cookTimeStart;

class PizzaShop 
List<Oven> ovens; 
List<Order> orders;
scheduleOrder(order: Order) throws Exception

From there start pseudo coding what you want to happen in the various methods. Start with those building blocks and you will find the problem becomes easier to solve when not looking at the problem as a whole, but in small chunks.

Sign up to request clarification or add additional context in comments.

Comments

1

You can start reading earliest deadline first scheduling.

It seem that your pizza processing time (cook + cool + etc.) can be calculated beforehand, so PriorityQueue could be helpful. The PizzaOrder would implement Comparable interface, which compares the deadline of the order.

Comments

0

It is hard to know with the information you provide, but it seems it could be a good scenario to use a rule engine such as JBoss Rules (Drools), if you want to experiment with it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.