Browse Source

Some tidying in multi-objective code (auto format).

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10809 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 10 years ago
parent
commit
ec285b66b1
  1. 75
      prism/src/prism/MultiObjModelChecker.java

75
prism/src/prism/MultiObjModelChecker.java

@ -68,8 +68,9 @@ public class MultiObjModelChecker extends PrismComponent
}
//TODO: dra's element is changed here, not neat.
protected NondetModel constructDRAandProductMulti(NondetModel model, LTLModelChecker mcLtl, ModelChecker modelChecker, Expression ltl, int i, DA<BitSet,AcceptanceRabin> dra[], Operator operator,
Expression targetExpr, JDDVars draDDRowVars, JDDVars draDDColVars, JDDNode ddStateIndex) throws PrismException
protected NondetModel constructDRAandProductMulti(NondetModel model, LTLModelChecker mcLtl, ModelChecker modelChecker, Expression ltl, int i,
DA<BitSet, AcceptanceRabin> dra[], Operator operator, Expression targetExpr, JDDVars draDDRowVars, JDDVars draDDColVars, JDDNode ddStateIndex)
throws PrismException
{
// TODO (JK): Adapt to support simple path formulas with bounds via DRA construction
@ -262,7 +263,8 @@ public class MultiObjModelChecker extends PrismComponent
for (int i = 0; i < opsAndBounds.probSize(); i++) {
if (opsAndBounds.getProbOperator(i) != Operator.P_MAX) {
tmpOpsAndBounds.add(opsAndBounds.getOpRelOpBound(i), opsAndBounds.getProbOperator(i), opsAndBounds.getProbBound(i), opsAndBounds.getProbStepBound(i));
tmpOpsAndBounds.add(opsAndBounds.getOpRelOpBound(i), opsAndBounds.getProbOperator(i), opsAndBounds.getProbBound(i),
opsAndBounds.getProbStepBound(i));
}
}
tmpOpsAndBounds.add(new OpRelOpBound("R", RelOp.MAX, -1.0), Operator.R_MAX, -1.0, -1);
@ -354,9 +356,9 @@ public class MultiObjModelChecker extends PrismComponent
}
}
protected void findTargetStates(NondetModel modelProduct, LTLModelChecker mcLtl, int numTargets, int conflictformulae, boolean reachExpr[], DA<BitSet,AcceptanceRabin> dra[],
JDDVars draDDRowVars[], JDDVars draDDColVars[], List<JDDNode> targetDDs, List<JDDNode> multitargetDDs, List<Integer> multitargetIDs)
throws PrismException
protected void findTargetStates(NondetModel modelProduct, LTLModelChecker mcLtl, int numTargets, int conflictformulae, boolean reachExpr[],
DA<BitSet, AcceptanceRabin> dra[], JDDVars draDDRowVars[], JDDVars draDDColVars[], List<JDDNode> targetDDs, List<JDDNode> multitargetDDs,
List<Integer> multitargetIDs) throws PrismException
{
int i, j;
long l;
@ -679,8 +681,7 @@ public class MultiObjModelChecker extends PrismComponent
double time = ((double) (timePost - timePre)) / 1000.0;
mainLog.println("Multi-objective value iterations took " + time + " s.");
} else {
throw new PrismException("Don't know how to model-check using the method: "
+ method);
throw new PrismException("Don't know how to model-check using the method: " + method);
}
} catch (PrismException e) {
throw e;
@ -701,8 +702,8 @@ public class MultiObjModelChecker extends PrismComponent
return value;
}
protected Object weightedMultiReachProbs(NondetModel modelProduct, JDDNode yes_ones, JDDNode maybe, JDDNode st, JDDNode[] targets, List<JDDNode> rewards, OpsAndBoundsList opsAndBounds)
throws PrismException
protected Object weightedMultiReachProbs(NondetModel modelProduct, JDDNode yes_ones, JDDNode maybe, JDDNode st, JDDNode[] targets, List<JDDNode> rewards,
OpsAndBoundsList opsAndBounds) throws PrismException
{
int numberOfMaximizing = opsAndBounds.numberOfNumerical();
@ -730,7 +731,6 @@ public class MultiObjModelChecker extends PrismComponent
for (int i = 0; i < probStepBounds.length; i++)
probStepBounds[i] = opsAndBounds.getProbStepBound(i);
double timer = System.currentTimeMillis();
boolean min = false;
@ -812,13 +812,13 @@ public class MultiObjModelChecker extends PrismComponent
new double[] { 1.0 }, null);
}*/
if (settings.getChoice(PrismSettings.PRISM_MDP_SOLN_METHOD) == Prism.MDP_MULTI_GAUSSSEIDEL) {
result = PrismSparse.NondetMultiObjGS(modelProduct.getODD(), modelProduct.getAllDDRowVars(),
modelProduct.getAllDDColVars(), modelProduct.getAllDDNondetVars(), false, st, adversary,
trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights, rewardStepBounds);
result = PrismSparse.NondetMultiObjGS(modelProduct.getODD(), modelProduct.getAllDDRowVars(), modelProduct.getAllDDColVars(),
modelProduct.getAllDDNondetVars(), false, st, adversary, trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights,
rewardStepBounds);
} else {
result = PrismSparse.NondetMultiObj(modelProduct.getODD(), modelProduct.getAllDDRowVars(),
modelProduct.getAllDDColVars(), modelProduct.getAllDDNondetVars(), false, st, adversary,
trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights, rewardStepBounds);
result = PrismSparse.NondetMultiObj(modelProduct.getODD(), modelProduct.getAllDDRowVars(), modelProduct.getAllDDColVars(),
modelProduct.getAllDDNondetVars(), false, st, adversary, trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights,
rewardStepBounds);
}
//The following is thrown because in this case the i-th dimension is
@ -851,13 +851,13 @@ public class MultiObjModelChecker extends PrismComponent
new double[] { 1.0 }, new int[] { rewardStepBounds[i] });
}*/
if (settings.getChoice(PrismSettings.PRISM_MDP_SOLN_METHOD) == Prism.MDP_MULTI_GAUSSSEIDEL) {
result = PrismSparse.NondetMultiObjGS(modelProduct.getODD(), modelProduct.getAllDDRowVars(),
modelProduct.getAllDDColVars(), modelProduct.getAllDDNondetVars(), false, st, adversary,
trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights, rewardStepBounds);
result = PrismSparse.NondetMultiObjGS(modelProduct.getODD(), modelProduct.getAllDDRowVars(), modelProduct.getAllDDColVars(),
modelProduct.getAllDDNondetVars(), false, st, adversary, trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights,
rewardStepBounds);
} else {
result = PrismSparse.NondetMultiObj(modelProduct.getODD(), modelProduct.getAllDDRowVars(),
modelProduct.getAllDDColVars(), modelProduct.getAllDDNondetVars(), false, st, adversary,
trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights, rewardStepBounds);
result = PrismSparse.NondetMultiObj(modelProduct.getODD(), modelProduct.getAllDDRowVars(), modelProduct.getAllDDColVars(),
modelProduct.getAllDDNondetVars(), false, st, adversary, trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights,
rewardStepBounds);
}
numberOfPoints++;
@ -894,13 +894,13 @@ public class MultiObjModelChecker extends PrismComponent
double[] result;
if (prism.getMDPSolnMethod() == Prism.MDP_MULTI_GAUSSSEIDEL) {
result = PrismSparse.NondetMultiObjGS(modelProduct.getODD(), modelProduct.getAllDDRowVars(),
modelProduct.getAllDDColVars(), modelProduct.getAllDDNondetVars(), false, st, adversary,
trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights, rewardStepBounds);
result = PrismSparse.NondetMultiObjGS(modelProduct.getODD(), modelProduct.getAllDDRowVars(), modelProduct.getAllDDColVars(),
modelProduct.getAllDDNondetVars(), false, st, adversary, trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights,
rewardStepBounds);
} else {
result = PrismSparse.NondetMultiObj(modelProduct.getODD(), modelProduct.getAllDDRowVars(),
modelProduct.getAllDDColVars(), modelProduct.getAllDDNondetVars(), false, st, adversary,
trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights, rewardStepBounds);
result = PrismSparse.NondetMultiObj(modelProduct.getODD(), modelProduct.getAllDDRowVars(), modelProduct.getAllDDColVars(),
modelProduct.getAllDDNondetVars(), false, st, adversary, trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights,
rewardStepBounds);
}
/* //Minimizing operators are negated, and for Pareto we need to maximize.
@ -976,7 +976,6 @@ public class MultiObjModelChecker extends PrismComponent
for (int i = 0; i < probStepBounds.length; i++)
probStepBounds[i] = opsAndBounds.getProbStepBound(i);
double timer = System.currentTimeMillis();
boolean min = false;
@ -999,7 +998,8 @@ public class MultiObjModelChecker extends PrismComponent
boolean maximizingProb = (opsAndBounds.probSize() > 0 && (opsAndBounds.getProbOperator(0) == Operator.P_MAX || opsAndBounds.getProbOperator(0) == Operator.P_MIN));
boolean maximizingReward = (opsAndBounds.rewardSize() > 0 && (opsAndBounds.getRewardOperator(0) == Operator.R_MAX || opsAndBounds.getRewardOperator(0) == Operator.R_MIN));
boolean maximizingNegated = (maximizingProb && opsAndBounds.getProbOperator(0) == Operator.P_MIN) || (maximizingReward && opsAndBounds.getRewardOperator(0) == Operator.R_MIN);
boolean maximizingNegated = (maximizingProb && opsAndBounds.getProbOperator(0) == Operator.P_MIN)
|| (maximizingReward && opsAndBounds.getRewardOperator(0) == Operator.R_MIN);
int maxIters = settings.getInteger(PrismSettings.PRISM_MULTI_MAX_POINTS);
@ -1103,13 +1103,13 @@ public class MultiObjModelChecker extends PrismComponent
double[] result;
if (prism.getMDPSolnMethod() == Prism.MDP_MULTI_GAUSSSEIDEL) {
result = PrismSparse.NondetMultiObjGS(modelProduct.getODD(), modelProduct.getAllDDRowVars(),
modelProduct.getAllDDColVars(), modelProduct.getAllDDNondetVars(), false, st, adversary,
trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights, rewardStepBounds);
result = PrismSparse.NondetMultiObjGS(modelProduct.getODD(), modelProduct.getAllDDRowVars(), modelProduct.getAllDDColVars(),
modelProduct.getAllDDNondetVars(), false, st, adversary, trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights,
rewardStepBounds);
} else {
result = PrismSparse.NondetMultiObj(modelProduct.getODD(), modelProduct.getAllDDRowVars(),
modelProduct.getAllDDColVars(), modelProduct.getAllDDNondetVars(), false, st, adversary,
trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights, rewardStepBounds);
result = PrismSparse.NondetMultiObj(modelProduct.getODD(), modelProduct.getAllDDRowVars(), modelProduct.getAllDDColVars(),
modelProduct.getAllDDNondetVars(), false, st, adversary, trans_matrix, probDoubleVectors, probStepBounds, rewSparseMatrices, weights,
rewardStepBounds);
}
numberOfPoints++;
@ -1123,7 +1123,6 @@ public class MultiObjModelChecker extends PrismComponent
computedPoints.add(newPoint);
computedDirections.add(direction);
//if (prism.getExportMultiGraphs())
// MultiObjUtils.printGraphFileDebug(targetPoint, computedPoints, computedDirections, prism.getExportMultiGraphsDir(), output++);

Loading…
Cancel
Save