|
Boost Users : |
Subject: Re: [Boost-users] ICL library usage for interval map
From: Dave (decebel_at_[hidden])
Date: 2011-06-05 23:12:21
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..._at_[hidden]> 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..._at_[hidden]>:
>
> > 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..._at_[hidden]http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net