
Hi Users, I am trying to use the new ICL (interval container library) for a project that requires some interval based calculations. I have a question on using the joining interval_map. For example, below I have a conceptual 30 minute window divided into three 10 minute intervals. I want to do some aggregates in my 10 minute windows. { [0,10], (10, 20], (20, 30) } Now say, I have 2 clients shopping in the first interval (0, 10) and their shopping time window interval is [2, 5] and [4, 9] minutes respectively. When I add the 2 interval, value pairs to my interval_map, I see that the interval map gets splited from [0, 10] to { [0,2], [2, 4], [5,9], [9,10] }. How do I make sure the interval still remains from [0, 10]. My question is how do I make sure my original interval of 10 minutes is preserved. The samples mentioned do mention about joining interval_map but I cannot seem to figure out an example for my requirement. Thank you for your help Dece

Hi Dave, thank you for using Boost.ICL. From your example, I am not completely sure I understand what you are trying to accomplish. In any case you have to distinguish between interval_sets and interval_maps 2011/6/3 Dave Schwartz <decebel@gmail.com>:
Hi Users,
I am trying to use the new ICL (interval container library) for a project that requires some interval based calculations. I have a question on using the joining interval_map.
For example, below I have a conceptual 30 minute window divided into three 10 minute intervals. I want to do some aggregates in my 10 minute windows. { [0,10], (10, 20], (20, 30) }
As you are not using associated values I assume you should better use an interval_set.
Now say, I have 2 clients shopping in the first interval (0, 10) and their shopping time window interval is [2, 5] and [4, 9] minutes respectively. When I add the 2 interval, value pairs to my interval_map, I see that the interval map gets splited from [0, 10] to { [0,2], [2, 4], [5,9], [9,10] }. How do I make sure the interval still remains from [0, 10].
By using an interval_set, which is joining, and does not have associated values.
My question is how do I make sure my original interval of 10 minutes is preserved. The samples mentioned do mention about joining interval_map but I cannot seem to figure out an example for my requirement.
Use interval_set, if you don't need to store and aggregate associated values. In contrast to interval_sets, interval_maps have to split intervals on aggregation. See e.g. http://www.joachim-faulhaber.de/boost_icl/doc/libs/icl/doc/html/boost_icl/ex... HTH Joachim -- Interval Container Library [Boost.Icl] http://www.joachim-faulhaber.de

Hello Joachim, Thank you for replying. I think I should have explained in a little detail on my requirement. I have fixed interval, lets say, 10 minutes each over which I want to perform some analytics. In each of these ten minute intervals I will have clients add some items to their shopping cart, browse certain products, read some reviews etc etc and I would like to track and analyze and ICL interval_map seems like an ideal container for my use case. So, I create an interval map from my 10 minute interval example, with keys as shown below { [0,10], (10, 20], (20, 30) } and I would like to use a container such as a vector<ShoppingItem> as values in my key-value pair for each 10 minute interval key. Something like the below map: [0, 10] => vector<ShoppingItem> [10, 20] => vector<ShoppingItem> [20, 30] => vector<ShoppingItem> Now, lets say, we have a client "A" coming in and shopping in the interval (3, 5). I would like to add the number of items shopped in the interval [0,10] instead of the intervals getting splitted from [0, 10] to {[0, 3], [3,5], [5, 10]} Basically any number of users arriving in any sub interval of [0, 10] should remain in [0, 10]. Finally, I get to perform all my analytics on the vector<ShoppingItem> for the interval [0, 10] instead of the sub-intervals of the individual clients. This would prove super useful to me and I wondering how to go about doing this? I guess knowing how ICL looks at the values in the key- value pair of the interval_map would be necessary. What do you advice? Many thanks for your help, Dece On Jun 5, 8:37 am, Joachim Faulhaber <afo...@googlemail.com> wrote:
Hi Dave,
thank you for using Boost.ICL. From your example, I am not completely sure I understand what you are trying to accomplish. In any case you have to distinguish between
interval_sets and interval_maps
2011/6/3 Dave Schwartz <dece...@gmail.com>:
Hi Users,
I am trying to use the new ICL (interval container library) for a project that requires some interval based calculations. I have a question on using the joining interval_map.
For example, below I have a conceptual 30 minute window divided into three 10 minute intervals. I want to do some aggregates in my 10 minute windows. { [0,10], (10, 20], (20, 30) }
As you are not using associated values I assume you should better use an interval_set.
Now say, I have 2 clients shopping in the first interval (0, 10) and their shopping time window interval is [2, 5] and [4, 9] minutes respectively. When I add the 2 interval, value pairs to my interval_map, I see that the interval map gets splited from [0, 10] to { [0,2], [2, 4], [5,9], [9,10] }. How do I make sure the interval still remains from [0, 10].
By using an interval_set, which is joining, and does not have associated values.
My question is how do I make sure my original interval of 10 minutes is preserved. The samples mentioned do mention about joining interval_map but I cannot seem to figure out an example for my requirement.
Use interval_set, if you don't need to store and aggregate associated values.
In contrast to interval_sets, interval_maps have to split intervals on aggregation. See e.g.http://www.joachim-faulhaber.de/boost_icl/doc/libs/icl/doc/html/boost...
HTH Joachim
-- Interval Container Library [Boost.Icl]http://www.joachim-faulhaber.de _______________________________________________ Boost-users mailing list Boost-us...@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-users

Hi Dece, 2011/6/6 Dave <decebel@gmail.com>:
Thank you for replying. I think I should have explained in a little detail on my requirement.
I have fixed interval, lets say, 10 minutes each over which I want to perform some analytics. In each of these ten minute intervals I will have clients add some items to their shopping cart, browse certain products, read some reviews etc etc and I would like to track and analyze and ICL interval_map seems like an ideal container for my use case.
So, I create an interval map from my 10 minute interval example, with keys as shown below { [0,10], (10, 20], (20, 30) } and I would like to use a container such as a vector<ShoppingItem> as values in my key-value pair for each 10 minute interval key. Something like the below map: [0, 10] => vector<ShoppingItem> [10, 20] => vector<ShoppingItem> [20, 30] => vector<ShoppingItem>
Now, lets say, we have a client "A" coming in and shopping in the interval (3, 5). I would like to add the number of items shopped in the interval [0,10] instead of the intervals getting splitted from [0, 10] to {[0, 3], [3,5], [5, 10]} Basically any number of users arriving in any sub interval of [0, 10] should remain in [0, 10]. Finally, I get to perform all my analytics on the vector<ShoppingItem> for the interval [0, 10] instead of the sub-intervals of the individual clients.
this is understood... Interesting use case. First a question: Is it possible that you have to insert shopping items for an interval that is not completely contained in one of your 10 minute intervals but ranges across 2 or more of them. If so, how should the interval container work in this case? Regards, Joachim -- Interval Container Library [Boost.Icl] http://www.joachim-faulhaber.de
participants (3)
-
Dave
-
Dave Schwartz
-
Joachim Faulhaber