Goodmorning everyone, i'm working on recoding of timefold.ai school time tabling to create a job shop scheduling for industrial production, i "trasformed" Lesson class into Orders, Teacher into working operators, and group subject into product material using the same constraintProvider class and changing timeslot from 1 hour timeslot into 15 minutes timeslot, like that when i insert a new order into the DemoResource class I divide for example 3 hours production into 15 minutes slot so like that I suppose the programe should organize the orders on that characteristics. When I run the program it work on 6 machine simultaneously but place in a 15 minutes slot more than one order slot. How should I fix this problem? another question... if i would like to pass a JSON file with my orders data to my timefold instead of using the DemoResource class, How could i do that?

This is my work so far: https://github.com/EdoZp1/TimeFold-IndustrialProduction-EdoardoZoppi

1

There are 1 best solutions below

3
On

Generally, if a solver gives you a solution in which there is a situation you don't like, you need to identify the situation and write a constraint to penalize that situation. In this case, you need to write a hard constraint to penalize every time the solver puts two jobs in the same slot. Something conceptually like this:

forEach(Order.class)
    .join(Order.class, Joiners.equal(Order::getSlot))
    .filter((order1, order2) -> order1 != order2)
    .penalize(...Score.ONE_HARD)
    .asConstraint("Two orders in the same slot.");

(Side note: I would be very cautious in applying the School Timetabling model to job shop scheduling. You will probably run into difficulties and will need to change the model, especially as you start trying to add dependencies between jobs. Unfortunately, we do not yet have a job shop scheduling quickstart for you to use.)

As to your JSON question, this is not directly related to Timefold Solver. You are effectively asking how to deserialize a Java object from JSON, and how to supply that JSON remotely; based on whether you're using Quarkus or Spring Boot, the answer will differ. But neither of the answers will be specific to Timefold Solver; I suggest you either Google for the answer, or ask another question here on StackOverflow.