Step 9: Finding the best equipment configuration

We have created a simulation model and we can use it to see how the system will perform given a certain number of trucks available for cargo transportation.

Optimal number of Trucks

Let’s use our model to find out the optimal number of trucks.

We will run several experiments using different Scenarios: in each scenario, the truck number will be different, while all other initialization parameters will be the same.

Go to the Main class and add a new runScenarioAnalysis() method:

Main.java, runScenarioAnalysis() method
private static void runScenarioAnalysis() {
    for (int numberOfTrucks = 1; numberOfTrucks <= 10; numberOfTrucks++) {
        Scenario scenario = new Scenario(   numberOfTrucks, 
                                            TRUCK_SPEED,
                                            INTERVAL_BETWEEN_REQUESTS_HRS,
                                            MAX_DELIVERY_TIME_HRS,
                                            warehouses,
                                            stores,
                                            routeLengthContainer,
                                            LocalDateTime.of(2023, 1, 1, 0, 0), 
                                            LocalDateTime.of(2023, 2, 1, 0, 0));
        runExperimentWithStats(scenario, "scenario");
    }
}

Note that the simulated period length has changed from 12 hours to one month.

Replace the main() method:

Main.java, updated main() method
public static void main(String[] args) {
    runScenarioAnalysis();
}

We have a lot of runtime information in the console output, so let’s mute it and leave only the final statistics output:

  • Go to the TransportationTask.execute() method and remove two 'System.out.println()' calls.

  • Go to the TransportationRequest constructor and remove the 'System.out.println()' call.

Check the result

Start the program. This is the output that should be printed out to the console:

Scenario                Trucks count    SL      Expenses        Expenses/SL
scenario                           1    0,27%   $ 26 040,00     $ 96 152,70
scenario                           2    1,02%   $ 52 008,66     $ 51 211,19
scenario                           3    2,23%   $ 77 859,98     $ 34 848,24
scenario                           4    5,35%   $ 103 458,21    $ 19 342,76
scenario                           5    91,08%  $ 119 586,46    $ 1 313,05
scenario                           6    99,93%  $ 127 026,46    $ 1 271,12
scenario                           7    100,00% $ 134 428,96    $ 1 344,29
scenario                           8    100,00% $ 141 806,46    $ 1 418,06
scenario                           9    100,00% $ 149 283,96    $ 1 492,84
scenario                          10    100,00% $ 156 686,46    $ 1 566,86

Let’s think about the simulation results.

We see that the best (i.e., the least) expenses-to-SL ratio is $ 1271.12 attained when the number of trucks is 6. So, here is the answer to our business-related question: 6 trucks is the optimum number.

If we increment the number of trucks, the Service Level increases, reaching its maximum of 100% when the number of trucks is 7, but it comes at a higher price.

What if we add even more trucks? The model output shows that there is no use adding the 8th truck: expenses will only get higher, but the Service Level is already at its top.