|Top Previous Next|
total load is within the capacity and cost of travel is minimized for all customers.
Normally you will have many more customers than centers.
Demand should be a much smaller number than capacity. Otherwise the algorithm isn't very good at finding a solution.
Optimum results can only be achieved if demand is the same value for all customers. Such as 1.
If Demand parameter is nil (not set), the algorithm assumes 1 for all customers.
The function returns the cost of the solution.
The heuristics parameter can take three values, 1, 2 and 3. With method 1 you will typically get the lowest
overall cost values, while method 2 gives "nicer" looking solutions, but requires more time to get the solution.
We recommend trying both and pick the result you prefer.
Method 3 give similar results as method 2, but requires demand=1 (or nil) for all customers. It is ~5 times faster.
Sample calculation time (demand = 1 for all customers, random center capacity, but sufficient in total):
Syntax: District(heuristic: integer): TCost;
This is an example with 100 customers, assigned to 10 centers with varying capacity.
Customers and centers are connected with lines to make the result easier to view: