Last change
on this file since 345 was 153, checked in by Aron Hammond, 6 years ago |
Added function to calculate opposition to MultiLateralAnalysis.java
Moved code to add RLBOA listeners to RLBOAUtils is misc package
!! close SessionInfo after tournament; this caused /tmp/ to fill up with GeniusData files
This commit finalized the RLBOA project and it is now ready for use
Our own package (uva.project.:
- Moved to agents.rlboa
- Added opponents and strategies that are mentioned in the report
- Change class hierarchy, agents can now extend from RLBOAagentBilateral to inherit RL functionality.
- States extend from AbstractState
|
File size:
1.3 KB
|
Line | |
---|
1 | package agents.rlboa;
|
---|
2 |
|
---|
3 | import java.util.Objects;
|
---|
4 |
|
---|
5 | public class State extends AbstractState implements BinnedRepresentation {
|
---|
6 |
|
---|
7 | private int myBin;
|
---|
8 | private int oppBin;
|
---|
9 | private int time;
|
---|
10 |
|
---|
11 | public static State TERMINAL = new State(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
---|
12 | public static State INITIAL = new State(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
---|
13 |
|
---|
14 | // TODO: Initialize these values from config file
|
---|
15 | private static int initialActionSpace = 10;
|
---|
16 | private static int standardActionSpace = 3;
|
---|
17 |
|
---|
18 | public State(int myBin, int oppBin, int time) {
|
---|
19 | this.myBin = myBin;
|
---|
20 | this.oppBin = oppBin;
|
---|
21 | this.time = time;
|
---|
22 | }
|
---|
23 |
|
---|
24 | public int getActionSize() {
|
---|
25 | if (this.getMyBin() < 0) {
|
---|
26 | return initialActionSpace;
|
---|
27 | }
|
---|
28 | else {
|
---|
29 | return standardActionSpace;
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | public int getMyBin() {
|
---|
34 | return this.myBin;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public int getOppBin() {
|
---|
38 | return this.oppBin;
|
---|
39 | }
|
---|
40 |
|
---|
41 | public int getTime() {
|
---|
42 | return this.time;
|
---|
43 | }
|
---|
44 |
|
---|
45 | public boolean isInitialState() {
|
---|
46 | return this.equals(State.INITIAL);
|
---|
47 | }
|
---|
48 |
|
---|
49 | public boolean isTerminalState() {
|
---|
50 | return this.equals(State.TERMINAL);
|
---|
51 | }
|
---|
52 |
|
---|
53 | public int hash() {
|
---|
54 | return Objects.hash(this.getMyBin(), this.getOppBin(), this.getTime());
|
---|
55 | }
|
---|
56 |
|
---|
57 | @Override
|
---|
58 | public String toString() {
|
---|
59 | return String.format("My bin: %d, Opp bin: %d, Time: %d", this.getMyBin(), this.getOppBin(), this.getTime());
|
---|
60 | }
|
---|
61 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.