Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UniformDistribution initialMU = new UniformDistribution(score,range);
- // an algorithmic version of the following equation
- // mu[cell] = ( MU - intersectionArea[cell1] x mu[cell1] ... - intersectionArea[cellN] x mu[cellN]) / intersectionArea[cell]
- for (S2CellId cellOuter: cells) {
- UniformDistribution mus = new UniformDistribution(initialMU);
- for (S2CellId cellInner: cells) {
- // if not cell from outer loop
- if (!cellOuter.equals(cellInner))
- {
- double areaInner = getIntersectionArea(thisField,cellInner);
- UniformDistribution cellInnerMU = getMU(cellInner);
- if (cellInnerMU != null)
- {
- UniformDistribution cma = cellInnerMU.mul(areaInner);
- mus = mus.sub(cma);
- }
- else
- {
- mus.setLower(0.0);
- }
- }
- }
- double areaOuter = getIntersectionArea(thisField,cellOuter);
- mus=mus.div(areaOuter);
- mus.clampLower(0.0);
- UniformDistribution cellOuterMU = getMU(cellOuter);
- // refine UD:cello with mus
- if (cellOuterMU == null)
- {
- cellOuterMU = mus;
- }
- else
- {
- try {
- if (cellOuterMU.refine(mus)){
- System.out.println("" + cellOuter.toToken() + "->" + cellOuterMU.toString());
- // add cell to modified array
- }
- } catch (Exception e) {
- ; // something something, out of range error
- }
- }
- // end refine UD:cello
- putMU(cellOuter,cellOuterMU);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement