Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. UniformDistribution initialMU = new UniformDistribution(score,range);
  2.  
  3. // an algorithmic version of the following equation
  4. // mu[cell] = ( MU - intersectionArea[cell1] x mu[cell1] ... - intersectionArea[cellN] x mu[cellN]) / intersectionArea[cell]
  5.  
  6. for (S2CellId cellOuter: cells) {
  7. UniformDistribution mus = new UniformDistribution(initialMU);
  8. for (S2CellId cellInner: cells) {
  9. // if not cell from outer loop
  10. if (!cellOuter.equals(cellInner))
  11. {
  12. double areaInner = getIntersectionArea(thisField,cellInner);
  13. UniformDistribution cellInnerMU = getMU(cellInner);
  14.  
  15. if (cellInnerMU != null)
  16. {
  17. UniformDistribution cma = cellInnerMU.mul(areaInner);
  18. mus = mus.sub(cma);
  19. }
  20. else
  21. {
  22. mus.setLower(0.0);
  23. }
  24. }
  25. }
  26. double areaOuter = getIntersectionArea(thisField,cellOuter);
  27. mus=mus.div(areaOuter);
  28. mus.clampLower(0.0);
  29.  
  30. UniformDistribution cellOuterMU = getMU(cellOuter);
  31.  
  32. // refine UD:cello with mus
  33.  
  34. if (cellOuterMU == null)
  35. {
  36. cellOuterMU = mus;
  37. }
  38. else
  39. {
  40. try {
  41. if (cellOuterMU.refine(mus)){
  42. System.out.println("" + cellOuter.toToken() + "->" + cellOuterMU.toString());
  43. // add cell to modified array
  44. }
  45. } catch (Exception e) {
  46. ; // something something, out of range error
  47. }
  48. }
  49.  
  50. // end refine UD:cello
  51. putMU(cellOuter,cellOuterMU);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement