# Optimizing Truck Allocation for Area Coverage

292
6
01-29-2024 08:20 PM
New Contributor III

how can we efficiently know if a trucks allocated to an area covers this areas, ensuring that if at least one designated truck is present in an area, it is considered fully covered, while if none of the designated trucks are present, and if other truck designated to anther area presents in  the area is considered only half-covered. if no truck it considered none covered.

Tags (1)
6 Replies
Esri Contributor

Hi @Moi_Nccncc - This'll sound odd but you might want to flip this problem on its head. Rather than tracking the trucks, track the areas. If an area (the event) has a truck of type <A> inside of it, mark that area as "fully covered". If the same area (the event) has a truck of type <B> inside of it, mark that areas as "partly covered". The area (the event) can be, by default, not covered until it has a truck reported inside of it. Hope this helps!

New Contributor III

I Thanks Greogy,

I didn't understand what you mean flip the problem, The only event I am receiving is from truck so How I track the area? can you explain more

Esri Contributor

@Moi_Nccncc - I assume that the areas are (or can be) geofences coming from a feature layer or stream layer? If this is true, you can ingest the areas every "x" seconds or minutes from this feature layer using an input connector (e.g. poll an arcgis server for features). Simultaneously, you have your truck data coming in somehow. You can push those trucks to a stream layer & use said stream layer (via a geofence synchronization rule) to act as point geofences that are updating frequently.

With this setup, you can begin to answer real-time questions such as "when does my area (polygon event), contain a truck (point geofence)?". You can refine this even further; "when does my area (site "xyz"), contain a truck (of type "Alpha")? If the truck is of type "Alpha", consider area xyz fully covered. However, if the truck is of type "Beta", consider area xyz half covered.

To me it sounds like you're not trying to capture the status of the truck, but rather the status of the area based on its interaction with the truck if that makes sense. I hope this helps but let me know if it does not.

New Contributor III

Thanks for clarify,

I have the following concerns in this idea.

1- I have around 1500 AVLS, which means I will have  1500 Geofence

2- I am getting around 1000 event from the AVLS per minute.

3 - The areas will be coming from several feature classes.

With all the above do you think it swill work? and the performance will be ok?

Esri Contributor

If I were in your shoes, I would give it a try but obviously there are other details to consider (e.g. what resources are available on the machine, is GeoEvent Server competing for those resources, are other inputs/outputs/GeoEvent services running on your instance of GeoEvent Server, etc). At a glance...

1. 1,500 point geofences doesn't seem alarmingly high. They have simple geometries (x,y) which is a major plus. I'd be more concerned if you had 1,500 complex polygons (i.e. high vertices count).

2. Updating those AVL "geofences" every minute doesn't seem all that bad either. That is within the scope of what a stream service (for a sync rule) could support (but again, this is based on the other factors I mentioned above).

3. This is the biggest question; how many areas are there? Are they complex polygons? How frequently are you looking to check them for truck intersection? If they're simple polygons, there aren't many, and you only need to see their point-in-time status once every minute or so, this could work. If your answer is the opposite (i.e. they are all complex polygons, you have hundreds instead of dozens, and you need them updated every 5 seconds, then that could be an issue where you see performance bog down some and not keep up in real-time).

Again, if I were in your shoes I would put together a pseudo proof of concept and see how it works for you. That's really the best way to know for certain (especially because there are other factors that could be at play like I mentioned above that I am personally not aware of).

In the event that you find its not what you want, there can be other ways to potentially go about your problem. For example you could track the trucks again and geotag them with the name of the geofence area they intersect with. In another field you could have the name of the area they're assigned to. If the geofence (geotag) name field == the assigned area name, there might be a way to use that condition to affect another GeoEvent Service to update a separate areas dataset to have an area status set to covered. This might require some more tinkering/logic though.

New Contributor III

Thanks for your ongoing support. I've implemented a solution for my current project, and it seems to be working well so far. However, I've encountered a problem that I've managed to solve, but I'm not entirely sure if my solution is the most efficient.

Here's a breakdown of the process I've followed:

1-  I extract areas from a feature class, which includes a field called PublishingID that I'll use later.
2-  For each polygon, I identify all AVLS (geofence points) that fall inside.
3- If a geotag is not null, I add 'START' at the beginning and 'END' at the end of the ID list. For example, '102,34,555' becomes 'START,102,34,555,END'.
4-  I split the IDs for the points inside each polygon using a Field Splitter tool to loop over each point.
5-  Next, I join each ID with data from another feature class (Field Enricher) to check if the AVL is published            and belongs to this area. A new field called publishedID is created for this purpose.
6-  I create an incident whenever an ID starts with 'START' and ends with 'END', or if PublishingID matches            publishedID.
7-  If an incident ends with 'END', it means there are no published AVLS inside this area. If it ends with                   PublishingID matching publishedID, it indicates there is a published AVL within the area.

However, I'm unsure about steps 6 and 7. It seems a bit cumbersome to track all points inside until one published AVL is found or all AVLs inside are unpublished. Is there a more efficient approach to achieve this without having to open an incident for each case?

The idea here is that I need to mark the area as "COVERED" if one or more published AVLS fall inside. Otherwise, I mark the area as "NOT COVERED."

Looking forward to your insights and suggestions.