@Test public void distanceTest() { Objectives objectives0 = new Objectives(); objectives0.add(new Objective("a"), 0.0); objectives0.add(new Objective("b"), 0.0); Objectives objectives1 = new Objectives(); objectives1.add(new Objective("a"), 1.0); objectives1.add(new Objective("b"), 1.0); Assert.assertEquals(Math.sqrt(2.0), objectives0.distance(objectives1), 0.0001); Assert.assertEquals(objectives0.distance(objectives1), objectives1.distance(objectives0), 0.0001); Assert.assertEquals(0.0, objectives0.distance(objectives0), 0.0001); }
public double distance(Objectives other) { double[] va = this.array(); double[] vb = other.array(); double s = 0; for (int i = 0; i < va.length; i++) { s += (va[i] - vb[i]) * (va[i] - vb[i]); } return Math.sqrt(s); }
Objectives implements Iterable<Entry<Objective, Value<?>>> { public double distance(Objectives other) { double[] va = this.array(); double[] vb = other.array(); double s = 0; for (int i = 0; i < va.length; i++) { s += (va[i] - vb[i]) * (va[i] - vb[i]); } return Math.sqrt(s); } }
Objectives implements Iterable<Entry<Objective, Value<?>>> { public double distance(Objectives other) { double[] va = this.array(); double[] vb = other.array(); double s = 0; for (int i = 0; i < va.length; i++) { s += (va[i] - vb[i]) * (va[i] - vb[i]); } return Math.sqrt(s); }  }
Objectives implements Iterable<Entry<Objective, Value<?>>> { public double distance(Objectives other) { double[] va = this.array(); double[] vb = other.array(); double s = 0; for (int i = 0; i < va.length; i++) { s += (va[i] - vb[i]) * (va[i] - vb[i]); } return Math.sqrt(s); }  @Override Iterator<Entry<Objective, Value<?>>> iterator(); double[] array(); int size(); Collection<Objective> getKeys(); Collection<Value<?>> getValues(); Value<?> get(Objective objective); Objective get(Value<?> value); void add(Objective objective, Value<?> value); void add(String name, Sign sign, Value<?> value); void add(Objective objective, double value); void add(String name, Sign sign, double value); void add(Objective objective, int value); void add(String name, Sign sign, int value); void addAll(Objectives objectives); boolean weaklyDominates(Objectives opponent); boolean dominates(Objectives opponent); boolean isEqual(Objectives opponent); double distance(Objectives other); @Override String toString(); }
Objectives implements Iterable<Entry<Objective, Value<?>>> { public double distance(Objectives other) { double[] va = this.array(); double[] vb = other.array(); double s = 0; for (int i = 0; i < va.length; i++) { s += (va[i] - vb[i]) * (va[i] - vb[i]); } return Math.sqrt(s); }  @Override Iterator<Entry<Objective, Value<?>>> iterator(); double[] array(); int size(); Collection<Objective> getKeys(); Collection<Value<?>> getValues(); Value<?> get(Objective objective); Objective get(Value<?> value); void add(Objective objective, Value<?> value); void add(String name, Sign sign, Value<?> value); void add(Objective objective, double value); void add(String name, Sign sign, double value); void add(Objective objective, int value); void add(String name, Sign sign, int value); void addAll(Objectives objectives); boolean weaklyDominates(Objectives opponent); boolean dominates(Objectives opponent); boolean isEqual(Objectives opponent); double distance(Objectives other); @Override String toString();  }