Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi, Teams and all.

I need to plan the jobs of products in a factory. Each job can be assigned to a particular machine. There are two workshops, A and B, which contain some machines. Now there is a rule: all jobs from the same product can only be assigned to machines that are in the same workshop.
For instance:

  • There are 2 workshops, WS-A and WS-B. WS-A has 2 Machines, M-A1 and M-A2, and another Workshop WS-B has 2 Machines M-B1 and M-B2.
  • There is a product that contains 2 jobs, Job1 and Job2. Job1 can be assigned to either M-A1 or M-B1, and Job2 can be assigned to either M-A2 or M-B2
  • If Job1 is assigned to M-A1, Job2 must be assigned to M-A2 and not to M-B2, as it belongs to workshop WS-B rather than workshop WS-A. If Job2 is assigned to M-B2, Job1 must be assigned to M-B1.

I can easily achieve this requirement by using a hard constraint, but it depends on the optimization. When a dataset is huge and a product has more jobs, it is difficult to ensure that this constraint can be fully satisfied. Is there a more direct way to achieve this requirement without using constraints?

Thanks in advance!

You must be logged in to vote

Replies: 1 comment · 5 replies

Comment options

We don't currently support re-loading of @ValueRangeProvider to do what you are suggesting here.

The 2 main ways to tackle this right now is either to:

  • Segregate the dataset. Change your problem so Jobs within the same Product only can be assigned to a single Workshop. This of course misses a large amount of optimization possibilities.
  • Keep the constraints, but add a custom move which moves these jobs together. This will avoid a bunch of moves that lead to nowhere.

Maybe the rest of the Solver team has other ideas on how to resolve this.

You must be logged in to vote
5 replies
@triceo
Comment options

You're spot on, Tom.

@kentbill
Comment options

got it, thanks @TomCools and @triceo
I think using constraints with a custom move seems more appropriate here.

@kentbill
Comment options

I am implementing the custom move, but the model uses PlanningListVariable. How can I implement a custom SwapMove with PlanningListVariable? I couldn't find any methods in the documentation, quick start, or even in the OptaPlanner examples. Do you have any ideas?

@triceo
Comment options

There is a generic implementation of ListSwapMove in the codebase.

@kentbill
Comment options

Thank you! @triceo.
I tried to refer to ListSwapMove. java to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.