finding the right mathematical model

Hi list, the problem I have stems from the app I had developed. What my app does is to split the money a hospital receives for a case to the departments involved in a fair way. An additional requirement however was to allow the users of the app to re-map any revenue shares credited to certain departments to other departments. Such cases are sometimes due to politics within the hospital and also have more legitimate reasons, like saying the radiology should not receive shares for surgical procedures but those shares should be redirected to the "General surgery" department. The feature is already implemented, but I'm not pleased with it, especially since I did not develop a mathematical model for it. Details: It boils down to model mappings, or rather what sort of data structure would be suited for this kind of thing. Dept A is "mapped" to itself A -> A Dept B is mapped to Dept C B -> C Dept C is mapped to Dept C C -> C Dept D is mapped to Dept A D -> A It should not be possible to construct looping mappings, ie. 1. A -> B 2. B -> C 3. C -> A ...... What sort of model would be suitable to describe this, some sort of matrix? Günther

Andrew Korzhuev wrote:
What sort of model would be suitable to describe this, some sort of matrix? You still can get loops if your matrix represents graph. Sounds like you need a tree.
Well, a DAG would suffice and would be less restrictive. Of course, you'd want to have the amendation that self-loops are acceptable (i.e., a partial order). Depending on the interpretation of your graph, you may be able to weaken the restrictions to just having a total preorder. That is, if you're only interested in the endpoints of complete paths ---namely that the start is unreachable from (or is identical with) the end--- and not the specifics of how that path is shaped (i.e., path-medial loops are fine), then a preorder is sufficient to remove the bad loops. I'm not aware of specific datastructures for implementing partial/pre-orders directly, so you'd probably end up representing them as graphs and then have auxiliary functions to verify the additional constraints. -- Live well, ~wren

Günther Schmidt wrote:
Hi list,
the problem I have stems from the app I had developed. What my app does is to split the money a hospital receives for a case to the departments involved in a fair way.
An additional requirement however was to allow the users of the app to re-map any revenue shares credited to certain departments to other departments. Such cases are sometimes due to politics within the hospital and also have more legitimate reasons, like saying the radiology should not receive shares for surgical procedures but those shares should be redirected to the "General surgery" department.
The feature is already implemented, but I'm not pleased with it, especially since I did not develop a mathematical model for it.
Details:
It boils down to model mappings, or rather what sort of data structure would be suited for this kind of thing.
Dept A is "mapped" to itself A -> A
Dept B is mapped to Dept C B -> C
Dept C is mapped to Dept C C -> C
Dept D is mapped to Dept A D -> A
It should not be possible to construct looping mappings, ie.
1. A -> B 2. B -> C 3. C -> A
.......
What sort of model would be suitable to describe this, some sort of matrix?
You probably want a graph where the nodes represent departments and edges represent the mappings. To implement graphs in Haskell, have a look at the functional graph library http://hackage.haskell.org/package/fgl If that's too complicated for you and your graphs are really small, you can also use a toy implementation like type Graph = [(Node, -- Department [Node]) -- List of Departments it shares revenue to ] To test whether a graph has cycles ("looping mapping"), you can use a depth-first search. Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com
participants (4)
-
Andrew Korzhuev
-
Günther Schmidt
-
Heinrich Apfelmus
-
wren ng thornton