Markov Model descision process in Java

一曲冷凌霜 提交于 2019-12-04 06:03:01

You could write a C/C++ version if you want, and use the NDK (The overhead of the NDK is in the JNI translations from Java to C/C++ methods, but once there, they are much faster)

That is one idea. But... I don't think you have to go that far (at least to get a version that works for smaller sets) (maybe later moving to NDK might be a better option for LARGE sets)

I think you would be much better off treating this like an array of 'whole number fractions' aka... a two dimensional array for each set of action's probabilities. Meaning the numerators on the 'top row' and denominators on the 'bottom row'. Since the sets you are going to be working with are likely small, I'd think that a simple linked list of nodes where each node has its own set of probabilities would work. (These probabilities are the transition tables from S to S' from 'that' node.)

 int[][] probs = new int[100][2];

So you can think of it as ...

1 2 1 1

4 3 4 9

as 1/4, 2/3, 1/4, 1/9 with whole integer arithmetic. This would be easier in 'some' parts of the algorithm, because you will be able to make nice helper functions for "removeColumn' (make 0/0, and skip rest of processing, etc(or however you want to represent it)) and 'adjustProbabilities()'

(you might be able to get away with a single array of numerators if you make the denominators a single int (the lowest common denominator), but I'd probably make this an optimization after getting the 2D array version working)

Then just write the 'simple' generic P, R, and V methods that interact on that data for each node. Then make them adjustable/extensible/etc with good OO design.

Then just 'play with the numbers' for the discount factor, etc.

I think this is more of a 'just take the time to test it out' more than an issue about any really complex math algorithms, etc. because from what I see, there is not 'obvious' places to optimize the core algorithms.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!