Skip to content

Commit 943ba06

Browse files
committed
upgraded labels
1 parent d4c7d9b commit 943ba06

File tree

5 files changed

+55
-27
lines changed

5 files changed

+55
-27
lines changed

src/SharpNeatDomains/IPD/IPDDomain.cs

+49-22
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@ namespace SharpNeat.Domains.IPD
1313
{
1414
partial class IPDDomain : AbstractDomainView
1515
{
16-
public override Size WindowSize => new Size(_tableSize.Width + _graphSize.Width + 50, 90 + Math.Max(_tableSize.Height, _graphSize.Height));
16+
public override Size WindowSize => new Size(_tableSize.Width + _graphSize.Width + 50, 120 + Math.Max(_tableSize.Height, _graphSize.Height));
1717

1818
private IGenomeDecoder<NeatGenome, IBlackBox> _genomeDecoder;
1919
private IPDExperiment.Info _info;
2020
private IPDPlayer[] _players;
2121
private IPDGame[,] _games;
22-
23-
private System.Windows.Forms.Label _label;
22+
2423
private Size _labelSize = new Size(1400, 30);
25-
private Point _labelLocation = new Point(10, 10);
24+
private Point _label1Location = new Point(10, 10);
25+
private Point _label2Location = new Point(10, 40);
2626

2727
private DataGridView _table;
2828
private Size _tableSize = new Size(700, 700);
29-
private Point _tableLocation = new Point(10, 40);
29+
private Point _tableLocation = new Point(10, 70);
3030
private ToolStripMenuItem _history;
3131
private ToolStripMenuItem _save;
3232
private DataGridViewColumn _cumulative;
3333
private DataGridViewColumn _rankings;
3434

3535
private ZedGraphControl _graphArchive;
3636
private Size _graphSize = new Size(700, 700);
37-
private Point _graphLocation = new Point(720, 40);
37+
private Point _graphLocation = new Point(720, 70);
3838

3939
public IPDDomain(IGenomeDecoder<NeatGenome, IBlackBox> genomeDecoder, ref IPDExperiment.Info info)
4040
{
@@ -95,23 +95,50 @@ public override void RefreshView(object genome)
9595

9696
private void CreateInfoLabel()
9797
{
98-
_label = new System.Windows.Forms.Label();
99-
_label.Size = _labelSize;
100-
_label.Location = _labelLocation;
101-
_label.Font = new Font(_label.Font.FontFamily, 12);
98+
var label1 = new System.Windows.Forms.Label();
99+
label1.Size = _labelSize;
100+
label1.Location = _label1Location;
101+
label1.Font = new Font(label1.Font.FontFamily, 12);
102102

103-
_label.Text = "Generation "
103+
label1.Text =
104+
"Generation "
104105
+ _info.CurrentGeneration
105-
+ ", <"
106-
+ _info.EvaluationMode
107-
+ "> Evaluation Mode, <"
108-
+ _info.NoveltyMetric
109-
+ "> Novelty Metric with KNN-"
110-
+ _info.NoveltyK
111-
+ ", can look back t-"
112-
+ _info.InputCount / 2
113-
+ " steps in history";
114-
Controls.Add(_label);
106+
+ "; "
107+
+ _info.Evaluations()
108+
+ " evaluations; "
109+
+ _info.PopulationSize
110+
+ " genomes; "
111+
+ _info.NumberOfGames
112+
+ " iterated games per opponent";
113+
114+
var label2 = new System.Windows.Forms.Label();
115+
label2.Size = _labelSize;
116+
label2.Location = _label2Location;
117+
label2.Font = new Font(label2.Font.FontFamily, 10);
118+
119+
if (_info.EvaluationMode == IPDExperiment.EvaluationMode.Novelty)
120+
{
121+
label2.Text =
122+
"("
123+
+ _info.EvaluationMode
124+
+ ") Evaluation Mode, ("
125+
+ _info.NoveltyMetric
126+
+ ") Novelty Metric with KNN-"
127+
+ _info.NoveltyK
128+
+ ", memory-"
129+
+ _info.InputCount / 2;
130+
}
131+
else
132+
{
133+
label2.Text =
134+
"("
135+
+ _info.EvaluationMode
136+
+ ") Evaluation Mode, memory-"
137+
+ _info.InputCount / 2;
138+
}
139+
140+
Controls.Add(label1);
141+
Controls.Add(label2);
115142
}
116143

117144
private void CreateArchiveGraph()
@@ -188,7 +215,7 @@ private void UpdateArchiveGraph()
188215
ar.Line.Width = 3;
189216

190217
var t = g.AddCurve("Top Score", topScore, Color.Purple, SymbolType.Square);
191-
t.Line.Width = 3;
218+
t.Line.Width = 2;
192219

193220
var s = g.AddCurve("Score", ii, score, Color.Maroon, SymbolType.HDash);
194221
s.Line.IsVisible = false;

src/SharpNeatDomains/IPD/IPDEvaluator.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public IPDEvaluator(ref IPDExperiment.Info info)
3232
_info = info;
3333
_info.BestNoveltyGenome = () => { var m = _archive.Max(); return m.Phenome; };
3434
_info.Archive = () => { return _archive; };
35+
_info.Evaluations = () => { return EvaluationCount; };
3536
PhenomeInfo.Initialize(info);
3637
}
3738

@@ -60,12 +61,12 @@ public FitnessInfo Evaluate(IBlackBox phenome)
6061

6162
lock (_stopLock)
6263
{
63-
if (EvaluationCount == 500000)
64+
if (_info.CurrentGeneration == 500)
6465
_stopConditionSatisfied = true;
6566
}
6667

6768
return new FitnessInfo(primaryFitness, pi.AuxiliaryFitnessInfo);
68-
//graph of _archive, sohuld be easy..
69+
6970
//if (_info.EvaluationMode == IPDExperiment.EvaluationMode.Rank && pi.Rank == 1.0d && gen > 0)
7071
//{
7172
// lock (_stopLock)

src/SharpNeatDomains/IPD/IPDExperiment.cs

+1
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ public class Info
340340

341341
public int PopulationSize { get { return _exp._populationSize; } }
342342
public int CurrentGeneration { get { return (int)_genGet(); } }
343+
public System.Func<ulong> Evaluations { get; set; }
343344
public System.Func<IBlackBox> BestNoveltyGenome { get; set; }
344345
public IBlackBox BestGenome { get { return _boxGet(); } }
345346
public double BestFitness { get { return _fitGet(); } }

src/SharpNeatDomains/IPD/Players/IPDPlayerAdaptive.cs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public IPDPlayerAdaptive()
2323

2424
public override IPDGame.Choices Choice(IPDGame game)
2525
{
26-
IPDGame.Choices r;
2726
IPDGame.Choices pr;
2827
int prt = game.T - 1;
2928

src/SharpNeatDomains/SharpNeatDomains.experiments.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<RandomPlayerSeed>9865</RandomPlayerSeed>
2020
<RandomPlayerCount>0</RandomPlayerCount>
2121
<RandomRobustCheck>100</RandomRobustCheck>
22-
<StaticOpponents>ZD_2,ZD_2</StaticOpponents>
22+
<StaticOpponents>ZDGTFT_2,ZDGTFT_2</StaticOpponents>
2323
<!--
2424
AllC,
2525
AllD,
@@ -39,7 +39,7 @@
3939
CD,
4040
DC
4141
-->
42-
<EvaluationMode>Score</EvaluationMode>
42+
<EvaluationMode>Novelty</EvaluationMode>
4343
<!--
4444
Score, (objective)
4545
Rank, (objective)

0 commit comments

Comments
 (0)