Replies: 1 comment
-
|
I think I've found the reason; it's stuck in local optimization. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, everyone!
I have a scenario where I need to allocate jobs to resources and determine the number of jobs in each resource.
I defined a class
Allocationthat generates a list ofAllocationobjects by taking the Cartesian product of the jobs and resources.Allocationhas a planning variableallocatedQty, which is the quantity of jobs a resource should handle. This variable's value (which I define asquantityRange) ranges from 0 to the quantity of jobs. The code snippet for theAllocationclass is as follows:I have only two constraints: "Ensure that the sum of the quantities of a job allocated to each resource equals the quantity of jobs" - method name "jobQuantityAlignment".
And another constraint is "Make the quantities of a job allocated to each resource as balanced as possible" - method name "resourceQuantityBalance".
The code for these two constraints is as follows:
For instance, there are 2 jobs, Job A with quantity 10, and Job B with quantity 20.
And there are 3 resources: Resource 1, Resource 2, Resource 3, and Resource 4.
For Job A, the resources that can be allocated are Resource 1 and Resource 2.
For Job B, the available resources are Resource 3 and Resource 4. This will result in four allocations:
Allocation A1 - from Job A and Resource 1, with a quantity range of 0 to 10
Allocation A2 - from Job A and Resource 2, with a quantity range of 0 to 10
Allocation B3 - from Job B and Resource 3, with a quantity range of 0 to 20
Allocation B4 - from Job B and Resource 4, with a quantity range of 0 to 20
My desired solution is:
Allocation A1: 5
Allocation A2: 5
Allocation B3: 10
Allocation B4: 10
But now, the solution is:
Allocation A1: 10
Allocation A2: 0
Allocation B3: 20
Allocation B4: 0
The log looks like this:
Why is this? The resourceQuantityBalance score has been consistently difficult to optimize.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions