source: src/main/java/agents/anac/y2014/BraveCat/necessaryClasses/Schedular.java@ 127

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

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 3.7 KB
Line 
1package agents.anac.y2014.BraveCat.necessaryClasses;
2
3import java.util.ArrayList;
4import java.util.List;
5
6public class Schedular
7{
8 private List<Double> ReceivedBidsDurations;
9 private List<Double> SentBidsDurations;
10 private NegotiationSession negotiationSession;
11
12 public Schedular(NegotiationSession negoSession) throws Exception
13 {
14 negotiationSession = negoSession;
15 ReceivedBidsDurations = new ArrayList();
16 SentBidsDurations = new ArrayList();
17 }
18 public Boolean LastRound()
19 {
20 double LastReceivedBidsDuration = 0;
21 double ExpectedLastBidTime = 0;
22 int size = this.negotiationSession.getOpponentBidHistory().getHistory().size();
23 if(size >= 2)
24 {
25 LastReceivedBidsDuration = this.negotiationSession.getOpponentBidHistory().getHistory().get(size - 1).getTime() - this.negotiationSession.getOpponentBidHistory().getHistory().get(size - 2).getTime();
26 ReceivedBidsDurations.add(LastReceivedBidsDuration);
27 if(size >= 3)
28 LastReceivedBidsDuration = Math.min(ReceivedBidsDurations.get(ReceivedBidsDurations.size() - 1), ReceivedBidsDurations.get(ReceivedBidsDurations.size() - 2));
29 if(size >= 4)
30 LastReceivedBidsDuration = Math.min(LastReceivedBidsDuration, ReceivedBidsDurations.get(ReceivedBidsDurations.size() - 3));
31
32 if(size * 0.002 >= 1)
33 LastReceivedBidsDuration = size * 0.002 * LastReceivedBidsDuration;
34
35 ExpectedLastBidTime = this.negotiationSession.getOpponentBidHistory().getLastBidDetails().getTime() + (2 * LastReceivedBidsDuration);
36
37 //System.out.println(ExpectedLastBidTime);
38
39 if(ExpectedLastBidTime > 1)
40 {
41 System.out.println("Final Rounds (1): " + this.negotiationSession.getTime() + " ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
42 return true;
43 }
44 }
45 return false;
46 }
47 public Boolean FinalRounds()
48 {
49 double LastSentBidsDuration = 0;
50 double ExpectedLastBidTime = 0;
51 int size = this.negotiationSession.getOwnBidHistory().getHistory().size();
52 if(size >= 1)
53 {
54 LastSentBidsDuration = negotiationSession.getTime() - negotiationSession.getOwnBidHistory().getLastBidDetails().getTime();
55 SentBidsDurations.add(LastSentBidsDuration);
56 if(size >= 2)
57 LastSentBidsDuration = Math.min(SentBidsDurations.get(SentBidsDurations.size() - 1), SentBidsDurations.get(SentBidsDurations.size() - 2));
58 if(size >= 3)
59 LastSentBidsDuration = Math.min(LastSentBidsDuration, SentBidsDurations.get(SentBidsDurations.size() - 3));
60
61 if(size * 0.002 >= 1)
62 LastSentBidsDuration = size * 0.002 * LastSentBidsDuration;
63
64 ExpectedLastBidTime = negotiationSession.getTime() + (2 * LastSentBidsDuration);
65
66 //System.out.println(ExpectedLastBidTime);
67
68 if(ExpectedLastBidTime > 1)
69 {
70 System.out.println("Final Rounds (2): " + this.negotiationSession.getTime() + " ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
71 return true;
72 }
73 }
74 return false;
75 }
76}
Note: See TracBrowser for help on using the repository browser.