Re: Propagating data through dependencies

2014-05-16 Thread David Pidcock
What I meant was that you use all b's to generate the max date for B (used as 
input for its dependencies) but simply bundle all b's into B's bill.  You can't 
bill them before or after B because they're effectively line items on B. 

 

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Propagating data through dependencies

2014-05-15 Thread Casper
This is not strictly a Clojure question, but I'll ask it here since I am 
solving it in Clojure. I have already made one solution which works, but I 
am interested in whether there are other and better approaches.

I have a number of different products and some are dependant on others:

A - B 
B - C 
D

(B is depending on A, C is depending on B, D has no dependencies)

There might also be a required service or product for the above, lets 
denote them by lower case letters, which should be available at the same 
time or before the main product, and it cannot be billed after. It could be 
a modem for an internet connection.

Finally there might be a fee, lets call them fX e.g. fA if it is a fee for 
A. These should be billed at the same time as the main product but can be 
billed after.

So when you bill the customer you want to make sure that the product and 
the products it depends on are usable, delivered, provisioned (or whatever 
the case). For this we calculate a date from which we bill the customer for 
each of the products based on the date he requested the product.

So the customer might have placed the following order:

Product | Req. date | Bill date (calculated)

A   | 3 | 3
fA  | 3 | 3
B   | 2 | 4
b   | 4 | 4
C   | 1 | 4
fC  | 1 | 4
D   | 1 | 1

B and C are bumped to time 3, because they depend on A (B directly, C 
indirectly) while D stays at 1 because it has no dependencies. However 
because b was only available at 4 (maybe due being out of stock), B and 
therefore C and fC are bumped to 4

What we are currently doing is looking at this as a tree of dependencies 
and transfer the dates from the dependencies to the product if the date is 
bigger (done per product in topological order to get the right 
propagation). The problem here are the required services that need to be 
able to bump the date of the main product but also not be billed after, 
this is modeled as B - b and then having a post action to bump b up to B 
if it was before (but this feels like a hack). There cannot be a dependency 
in both directions as the topological order then cannot be found due to a 
circular dependency.

(I hope this is making sense, I am finding it a bit hard to explain)

So my question is, what other approaches are there? 

The ones that come to mind are:
 - core.logic, however I can't figure out how to get propagation through 
multiple dependencies.
 - rule engine of some sort, like clara-rules, but again can't get the 
propagation going.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Propagating data through dependencies

2014-05-15 Thread David Pidcock
You said b can't be billed after B. But it sounds like it can't be billed 
before. 

Say b is ready at 1,  can you bill it at 1 and then B at 2?

Anyway, my first thought was using weights on the edges equal to the duration 
between the dependencies and use a max cost on the graph. But calculating the 
duration for each edge may not gain you anything compared to your current 
solution. 
If it ain't broke ...

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Propagating data through dependencies

2014-05-15 Thread David Pidcock
If, say C cannot depend on any b directly, (I.e. C can only depend on B), and 
your domain rules say you can only bill for all b's when you bill B, then 
really you have a self contained sub-graph with only one bill date for the root 
node B.
You can simply ignore backfilling the billing date for b's and just bundle them 
into the bill for B when you generate it.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Propagating data through dependencies

2014-05-15 Thread François Rey
I'm not sure I totally understand your use case, but somehow it sounds 
like these libraries may be of interest to you:

propaganda https://github.com/tgk/propaganda
prismatic graph https://github.com/prismatic/plumbing

--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Propagating data through dependencies

2014-05-15 Thread Casper
On Thursday, May 15, 2014 11:18:31 PM UTC+2, David Pidcock wrote:

 You said b can't be billed after B. But it sounds like it can't be billed 
 before. 

 Say b is ready at 1,  can you bill it at 1 and then B at 2?

They should actually be billed at the same time (yeah, I didn't explain 
that very well). 

The problem is that the way I am currently solving it, by propagating dates 
from dependencies, can only have a dependency in one direction. So if b is 
2 and B is 1 I want B to be bumped to 2, but if b is 1 and B is 2 i want b 
to be bumped to 2 - the current solution can only support one of the two 
though, so I do the first in the main propagation and after that have a 
post action to bump all required services (lower case) to the date of their 
main product (upper case). 

This is actually what makes me want to look for another solution. Not so 
much because I want to replace the current implementation, (it works fine), 
but because I feel like there is something to be learned here for me.









 

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Propagating data through dependencies

2014-05-15 Thread Casper
Yeah maybe, but both b and B should basically be billed at max of their 
associated dates, which might affect the things that depend on B. So I 
don't think b can be dropped completely.

On Thursday, May 15, 2014 11:30:35 PM UTC+2, David Pidcock wrote:

 If, say C cannot depend on any b directly, (I.e. C can only depend on B), 
 and your domain rules say you can only bill for all b's when you bill B, 
 then really you have a self contained sub-graph with only one bill date for 
 the root node B.
 You can simply ignore backfilling the billing date for b's and just bundle 
 them into the bill for B when you generate it.


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Propagating data through dependencies

2014-05-15 Thread Casper
Nice thanks, I didn't know propaganda. I am not sure if it applies to this 
problem, but it looks interesting so I'll have a look.

On Friday, May 16, 2014 12:10:29 AM UTC+2, François Rey wrote:

  I'm not sure I totally understand your use case, but somehow it sounds 
 like these libraries may be of interest to you:
 propaganda https://github.com/tgk/propaganda
 prismatic 
 graphhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fprismatic%2Fplumbingsa=Dsntz=1usg=AFQjCNF0UDUdf_emNVKQOLkFfvSo0aKoLA

 

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.