本文整理汇总了Java中org.sat4j.tools.GateTranslator类的典型用法代码示例。如果您正苦于以下问题:Java GateTranslator类的具体用法?Java GateTranslator怎么用?Java GateTranslator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GateTranslator类属于org.sat4j.tools包,在下文中一共展示了GateTranslator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
VecInt literals = new VecInt();
for (Variable var : this.vars) {
var.addToGateTranslator(translator);
literals.push(var.getIndex());
}
this.vars = null;
translator.xor(this.getIndex(), literals);
}
示例2: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
VecInt lits = new VecInt();
for (Variable var : this.vars) {
var.addToGateTranslator(translator);
lits.push(var.getIndex());
}
this.vars = null;
translator.or(this.getIndex(), lits);
}
示例3: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
this.p.addToGateTranslator(translator);
this.q.addToGateTranslator(translator);
True z = new True();
z.addToGateTranslator(translator);
translator.ite(this.getIndex(), this.p.getIndex(), this.q.getIndex(),
z.getIndex());
// Not operation = new Not(new And(this.p, new Not(this.q)));
// operation.addToGateTranslator(translator);
}
示例4: getSolvableProblem
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
/**
* If already called, will return the previous solver!
*
* @param tunings
* enable tunings
* @return the problem
* @throws ContradictionException
*/
public IProblem getSolvableProblem(boolean tunings)
throws ContradictionException {
if (this.solver != null)
return this.solver;
this.solver = SolverFactory.newDefault();
this.solver.setVerbose(true);
GateTranslator translator = new GateTranslator(this.solver);
System.out.println("Representing problem in Java");
LogicStatement problem = this.getProblem();
System.out.println("Adding to GateTranslator");
problem.addToGateTranslator(translator);
if (tunings) {
System.out.println("Adding tunings to GateTranslator");
this.getTunings().addToGateTranslator(translator);
}
// allow to free psis
this.psiResults = null;
return this.solver;
}
示例5: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
addedToGateTranslator = true;
System.out.println("Translating beta1");
Variable[] andn = new Variable[k];
for (int i = 0; i < k; i++) {
Variable[] vars = new Variable[n + k];
for (int j = 0; j < n; j++) {
vars[j] = B[i][j];
}
for (int j = 0; j < k; j++) {
vars[n + j] = C[i][j];
}
andn[i] = new ExactlyN(2, vars);
}
AndN a = new AndN(getIndex(), andn);
a.addToGateTranslator(translator);
}
示例6: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
translator.gateFalse(this.getIndex());
}
示例7: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
this.p.addToGateTranslator(translator);
translator.not(this.getIndex(), this.p.getIndex());
this.p = null;
}
示例8: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
VecInt lits = new VecInt();
for (Variable var : this.vars) {
var.addToGateTranslator(translator);
lits.push(var.getIndex());
}
this.vars = null;
translator.addAtLeast(lits, this.n);
}
示例9: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
VecInt lits = new VecInt();
for (Variable lit : vars) {
lit.addToGateTranslator(translator);
lits.push(lit.getIndex());
}
vars = null;
translator.addExactly(lits, n);
}
示例10: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
VecInt literals = new VecInt();
for (Variable var : this.variables) {
var.addToGateTranslator(translator);
literals.push(var.getIndex());
}
this.variables = null;
translator.and(this.getIndex(), literals);
}
示例11: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
translator.gateTrue(this.getIndex());
}
示例12: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
this.p.addToGateTranslator(translator);
this.q.addToGateTranslator(translator);
translator.iff(this.getIndex(),
new VecInt(new int[] { this.p.getIndex(), this.q.getIndex() }));
this.p = this.q = null;
}
示例13: addToGateTranslator
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
@Override
public void addToGateTranslator(GateTranslator translator)
throws ContradictionException {
if (this.addedToGateTranslator)
return;
this.addedToGateTranslator = true;
VecInt lits = new VecInt();
for (Variable var : this.vars) {
var.addToGateTranslator(translator);
lits.push(var.getIndex());
}
this.vars = null;
translator.addAtMost(lits, this.n);
}
示例14: getDimacsSolver
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
/**
* Try to get the dimacs representation
*
* Doesn't work because of exactly_2
*
* @param tunings
* @return the Dimacs solver
* @throws ContradictionException
*/
public ISolver getDimacsSolver(boolean tunings)
throws ContradictionException {
ISolver solver = new DimacsStringSolver();
GateTranslator translator = new GateTranslator(solver);
this.getProblem().addToGateTranslator(translator);
if (tunings) {
this.getTunings().addToGateTranslator(translator);
}
return solver;
}
示例15: AIGReader
import org.sat4j.tools.GateTranslator; //导入依赖的package包/类
AIGReader(ISolver s) {
solver = new GateTranslator(s);
}