use of utilities.BarChart in project SimpleAsteroids by ljialin.
the class UrnSystem method main.
public static void main(String[] args) {
ElapsedTimer t = new ElapsedTimer();
UrnSystem us = new UrnSystem();
System.out.println(t);
double nWins = 15;
double nPicks = 15;
// nWins *=2;
// nPicks *= 2;
BarChart bc = new BarChart();
bc.update(us.pVec(nWins, nPicks));
new JEasyFrame(bc, nWins + " / " + nPicks);
System.out.println(Arrays.toString(us.pVec(nWins, nPicks)));
}
use of utilities.BarChart in project SimpleAsteroids by ljialin.
the class OptimalResampleTest method visualise.
public static void visualise(int nBits, int k) {
int nIterationsMax = 100000;
RMHCOneMaxProbabilityDiffuser diffuser = new RMHCOneMaxProbabilityDiffuser(nBits);
double resampled = noiseStdDev / Math.sqrt(k);
GaussTable gaussTable = new GaussTable();
double pCorrect = gaussTable.erf(1 / resampled);
double pErr = 1 - pCorrect;
// use this of we need to keep stats later
Integer iterationsNeeded = null;
// diffuser.
String title = "P Mass Diffusion, nEvals: ";
BarChart bc = new BarChart(new Dimension(640, 480), diffuser.p);
JEasyFrame frame = new JEasyFrame(bc, title);
for (int i = 0; i < nIterationsMax; i++) {
// System.out.println(i);
// diffuser.updateStandard(false);
bc.update(diffuser.p);
frame.setTitle(title + (i * k));
diffuser.updateNoisy(false, pErr);
try {
Thread.sleep(50);
} catch (Exception e) {
}
;
if (diffuser.pSolved() >= 0.5) {
return;
// iterationsNeeded = i;
// System.out.println("K = " + k);
// System.out.println("nBits = " + nBits );
// System.out.println("Solved in iterations: " + i);
// System.out.println("Fitness evals: " + i * k);
}
}
}
Aggregations