1 | package agents.anac.y2014.Aster;
|
---|
2 |
|
---|
3 | import java.util.ArrayList;
|
---|
4 | import java.util.List;
|
---|
5 |
|
---|
6 | import genius.core.Bid;
|
---|
7 | import genius.core.issue.Issue;
|
---|
8 | import genius.core.issue.IssueInteger;
|
---|
9 | import genius.core.issue.ValueInteger;
|
---|
10 | import genius.core.utility.AbstractUtilitySpace;
|
---|
11 |
|
---|
12 | public class SearchBid {
|
---|
13 | private AbstractUtilitySpace utilitySpace;
|
---|
14 |
|
---|
15 | public SearchBid(AbstractUtilitySpace utilitySpace) {
|
---|
16 | this.utilitySpace = utilitySpace;
|
---|
17 | }
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Search Bid for nonlinear ã� ã�„ã�¶é«˜é€ŸåŒ–ã�—ã�Ÿãƒ�ージョン
|
---|
21 | */
|
---|
22 | public ArrayList<Bid> searchOfferingBid(ArrayList<Bid> bidHistory, Bid bid,
|
---|
23 | double bidTarget) throws Exception {
|
---|
24 | List<Issue> issues = utilitySpace.getDomain().getIssues();
|
---|
25 | Bid nextBid = new Bid(bid);
|
---|
26 | IssueInteger lIssueInteger;
|
---|
27 | double nextBidUtility;
|
---|
28 | int issueNumber, issueIndexMin, issueIndexMax;
|
---|
29 |
|
---|
30 | for (Issue issue : issues) {
|
---|
31 | lIssueInteger = (IssueInteger) issue;
|
---|
32 | issueNumber = lIssueInteger.getNumber();
|
---|
33 | issueIndexMin = lIssueInteger.getLowerBound();
|
---|
34 | issueIndexMax = lIssueInteger.getUpperBound();
|
---|
35 |
|
---|
36 | for (int i = issueIndexMin; i <= issueIndexMax; i++) {
|
---|
37 | nextBid = nextBid.putValue(issueNumber, new ValueInteger(i));
|
---|
38 | nextBidUtility = utilitySpace.getUtility(nextBid);
|
---|
39 |
|
---|
40 | // æ–°ã�—ã�„Bidã�ŒTarget以下ã�®å ´å�ˆã�¯å�´ä¸‹
|
---|
41 | if (nextBidUtility <= bidTarget) {
|
---|
42 | continue;
|
---|
43 | }
|
---|
44 |
|
---|
45 | // æ–°ã�—ã�„Bidã�Œç�¾åœ¨ã�®æŽ¢ç´¢ãƒ†ãƒ¼ãƒ–ルã�«ã�ªã�‘ã‚Œã�°è¿½åŠ
|
---|
46 | if (!bidHistory.contains(nextBid)) {
|
---|
47 | Bid newBid = new Bid(nextBid);
|
---|
48 | bidHistory.add(newBid);
|
---|
49 | }
|
---|
50 |
|
---|
51 | }
|
---|
52 | nextBid = new Bid(bid); // BidReset
|
---|
53 | }
|
---|
54 |
|
---|
55 | return bidHistory;
|
---|
56 | }
|
---|
57 | }
|
---|