1 package net.sf.openrocket.optimization;
3 import static org.junit.Assert.*;
9 public class TestSearchPattern {
12 public void testRegularSimplex() {
13 for (int dim = 1; dim < 20; dim++) {
14 List<Point> points = SearchPattern.regularSimplex(dim);
15 assertEquals(dim, points.size());
17 for (int i = 0; i < dim; i++) {
19 for (int j = i + 1; j < dim; j++) {
20 double[] x = points.get(i).asArray();
21 double[] y = points.get(j).asArray();
23 for (int k = 0; k < dim; k++) {
26 assertEquals(0.5, dot, 0.000000001);
29 // Test positive coordinates
30 for (int j = 0; j < dim; j++) {
31 assertTrue(points.get(i).get(j) >= 0);
35 assertEquals(1.0, points.get(i).length(), 0.000000001);