2 * Description: provide the information for evaluating a set of targets values
3 * into encoded information (For formation the goodness landscape by comparing)
5 * @ Author Create/Modi Note
6 * Xiaofeng Xie Mar 1, 2003
7 * Xiaofeng Xie May 11, 2004
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * Please acknowledge the author(s) if you use this code in any way.
22 * [1] Deb K. An efficient constraint handling method for genetic algorithms.
23 * Computer Methods in Applied Mechanics and Engineering, 2000, 186(2-4): 311-338
26 package net
.adaptivebox
.encode
;
28 public class EvalStruct
{
29 // The information for evaluating all the responses
30 public EvalElement
[] evalElems
= null;
32 public EvalStruct(int elemsNum
) {
33 evalElems
= new EvalElement
[elemsNum
];
35 public int getSize() {
36 return evalElems
.length
;
39 public void setElemAt(EvalElement dim
, int index
) {
40 evalElems
[index
] = dim
;
43 //convert response values into encoded information double[2]
44 public void evaluate(double[] evalRes
, double[] targetValues
) {
45 evalRes
[0] = evalRes
[1] = 0;
46 for(int i
=0; i
<evalElems
.length
; i
++) {
47 if (evalElems
[i
].isOptType()) {
48 //The objectives (OPTIM type)
49 //The multi-objective will be translated into single-objective
50 evalRes
[1] += evalElems
[i
].evaluateOPTIM(targetValues
[i
]);
52 //The constraints (CONS type)
53 //If evalRes[0] equals to 0, then be a feasible point, i.e. satisfies
54 // all the constraints
55 evalRes
[0] += evalElems
[i
].evaluateCONS(targetValues
[i
]);