1 | package negotiator.boaframework.offeringstrategy.anac2010.IAMhaggler2010;
|
---|
2 |
|
---|
3 | public class IntegerEvaluationSection extends ContinuousEvaluationSection {
|
---|
4 |
|
---|
5 | public IntegerEvaluationSection(int lowerBound, double evalLowerBound, int 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, int lowerBound, double evalLowerBound, int 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 / (double) (upperBound - lowerBound);
|
---|
29 | else
|
---|
30 | return -weight / (double) (upperBound - lowerBound);
|
---|
31 | }
|
---|
32 |
|
---|
33 | @Override
|
---|
34 | public double getNormal(double weight) {
|
---|
35 | return getNormalPart(weight, (int) lowerBound, evalLowerBound, (int) upperBound, evalUpperBound);
|
---|
36 | }
|
---|
37 | }
|
---|