01: package jaimoves.immun;
02:
03: import java.util.BitSet;
04: import java.util.Random;
05:
06: public class AntiGen extends AntiGenAbstract {
07: private double a, b, c;
08: Random rnd;
09:
10: public AntiGen() {
11: rnd = new Random();
12: shuffel();
13: }
14:
15: public void shuffel() {
16: a = rnd.nextInt(10) - 5;
17: b = rnd.nextInt(10) - 5;
18: c = rnd.nextInt(10) - 5;
19: }
20:
21: private double fx(double x) {
22: return (a * x * x + b * x + c);
23: }
24:
25: public double calcDistance(AntiBody antibody, double range,
26: int problemSize) {
27: double A[] = parserAntiBody(antibody, range, problemSize);
28: double ret = (A[0] - a) * (A[0] - a) + (A[1] - b) * (A[1] - b)
29: + (A[2] - c) * (A[2] - c);
30: return ret;
31: }
32:
33: public void showAntigen() {
34: System.out.println("A: " + a + "B: " + b + "C: " + c);
35: }
36:
37: } // reprezentuje problem do rozwiazanie
|