top of page

The 4 soldiers riddle: A way to model task scheduling

This is a riddle for all Geeglee users, but anyone can give it a try..

4 soldiers, A, B, C, D, need to cross a mined bridge, by night.

In an hour's time, the sun will rise, and, if they haven't crossed by then, they will be spotted.

They cannot cross more than 2 at a time, and they only have 1 flashlight. So: - When 2 soldiers cross the bridge, they will go at the pace of the slower - One soldier will have to make the return journey with the flashlight Hence, 2 will cross, 1 will cross back, 2 will cross, 1 will cross back, and, finally, the 2 will make the final crossing.

If soldier A were to cross alone, it would take him 5min to cross. It would take 10min for B, 20min for C, and 25min for D. How would you sort the soldiers for these 5 crossings so that they would all be on the safe side in 1h?

Here is the answer highlighted in Geeglee Engineering Intelligence

Geeglee's DNA being System Engineering, Geeglee's users are used to model their Systems of Interests - SoI - through a Product Breakdown Structure. Hence, an architecture is broken down into different modules (each with its own characteristics), interdependences (rules/patterns), and constraints; and there can be multiple versions (alternatives) for each module, and multiple versions of architectures, for a single SoI to answer needs (high-level requirements, i.e. specifications, expectations...) Once the modelling done and calculated, Geeglee's users will be able to explore all the combinations between the modules' alternatives.

Now, the 4 soldiers riddle is an interesting example of a slightly different model as, here, the modules do not belong to the soldiers but to the legs of the journey. It is true that we try to find the right combination of the solders, but it is more the combination of all the possible "legs", with their duration, that we will focus on.

There are going to be 5 modules, with all the possible combinations between the soldiers: - 1st leg, with 6 alternatives: A+B, A+C, A+D, B+C, B+D, C+D

- 2nd leg= 1st return journey, with 4 alternatives: A, B, C, D

- 3rd leg, with 6 alternatives: A+B, A+C, A+D, B+C, B+D, C+D

- 4th leg= 2nd return journey, with 4 alternatives: A, B, C, D

- 5th and finale leg, with 6 alternatives: A+B, A+C, A+D, B+C, B+D, C+D

The rules (patterns) make it possible to track the position of each element (soldier) at the end of each leg, and to eliminate all the combinations that are impossible.

For example:

If A and D are crossing on the first leg, it is impossible to consider B or C for the return journey, as they won't be on the right side of the bridge. Hence, only alternatives involving A or D are acceptable for that return journey.

The following video shows you the actual implementation in Geeglee Engineering Pattern - GEP

Last, but not least, for the sake of that exercise, we kept all the "realistic" solutions, regardless of the total duration of the crossing, in order to be able to browse through these solutions in GEI. But, if it were a real model, we would have implemented a constraint that would have eliminated all the solutions but the two that match the 60min limit.

Feel free to contact us if you want to know more about the implementation of that example.

Arnaud, COO


bottom of page