source: src/main/java/agents/anac/y2010/Southampton/analysis/RealEvaluationSection.java

Last change on this file was 1, checked in by Wouter Pasman, 6 years ago

Initial import : Genius 9.0.0

File size: 1.3 KB
RevLine 
[1]1package agents.anac.y2010.Southampton.analysis;
2
3public class RealEvaluationSection extends ContinuousEvaluationSection {
4
5 public RealEvaluationSection(double lowerBound, double evalLowerBound, double upperBound, double evalUpperBound) {
6 this.lowerBound = lowerBound;
7 this.evalLowerBound = evalLowerBound;
8 this.upperBound = upperBound;
9 this.evalUpperBound = evalUpperBound;
10 }
11
12 /**
13 * @param weight
14 * @param lowerBound
15 * @param evalLowerBound
16 * @param upperBound
17 * @param evalUpperBound
18 * @return
19 */
20 private double getNormalPart(double weight, double lowerBound, double evalLowerBound, double upperBound, double evalUpperBound) {
21 if (lowerBound >= upperBound)
22 throw new AssertionError("lowerBound cannot be greater than or equal to upperBound");
23 if (evalLowerBound != 0 && evalUpperBound != 0)
24 throw new AssertionError("evalLowerBound or evalUpperBound must be zero");
25 if (evalLowerBound != 1 && evalUpperBound != 1)
26 throw new AssertionError("evalLowerBound or evalUpperBound must be one");
27 if (evalUpperBound > evalLowerBound)
28 return weight / (upperBound - lowerBound);
29 else
30 return -weight / (upperBound - lowerBound);
31 }
32
33 @Override
34 public double getNormal(double weight) {
35 return getNormalPart(weight, lowerBound, evalLowerBound, upperBound, evalUpperBound);
36 }
37}
Note: See TracBrowser for help on using the repository browser.