本文整理汇总了Java中kodkod.engine.Solution.Outcome类的典型用法代码示例。如果您正苦于以下问题:Java Outcome类的具体用法?Java Outcome怎么用?Java Outcome使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Outcome类属于kodkod.engine.Solution包,在下文中一共展示了Outcome类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callSolver
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
private Callable<Outcome> callSolver(final SATFactory factory) {
return new Callable<Outcome>() {
public Outcome call() throws Exception {
return solveWith(factory);
}
};
}
示例2: testPlingelingOneThread
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
@Test
public void testPlingelingOneThread() {
final SATFactory pl = SATFactory.plingeling(1,null);
assertEquals(Outcome.UNSATISFIABLE, solveWith(pl));
}
示例3: testPlingelingPortfolio
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
@Test
public void testPlingelingPortfolio() {
final SATFactory pl = SATFactory.plingeling(null,true);
assertEquals(Outcome.UNSATISFIABLE, solveWith(pl));
}
示例4: testPlingelingThreeThreadsPortfolio
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
@Test
public void testPlingelingThreeThreadsPortfolio() {
final SATFactory pl = SATFactory.plingeling(3,true);
assertEquals(Outcome.UNSATISFIABLE, solveWith(pl));
}
示例5: solveWith
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
private Outcome solveWith(SATFactory factory) {
final Solver solver = new Solver();
solver.options().setSolver(factory);
return solver.solve(formula, bounds).outcome();
}
示例6: checkOutcomeAndStats
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
private Solution checkOutcomeAndStats(Solution s, Outcome expectedOutcome, int expectedPrimaryVars) {
assertEquals(expectedOutcome, s.outcome());
assertEquals(expectedPrimaryVars, s.stats().primaryVariables());
return s;
}
示例7: generate
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
public USEResult generate(boolean isRetry) throws transException {
synchronized (index) {
WitnessGeneratorMemory.index += 1;
}
try {
if ( ! isRetry )
adaptMetamodels(index);
} catch ( Exception e ) {
throw new AdaptationInternalError(e);
}
if ( initialTime == -1) {
this.initialTime = System.currentTimeMillis();
}
if ( isRetry ) {
long current = System.currentTimeMillis();
long remaining = timeOut - (current - initialTime);
if ( remaining <= 0 ) {
throw new TimeOutException();
}
initialTime = current;
timeOut = remaining;
}
if ( debugMode ) {
String witness = generateWitness(getTempDirectoryPath(), errorMM, oclConstraint, index);
if ( witness != null )
generateGraphics(witness);
Outcome outcome = witness != null ? Outcome.SATISFIABLE : Outcome.UNSATISFIABLE;
return new USEResult(outcome, true, null, -1);
} else {
USEResult r = null;
if ( scopeCalculator == null )
r = generateWitnessStaticInMemory(getTempDirectoryPath(), errorMM, oclConstraint, index, minScope, maxScope, timeOut, this.additionalConstraints);
else
r = generateWitnessStaticInMemory(getTempDirectoryPath(), errorMM, oclConstraint, index, scopeCalculator, timeOut, this.additionalConstraints);
return r;
// if ( r == null ) {
// return false;
// } else if ( r.isSatisfiable() ) {
// return true;
// } else if ( r.isDiscarded() ) {
// return false;
// } else {
// return false; // I should return a better value... because this probably does not mean discarded by USE_LIMITATION or INVARIANT_FAILED or something like this
// // throw new RuntimeException("USE failed in the evaluation of some invariant");
// }
// // return r != null && r.isSatisfiable();
}
}
示例8: USEResult
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
public USEResult(Outcome outcome, boolean satisfyAllInvariants, IWitnessModel model, int defaultScope) {
this.outcome = outcome;
this.satisfyAllInvariants = satisfyAllInvariants;
this.model = model;
this.scope = defaultScope;
}
示例9: isSatisfiable
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
public static boolean isSatisfiable(Outcome outcome, boolean satisfyAllInvariants) {
return satisfyAllInvariants &&
outcome == Outcome.SATISFIABLE ||
outcome == Outcome.TRIVIALLY_SATISFIABLE;
}
示例10: isDiscarded
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
public boolean isDiscarded() {
return satisfyAllInvariants &&
outcome == Outcome.UNSATISFIABLE ||
outcome == Outcome.TRIVIALLY_UNSATISFIABLE;
}
示例11: handleUSECall
import kodkod.engine.Solution.Outcome; //导入依赖的package包/类
protected Pair<Outcome, Boolean> handleUSECall(InputStream iStream, StringReader metamodelBounds) throws ConfigurationException, transException {
MModel model = null;
// PrintWriter fLogWriter = new PrintWriter(System.out);
PrintWriter fLogWriter = new PrintWriter(System.out);
// PrintWriter fLogWriter = new NullPrintWriter();
model = USECompiler.compileSpecification(iStream, "<generated>", fLogWriter, new ModelFactory());
final MSystem system;
if (model != null) {
// fLogWriter.println(model.getStats());
// create system
system = new MSystem(model);
} else {
system = null;
throw new transException(ERROR.EXECUTION_ERROR, "USE file contains errors...");
}
fSession.setSystem(system);
PluginModelFactory.INSTANCE.registerForSession(fSession);
PluginModelFactory.INSTANCE.onClassInvariantUnloaded(null); // new in USE 4.1.1 (enforce model reload)
InternalUseValidator modelValidator = new InternalUseValidator(fSession);
IModel kodkodModel = PluginModelFactory.INSTANCE.getModel(system.model());
ModelEnricher enricher = KodkodModelValidatorConfiguration.INSTANCE.getModelEnricher();
enricher.enrichModel(system, kodkodModel);
// configure
org.apache.commons.configuration.Configuration config = extractConfigFromFile(metamodelBounds);
kodkodModel.reset();
PropertyConfigurationVisitor newConfigurationVisitor = new PropertyConfigurationVisitor(config, fLogWriter);
kodkodModel.accept(newConfigurationVisitor);
if (newConfigurationVisitor.containErrors()) {
System.out.println("error! " + newConfigurationVisitor.toString());
return null;
// throw new ConfigurationException(LogMessages.configurationError);
}
// end-of-configure
// Log.setDebug(true);
configureInvariantSettingsFromGenerator(kodkodModel, model);
modelValidator.validate(kodkodModel);
fSession.system().registerPPCHandlerOverride(Shell.getInstance());
MSystemState result = system.state();
// KodkodModelValidatorConfiguration.INSTANCE.setBitwidth(8);
// KodkodModelValidatorConfiguration.INSTANCE.setSatFactory("DefaultSAT4J");
// .put("defaultsat4j", "DefaultSAT4J")
// .put("lightsat4j", "LightSAT4J")
// .put("lingeling", "Lingeling")
// .put("minisat", "MiniSat")
// .put("minisatprover", "MiniSatProver")
// .put("cryptominisat", "CryptoMiniSat")
// .put("zchaffmincost", "ZChaffMincost")
// check whether the result satisfies all invariants
boolean ok = result.check(fLogWriter, true, true, true, Collections.<String>emptyList());
this.result = result;
Outcome outcome = modelValidator.getSolution().outcome();
if ( outcome == null )
return null;
return new Pair<Outcome, Boolean>(modelValidator.getSolution().outcome(), ok);
}