Location Classes with Force Containment
The meaning of "location classes with force containment" is requiring source location classes to be completely contained by the destination location classes. For example, if a skilled labor team has drywall and painting skills, we want that team to service job sites in need of drywall or painting skills, and not job sites in need of drywall, painting, AND electrical. The reason is obviously that a second team will have to cover the electrical work.
We abandon the vehicle-fueling station problem presented in the Sources and Destinations and Location Classes examples. Instead, let us consider three (3) teams of skilled technicians and six (6) job sites needing skilled labor. How would we submit a distance matrix to find which teams are closest to the job site most relevant to their skills? In this case, we'll make use of the
Our teams can have one or all of the following skills:
To frame the problem further, listed below are our teams and their skills with associated classes for each:
Our job sites in this example are:
|Job Sites||Skill Needs|
Unlike the prior examples where we broke down the problem into visual examples, the number of combinations here is too large to visualize simply. This is where the power of our Distance Matrix service shines!
To handle this complexity, all you need to do is apply the same
location_class parameters as in the other examples, but this time we will add the
force_containment parameter to ensure that when a job site needs multiple skills, ALL of those skill needs are met.
The complete request we will send to the Distance Matrix endpoint is given below.
Expand to view request sample
The complete response we receive from the Distance Matrix endpoint is given below. As expected, we only have
travel_costs which show going from sources to destinations where all of the destinations
location_class needs are met. The results we get are:
team-concrete+plumbingis not eligible for any job site because the only job site in need of concrete and plumbing work also needs all the other types of skilled work (HVAC, paint, etc.), which this team does not possess. Thus there are no
travel_costsreturned for them.
team-drywall+electricalis eligible for the
jobsite-drywall+electricalbecause they are the only team which can handle both types of work.
team-paint+concrete+hvacis eligible for two job sites —
jobsite-paint+hvac— because they have the overlapping skills needed.
- The remaining job sites do not appear in the response because there are no teams which can fulfill all the skill needs and thus no viable solution is available.