Find the simplex vertices with the worst, nextWorst and best values of the target function
(double[][] simp, int[] worstNextBestArray)
| 817 | /** Find the simplex vertices with the worst, nextWorst and best values |
| 818 | * of the target function */ |
| 819 | private void order(double[][] simp, int[] worstNextBestArray) { |
| 820 | int worst = 0, nextWorst = 0, best = 0; |
| 821 | for (int i = 0; i < numVertices; i++) { |
| 822 | if (value(simp[i]) < value(simp[best])) best = i; |
| 823 | if (value(simp[i]) > value(simp[worst])) worst = i; |
| 824 | } |
| 825 | nextWorst = best; |
| 826 | for (int i = 0; i < numVertices; i++) |
| 827 | if (i != worst && value(simp[i]) > value(simp[nextWorst])) |
| 828 | nextWorst = i; |
| 829 | worstNextBestArray[WORST] = worst; |
| 830 | worstNextBestArray[NEXT_WORST] = nextWorst; |
| 831 | worstNextBestArray[BEST] = best; |
| 832 | } |
| 833 | |
| 834 | // Display simplex [Iteration: s0(p1, p2....), s1(),....] in Log window |
| 835 | private synchronized void showSimplex(double[][] simp, String heading) { |