### Costs

This part concerns the cost constraints. The TourSolver engine bases its calculations on these constraints to optimize the routes. Its first priority is to suggest the route with the lowest total cost, while respecting the other constraints. This is why it is important to consider these constraints, when deliberating about cost, we are talking above all about weight. For the TourSolver application, there is no notion of monetary cost, but of a weighting.

#### Pay whole day (payWholeDay)

This constraint allows you to indicate whether all the times in the day are accounted for or just those used.

If the button is set to Disabled, only the worked hours are used for the calculation.
If the button is set to Enabled, all the hours in the day are used for the calculation.

This constraint has an impact on the way the resources' plannings are filled.

Example:

For 2 resources A and B: Hourly cost = 20 Work time = 08:00 and 18:00

If Pay whole day is disabled

TourSolver may suggest this planning:

In this case, resource A will therefore work 8 hours and resource B will work 2 hours. This means a total cost of 200 is calculated by TourSolver (8*20+2*20).

If Pay whole day = 1

TourSolver may suggest this planning:

Resource A works therefore 10 hours and resource B works 0 hours. This means the total cost is 200 (10 * 20) as calculated by TourSolver and only one single resource is used.

#### Fixed cost of the resource used (useInPlanningPenalty)

This constraint allows you to indicate a fixed daily employment cost for the resource, that will be applied to each day the resource is deployed on a route.

Format: number

Example:

The delivery company fleet is made up of an existing resource A and a commissioned (subcontracted) resource B. In this case, the company will prefer to use their own resource with the defined Hourly cost and Cost per km constraint values, and then further down the line the commissioned resource who will have a defined daily utilisation rate or Fixed cost of the resource used.

For resource A:
Hourly cost = 20
Journey cost = 1
Fixed cost of the resource used = 0

For resource B:
Hourly cost = 0
Journey cost = 0
Fixed cost of the resource used = 600

Route 1/2

This route costs 3 hours of work (12-9) and 200 kms (100+50+50). To deliver to these 2 customers, TourSolver will calculate which of the resources A and B will be the least costly.

Resource A = 240 (20*2h + 1*200km + 0)
Resource B = 600 (0*2h + 0*200km + 600)

In view of the total route cost, TourSolver will choose to use Resource A to fulfill this route.

Route 2/2

This route costs 6 hours of work (15-9) and 550 kms (250+150+150). To deliver to these 2 customers, TourSolver will calculate which of the two resources A and B will be least costly to use:

Resource A = 670 (20*6h + 1*550km + 0)
Resource B = 600 (0*6h + 0*550km + 600)

In view of the total route cost, TourSolver will choose to use Resource B to fulfill this route.

#### Resource daily cost not used (nonUsePenalty)

This constraint allows you to indicate a fixed daily non-use cost for the resource, that will be applied each day where the resource is not used on a route. This constraint can be used to integrate within the optimisation calculation the costs incurred by a company even when the resource is immobilised (depreciation, parking, …).

Format: number

Example:

For Resource A:
Resource daily cost not used = 0

And for Resource B:
Resource daily cost not used = 600

1) If TourSolver chooses to deploy Resource A, then this route will cost 600 (0+600) since the non-utilised Resource B, will nonetheless still cost 600.

2) If TourSolver chooses to deploy Resource B, then this route will cost 0 (0+0) since the non-utilised Resource A will not cost anything, unlike Resource B.

The result will be that TourSolver will select the second solution.

#### Resource request cost (usePenalty)

This constraint allows you to indicate a fixed cost for deploying the resource for the whole of the route, which will be applied as soon as the deployment takes place. Unlike the Fixed cost of the resource used this constraint does not apply to each day worked by the resource, but applies as from the first day worked.

Format: number

#### Cost km 2 to 4

Format: number

Threshold [distance_2…4]: This constraint allows you to indicate a distance threshold, above which, a different cost will apply.

Cost [penalty_2…4]: This constraint allows you to indicate the cost per journey unit (kms, miles…) travelled by the resource over and above a certain distance defined under the Threshold constraint.

Example:

For a company the fleet of which is made up of commissioned resources travelling numerous kilometers.

Cost per km = 1
Cost km 2 Threshold = 1000
Cost per km 2 = 1,5
Cost km 3 Threshold = 1500
Cost per km 3 = 2
If this transporter travels 2000 km during the week, then the total kilometer cost = 4000 (2000 x 2). This is the Cost per km 3 = 2, as indicated for Cost km 3 Threshold that is applicable because 2000 > 1500.

#### Fixed visit cost (penaltyPerVisit)

This constraint allows you to define, for each resource, a fixed cost to add to each visit fulfilled by the resource. In this way, TourSolver will add this cost to the global cost for the resource.

Format: number

Example:

For Resource A, Fixed visit cost = 0,
For Resource B, Fixed visit cost = 2.

TourSolver will seek to fill the planning of Resource A first, since the cost of the route is lower than the equivalent route of Resource B, who has a global cost that is incremented as a function of the number of visits.

Example of a route calculated and selected by TourSolver:

The overall cost of this route is calculated at 4 (2+2+0+0+0+0).

Example of routes not selected by TourSolver:

The global cost of this route is 6 (2+2+2+0+0+0).

The global cost of this route is 8 (2+2+2+2+0+0).