source: src/main/java/agents/anac/y2014/E2Agent/myUtility/SessionData.java

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

Initial import : Genius 9.0.0

File size: 2.5 KB
Line 
1package agents.anac.y2014.E2Agent.myUtility;
2
3import java.io.Serializable;
4import java.util.ArrayList;
5import java.util.Collection;
6import java.util.Collections;
7import java.util.Comparator;
8import java.util.HashMap;
9import java.util.List;
10import java.util.Random;
11
12import agents.anac.y2011.TheNegotiator.BidsCollection;
13import agents.anac.y2012.MetaAgent.agents.WinnerAgent.opponentOffers;
14import genius.core.Agent;
15import genius.core.Bid;
16import genius.core.NegotiationResult;
17import genius.core.actions.Accept;
18import genius.core.actions.Action;
19import genius.core.actions.Offer;
20import genius.core.issue.Issue;
21import genius.core.issue.IssueInteger;
22import genius.core.issue.Value;
23import genius.core.issue.ValueInteger;
24import genius.core.timeline.Timeline;
25import genius.core.utility.*;
26
27public class SessionData implements Serializable {
28 private static final long serialVersionUID = 1L;
29
30 ArrayList<BidStorageList> sessionsBitStorageList = null;
31 ArrayList<Boolean> agreementList = null;
32 ArrayList<BidStorage> lastBidList = null;
33 ArrayList<Double> discountedUtilList = null;
34
35 public SessionData(int sessionTotal) {
36 sessionsBitStorageList = new ArrayList<BidStorageList>(sessionTotal);
37 agreementList = new ArrayList<Boolean>(sessionTotal);
38 lastBidList = new ArrayList<BidStorage>(sessionTotal);
39 discountedUtilList = new ArrayList<Double>();
40 }
41
42 public void save(int sessionNr, BidStorageList bidList,
43 NegotiationResult result, double utility, double time) {
44 sessionsBitStorageList.add(bidList);
45 agreementList.add(result.isAgreement());
46 System.out.println(result.isAgreement());
47 lastBidList.add(new BidStorage(result.getLastBid(), utility, time));
48 discountedUtilList.add(result.getMyDiscountedUtility());
49 }
50
51 public Parameters getParamters(double res, double dis) {
52 double u = 0;
53 double t = 0;
54 double agreementCount = 0;
55
56 int size = lastBidList.size();
57 Parameters p = null;
58 for(int i=0; i<size; ++i) {
59 if(agreementList.get(i)) {
60 agreementCount += 1;
61 u += lastBidList.get(i).getUtility();
62 t += lastBidList.get(i).getTime();
63 }
64 }
65 if(agreementCount>0) {
66 p = new Parameters(u/agreementCount, t/agreementCount,
67 2.5*(2/(1+dis)), 2, 0.2*(1-dis));
68 } else {
69 p = new Parameters(1, 0,
70 2.5*(2/(1+dis)), 2, 0.2*(1-dis));
71 }
72
73 p.g *= Math.pow(1.1, size-agreementCount);
74 if(size > 0 && agreementList.get(size-1)==false) {
75 int count = 0;
76 for(int i=size-1; i>=0; --i) {
77 if(agreementList.get(i)) {
78 break;
79 }
80 count += 1;
81 }
82 p.beta *= Math.pow(0.9, count);
83 }
84
85 return p;
86 }
87}
Note: See TracBrowser for help on using the repository browser.