예제 #1
0
파일: Box.java 프로젝트: ulia22/Algo_Mvt
 /** Return the midpoint (a degenerated box) */
 public Box mid() {
   Box mBox = new Box(dim());
   for (int i = 0; i < dim(); i++) {
     double m = get(i).mid();
     mBox.set(i, new Interval(m, m));
   }
   return mBox;
 }
예제 #2
0
파일: Box.java 프로젝트: ulia22/Algo_Mvt
  /**
   * Bisect the box along "var" at point "pt" and return the two sub-boxes. Sub-boxes are new boxes
   * independent from each other and independent from the current box.
   *
   * @throws InvalidIntervalOp (cf. Interval.bisect)
   */
  private Pair<Box, Box> bisect(int var, double pt) {

    // split the variable
    Interval i = get(var);
    Pair<Interval, Interval> pi = i.bisect(pt);
    // copy the box
    Box lowerHalf = copy();
    lowerHalf.set(var, pi.fst);
    Box upperHalf = copy();
    upperHalf.set(var, pi.snd);

    return new Pair<Box, Box>(lowerHalf, upperHalf);
  }
예제 #3
0
파일: Box.java 프로젝트: ulia22/Algo_Mvt
 /** Create a deep copy of "other". */
 private Box(Box other) {
   comp = new Vector<Interval>(other.dim());
   for (int i = 0; i < other.dim(); i++) comp.add(other.comp.get(i).copy());
 }