Optaplanner Job-Shop scheduling solver

963 views
Skip to first unread message

shir....@gmail.com

unread,
Jun 24, 2016, 9:58:46 AM6/24/16
to OptaPlanner development
Hello,

I have some questions regarding Optaplanner Job-Shop scheduling solver:

  1. Can you please explain what is execution mode? 
  2. Resource Capacity - Are the values here represent the amount of resources I have? or are they man-hours?
  3. The Score that Optaplanner provides after solving a Job-Shop Scheduling problem represents as: xx/-yy/-zz. By my understanding so far, I assume that xx is the beginning of the project (for example if xx=0, the project starts on day 0), and zz is the final day of the project. Not sure, but I think that -yy represents the "Score" that the solution xx/-zz got from some algorithm that was applied at Opta.
    1. Are my assumptions correct?
    2. Why are yy and zz negative?
  4. Does anyone have the DB schema and the data that represents the XML of example A-1.xml on the Project Scheduling Example? I've tried to map the XML into DB schema but it was impossible for me.

Thanks for your time,
Shir

Geoffrey De Smet

unread,
Jun 24, 2016, 10:06:07 AM6/24/16
to optapla...@googlegroups.com


With kind regards,
Geoffrey De Smet

On 24/06/16 15:58, shir....@gmail.com wrote:
Hello,

I have some questions regarding Optaplanner Job-Shop scheduling solver:

  1. Can you please explain what is execution mode?
A way to enable assertions to detect bugs in your implementation, at the expense of performance. See docs for more info.

  1. Resource Capacity - Are the values here represent the amount of resources I have? or are they man-hours?
In the VRP example, they're whatever unit of measurement you decide to make them.
If you need 2 types of capacity, just refactor the model to have for example int weightCapacity and int monetaryValueCapacity;

  1. The Score that Optaplanner provides after solving a Job-Shop Scheduling problem represents as: xx/-yy/-zz. By my understanding so far, I assume that xx is the beginning of the project (for example if xx=0, the project starts on day 0), and zz is the final day of the project. Not sure, but I think that -yy represents the "Score" that the solution xx/-zz got from some algorithm that was applied at Opta.
    1. Are my assumptions correct?
no, it's the score. xx is hard score, zz is the soft score. See docs chapter 5.

    1. Why are yy and zz negative?
Because they are negative constraints, we want less of them, see docs chapter on positive vs negative constraints.

  1. Does anyone have the DB schema and the data that represents the XML of example A-1.xml on the Project Scheduling Example? I've tried to map the XML into DB schema but it was impossible for me.
There isn't one, but you annotate the domain objects with JPA-Hibernate annotations it should be possible to store it into a database. Of course if you want to match an existing DB schema you'll probably have to do some custom mapping.

HTH :)

Thanks for your time,
Shir
--
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-d...@googlegroups.com.
To post to this group, send email to optapla...@googlegroups.com.
Visit this group at https://groups.google.com/group/optaplanner-dev.
For more options, visit https://groups.google.com/d/optout.

shir....@gmail.com

unread,
Jun 24, 2016, 10:16:54 AM6/24/16
to OptaPlanner development, shir....@gmail.com
Hi again,

First of all thanks for your quick response!

I'm not sure I'm getting the 'execution mode' that has been used in the Job Shop Scheduling example (it contains a Job and a Resource, but how it's being used in the planning process?)

And regarding the Resource Capacity - what is it stand for in the Job Shop Scheduling example? (the renewable and nonrenewable)..


Thanks so much!

Osamu Kuniyasu

unread,
Jun 24, 2016, 8:11:34 PM6/24/16
to OptaPlanner development, shir....@gmail.com

[1] ExecutionMode in the Project Job Scheduling

The ExecutionMode in the Project Job Scheduling is representing a way how to use your resources.

If you have two ways to use your resources for a Job, you will have two ExecutionModes to represent it.

For examples,
 EM-1) Job-1 can be assigned to two Persons then the job can be finished in 1 day.
 EM-2) Job-1 also can be assigned to single Person then the job can be finished in 2 days.

Two ExcecutionModes (EM-1 and EM-2) need to be prepared for the Job-1.

FYI, I generated ExecutionModes for OptaPlanner by Drools Rules in my more complex model which was based on the Project Job Scheduling.


[2] The unit of the resource capacity

The unit of the resource capacity is depends on how to map the real situation into the model.

For examples,
 Res-1) A Resource instance is a Resource pool, the Resource capacity is max number of peoples in the Resource pool.
 Res-2) A Resource instance is a Person, the Resource capacity is max number of capacity.
             for example, if Person-1 can do multiple Jobs same time. define Person-1 has 100% capacity maximum.
             and Job-a (more precisely its one of ExecutionModes) requires 50% of Person-1, Job-b requires 50% of Person-1 as well.
             then Job-a and Job-b can be assigned to Person-1 with overlapping timing.

hope it helps,
Osamu Kuniyasu

2016年6月24日金曜日 23時16分54秒 UTC+9 shir....@gmail.com:

Osamu Kuniyasu

unread,
Jun 24, 2016, 8:21:55 PM6/24/16
to OptaPlanner development, shir....@gmail.com

[3] Resource's renewable and nonrenewable flag

 - renewable means the capacity is "daily" capacity. (if the time generality is day)
 - nonrenewable means the capacity is accumulated total capacity of the whole scheduling window.

In the Project Job Scheduling example, A Resource is a Resource pool. so...

  - renewable 10 capacity means your have 10 people available in the Resource (pool) everyday.
  - nonrenewable 10 capacity means you have 10 man-days available in the Resource (pool) in the whole scheduling window.

Best Regards,
Osamu Kuniyasu

2016年6月25日土曜日 9時11分34秒 UTC+9 Osamu Kuniyasu:

shir....@gmail.com

unread,
Jun 25, 2016, 6:09:55 AM6/25/16
to OptaPlanner development, shir....@gmail.com
Hi Osamu,

Thanks so much for your detailed explanation! I think I got it :)

One more thing - Can you please explain regarding the Score that Opta provides after Solving a Job-Shop Scheduling problem? (represents at xx/-yy/-zz).
Although Geoffrey referred me to Chapter 5 which I've read, there is only a general explanation regarding Scores, and I will be happy to get an explanation regarding Job Shop Scheduling score specifically (and it's negative values...).

Thanks a lot,
Shir


On Friday, June 24, 2016 at 4:58:46 PM UTC+3, shir....@gmail.com wrote:

shir....@gmail.com

unread,
Jun 25, 2016, 9:42:54 AM6/25/16
to OptaPlanner development, shir....@gmail.com
Also, 
Can you please explain the "AllocationList" and what it means? (I see it in a different section of the XML, and I don't understand why there is no reference from the Job itself to the AllocationList)

What is the "PredecessorAllocationList" and the "SuccessorAllocationList" in the AllocationList?

Thanks,
Shir

Osamu Kuniyasu

unread,
Jun 25, 2016, 8:10:16 PM6/25/16
to OptaPlanner development, shir....@gmail.com

There are some ways to know about Scores.

 [1] documents 
 [2] score rules source
 [3] extract the result score details by API (require to add some codes)

I see that you are not sure what is the unit of scores from the document [1].

Hard constraints' unit is man-day in this example.
if the result exceeded 1 man-day of capacity, the hard score is -1.
It is minus value because it is bad, like penalty.

FYI, in one of my real problems, the unit is man-(20minutes) instead of man-day. because time granularity is 20 minutes.

Medium constraints' unit is day. how many days delay from the specified date of the project, the critical path end date.
it is also minus value because it's delay.

FYI, in my real problem, I used (the due date) of projects instead of the critical path end date,
       then I added Soft PLUS constraint if the project end earlier than the due date.

Soft constraints' unit is day. the maximum date of all projects' end.
it is also minus value because earlier is better.

Best Regards,
Osamu Kuniyasu

2016年6月25日土曜日 19時09分55秒 UTC+9 shir....@gmail.com:

Osamu Kuniyasu

unread,
Jun 25, 2016, 8:49:23 PM6/25/16
to OptaPlanner development, shir....@gmail.com

Allocation is the Problem Entity in the Project Job Scheduling, which owns Problem Variables such as
 - ExecutionMode (assignment Job to one of its ExecutionModes)
 - delay (delay start from the preceding Jobs' end)

The relation between Job and Allocation is one-to-one in single solution.

While solving the problem, Planner engine find many solutions.
Allocation is copied (cloned) as new solution is found.

If a Job has its Allocations, it should be Map<Solution, Allocation>.
it is complex to maintain as Solution is generated and removed very quickly.
As there are many Allocations for a Job, Job don't have link to Allocation.
instead, Solution has AllocationList.
This is convenient because the cloning is initiated by Solution.

Allocation has PredecessorAllocationList and SuccessorAllocationList.
SuccessorAllocationList is for propagation of changes.
if Planner engine changed an Allocation's delay or/and ExecutionMode,
it impacts to the successor Allocations.
PredecessorAllocationList is for calculation of the start day based on
the end of all predecessor Allocations + delay.

Best Regards,
Osamu Kuniyasu

2016年6月25日土曜日 22時42分54秒 UTC+9 shir....@gmail.com:

shir....@gmail.com

unread,
Jun 26, 2016, 1:04:49 PM6/26/16
to OptaPlanner development, shir....@gmail.com
Thanks so much Osamu,

BTW is there a way to export the "solved" XML into a readble format? (such as mm file as an output or similar),
For example if I want to see what is the order of the jobs in my project, which worker execute each job, etc.

Thanks,
Shir

Osamu Kuniyasu

unread,
Jun 26, 2016, 9:56:59 PM6/26/16
to OptaPlanner development, shir....@gmail.com

There is not out of the box way.
You need persistent entity classes for target format then populate these instances by accessing Planner entities in the Planner solution.

I have implemented custom exporters in my customers' projects to save the Best Solution in CSVs and in special XML formats of a Gantt Chart implementation.

Best Regards,
Osamu Kuniyasu

2016年6月27日月曜日 2時04分49秒 UTC+9 shir....@gmail.com:

javier.r...@gmail.com

unread,
Jun 19, 2017, 4:14:52 AM6/19/17
to OptaPlanner development, shir....@gmail.com
Hi Osamu,

I'm trying to do the same (i.e., exporting the solution: jobs-resources) using the allocation list from the solution. But I have some problems because, although the score is OK, when I extract the resources assigned to each job from the allocationList, I see that they are kind of wrong (one of my constraints has not been met). If I retry doing the same example a random number of times, sometimes the result is OK.

I'm thinking that maybe I am extracting the solution from the wrong place, because this allocation list seems to be changed while the solver is calculating new possible solutions.

I have also tried to read the bestsolution with the same results.

Any help would be greatly appreciated.

Kind regards,
Javier Ruiz

javier.r...@gmail.com

unread,
Jun 19, 2017, 4:42:48 AM6/19/17
to OptaPlanner development, shir....@gmail.com, javier.r...@gmail.com
Doesn't mind, it was a problem with the way I was calculating one of my hard constraints.

Regards.

Kent Zhang

unread,
Sep 6, 2017, 10:54:37 AM9/6/17
to OptaPlanner development, shir....@gmail.com, javier.r...@gmail.com
Hi Osamu,

     your explanations are so useful for my cases. There is another restriction in my project: not all the resources are the same, many resources could only assigned to particulare jobs. So, my idear is, add a property in class Resources class named "skill", and add the same property in class Job named "skillRequest". And make a rule to check if the jobs are assigned to the resource which has the right skill, if the rule was break, add a minus value score, is that right? 

在 2017年6月19日星期一 UTC+8下午4:14:52,javier.r...@gmail.com写道:

javier.r...@gmail.com

unread,
Sep 6, 2017, 10:58:06 AM9/6/17
to OptaPlanner development, shir....@gmail.com, javier.r...@gmail.com
Hi,

I have implemented skills, as you have explained, with success; so, it should work for you.

Regards,
Javier Ruiz 

osamu.k...@gmail.com

unread,
Sep 6, 2017, 6:50:36 PM9/6/17
to OptaPlanner development
What I did for my customer was,
- input skill map with level.
- level-0 is no skill, level-1 is on training,
level-2 is good, level-3 is expert.
- preprocessing by Drools Rules to generate
ExecutionModes for Planner
- regarding level-2 and level-3,
ExecutioMode has a different duration as the expert can do faster.

So, I actuality cut options to assign level-0 for Planner in the preprocessing.

Hope it helps,
Osamu Kuniyasu

Kent Zhang

unread,
Sep 6, 2017, 8:47:05 PM9/6/17
to OptaPlanner development
Great!, Thank you!.

在 2017年9月6日星期三 UTC+8下午10:58:06,javier.r...@gmail.com写道:

张健彪

unread,
Sep 6, 2017, 11:02:35 PM9/6/17
to optapla...@googlegroups.com
got it, thank you! 


--
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-dev+unsubscribe@googlegroups.com.
To post to this group, send email to optaplanner-dev@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages