-
Notifications
You must be signed in to change notification settings - Fork 10
Sample Main Class
Junho Kim edited this page Jan 16, 2017
·
1 revision
public class RobotMain {
public static void main(String[] args) throws IOException{
RobotScenario robot = new RobotScenario(0);
Simulator sim = new Simulator(robot);
BaseChecker checker = new BaseChecker();
checker.init(sim.getScenario().getEndTick(), 3, BaseChecker.comparisonType.EQUAL_TO);
SPRTMethod sprt = new SPRTMethod(0.05, 0.05, 0.01);
sprt.setLessCheck();
ArrayList<RobotResult> resList = new ArrayList<>();
for (int i = 1; i < 100; i++) {
double theta = 0.01 * i;
sprt.setExpression(theta);
while (!sprt.checkStopCondition()) {
sim.execute();
int result = checker.evaluateSample(sim.getResult());
if (result == 1) result = 0;
else result = 1;
sprt.updateResult(result);
sim.reset();
}
boolean h0 = sprt.getResult(); // Result
int numSamples = sprt.getNumSamples();
sprt.reset();
if (h0) System.out.print("T");
else System.out.print("F");
if (resList.size() < 99)
resList.add(new RobotResult(h0, numSamples, theta));
else {
RobotResult res = resList.get(i - 1);
res.updateResult(numSamples);
resList.set(i - 1, res);
}
}
}
}
This is a sample main class of SoS-case scenario. You need to include scenario, checker, smc method class for your verification.