Browse Source

Some useful code (commented out) for getting variance etc. from simulation results.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@5425 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 14 years ago
parent
commit
5131fb407f
  1. 16
      prism/src/simulator/method/CIMethod.java

16
prism/src/simulator/method/CIMethod.java

@ -131,21 +131,25 @@ public abstract class CIMethod extends SimulationMethod
@Override @Override
public Object getResult(Sampler sampler) throws PrismException public Object getResult(Sampler sampler) throws PrismException
{ {
double estimate = sampler.getMeanValue();
double mean = sampler.getMeanValue();
//double variance = sampler.getVariance();
//double stddev = Math.sqrt(variance);
switch (prOp) { switch (prOp) {
case 0: // 0=quantitative case 0: // 0=quantitative
return new Double(estimate);
return new Double(mean);
//return new prism.Interval(mean - stddev, mean + stddev);
//return new Double(stddev / mean); // noise
case -1: // -1=lower bound case -1: // -1=lower bound
if (estimate >= theta + width)
if (mean >= theta + width)
return new Boolean(true); return new Boolean(true);
else if (estimate <= theta - width)
else if (mean <= theta - width)
return new Boolean(false); return new Boolean(false);
else else
throw new PrismException("Approximation is not precise enough to get a result"); throw new PrismException("Approximation is not precise enough to get a result");
case 1: // 1=upper bound case 1: // 1=upper bound
if (estimate >= theta + width)
if (mean >= theta + width)
return new Boolean(false); return new Boolean(false);
else if (estimate <= theta - width)
else if (mean <= theta - width)
return new Boolean(true); return new Boolean(true);
else else
throw new PrismException("Approximation is not precise enough to get a result"); throw new PrismException("Approximation is not precise enough to get a result");

Loading…
Cancel
Save