source: src/main/java/genius/gui/progress/DataKey.java@ 209

Last change on this file since 209 was 30, checked in by dimitrios, 6 years ago

Additions to uncertainty framework to support tournament configuration and command line running

File size: 2.5 KB
Line 
1package genius.gui.progress;
2
3import java.util.ArrayList;
4import java.util.HashMap;
5import java.util.List;
6
7import genius.core.events.SessionEndedNormallyEvent;
8
9/**
10 * These keys are datatypes for data , eg in {@link HashMap}s. See e.g.
11 * {@link SessionEndedNormallyEvent#getValues()}.
12 *
13 * The keys also have a human-readable text version. This can be used as basis
14 * for the column text strings for data display and logging.
15 *
16 * The keys {@link DataKey#DISCOUNTED_UTILS}, {@link DataKey#UTILS},
17 * {@link DataKey#FILES} and {@link DataKey#AGENTS} contain lists. The function
18 * {@link SessionEndedNormallyEvent#getValues()} will convert these to strings
19 * and extend these keys with the agent number, and we then have eg 3 columns
20 * "Utility 1", "Utility 2" and "Utility 3" in the table. In the map, the UTILS
21 * field will be an {@link List} with 3 values in that case. see also
22 * {@link SessionEndedNormallyEvent#getValues()}.
23 *
24 * The {@link DataKeyTableModel} can handle such data directly.
25 *
26 * Note that the order of the enum is irrelevant; the order in which the keys
27 * are provided to the {@link DataKeyTableModel} determines the column order.
28 *
29 * @author W.Pasman 16jul15
30 *
31 */
32public enum DataKey implements Comparable<DataKey> {
33 RUNTIME("Run time (s)"), ROUND("Round"), EXCEPTION("Exception"), DEADLINE("deadline"), IS_AGREEMENT(
34 "Agreement"), IS_DISCOUNT("Discounted"), NUM_AGREE("#agreeing"), MINUTIL(
35 "min.util."), MAXUTIL("max.util."), DIST_PARETO(
36 "Dist. to Pareto"), DIST_NASH("Dist. to Nash"), SOCIAL_WELFARE("Social Welfare"),
37 /**
38 * List of the agent class names
39 */
40 AGENTS("Agent"),
41 /**
42 * List of Undiscounted utilities for all agents (in proper order)
43 */
44 UTILS("Utility"),
45 /**
46 * List with the discounted utilities for all agents (in proper order)
47 */
48 DISCOUNTED_UTILS("Disc. Util."),
49 /**
50 * List with the perceived utilities in case of uncertainty (in proper order)
51 */
52 PERCEIVED_UTILS("Perceived. Util."),
53
54 FILES("Profile");
55
56 String name;
57
58 DataKey(String n) {
59 name = n;
60 }
61
62 /**
63 *
64 * @return human-readable short description of this column
65 */
66 public String getName() {
67 return name;
68 }
69
70 /**
71 * @return n human-readable short descriptions of this column. The
72 * descriptions are just the name, but with an added number 1..n
73 */
74 public List<String> getNames(int num) {
75 List<String> names = new ArrayList<String>();
76 for (int n = 1; n <= num; n++) {
77 names.add(name + " " + n);
78 }
79 return names;
80 }
81
82};
Note: See TracBrowser for help on using the repository browser.