本文整理汇总了Java中org.sat4j.specs.IVecInt.set方法的典型用法代码示例。如果您正苦于以下问题:Java IVecInt.set方法的具体用法?Java IVecInt.set怎么用?Java IVecInt.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sat4j.specs.IVecInt
的用法示例。
在下文中一共展示了IVecInt.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyTo
import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
public void copyTo(IVecInt arg0) {
int argLength = arg0.size();
final int[] workArray = vec; // faster access
arg0.ensure(argLength + workArray.length);
for (int i : workArray) {
arg0.set(argLength++, i);
}
}
示例2: copyTo
import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
public void copyTo(IVecInt arg0) {
int argLength = arg0.size();
arg0.ensure(argLength + vec.length);
for(int i : vec) {
arg0.set(argLength++, i);
}
}
示例3: computeExplanation
import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
private void computeExplanation(ISolver solver, Map<Integer, ?> constrs,
IVecInt encodingAssumptions, int start, int end, IVecInt result)
throws TimeoutException {
if (solver.isVerbose()) {
System.out.println(solver.getLogPrefix() + "qxplain " + start + "/"
+ end);
}
if (!solver.isSatisfiable(encodingAssumptions)) {
return;
}
if (start == end) {
result.push(encodingAssumptions.get(start));
encodingAssumptions.set(start, -encodingAssumptions.get(start));
if (solver.isVerbose()) {
System.out.println(solver.getLogPrefix()
+ constrs.get(-encodingAssumptions.get(start))
+ " is mandatory ");
}
return;
}
int split = (end + start) / 2;
if (split < end) {
for (int j = start; j <= split; j++) {
encodingAssumptions.set(j, -encodingAssumptions.get(j));
}
computeExplanation(solver, constrs, encodingAssumptions, split + 1,
end, result);
}
if (start <= split) {
for (int j = start; j <= split; j++) {
encodingAssumptions.set(j, -encodingAssumptions.get(j));
}
computeExplanation(solver, constrs, encodingAssumptions, start,
split, result);
}
if (computationCanceled) {
throw new TimeoutException();
}
}
示例4: MaxWatchCard
import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
/**
* Constructeur de base cr?ant des contraintes vides
*
* @param size
* nombre de litt?raux de la contrainte
* @param learnt
* indique si la contrainte est apprise
*/
private MaxWatchCard(ILits voc, IVecInt ps, boolean moreThan, int degree) {
// On met en place les valeurs
this.voc = voc;
this.degree = degree;
this.moreThan = moreThan;
// On simplifie ps
int[] index = new int[voc.nVars() * 2 + 2];
for (int i = 0; i < index.length; i++)
index[i] = 0;
// On repertorie les litt?raux utiles
for (int i = 0; i < ps.size(); i++) {
if (index[ps.get(i) ^ 1] == 0) {
index[ps.get(i)]++;
} else {
index[ps.get(i) ^ 1]--;
}
}
// On supprime les litt?raux inutiles
int ind = 0;
while (ind < ps.size()) {
if (index[ps.get(ind)] > 0) {
index[ps.get(ind)]--;
ind++;
} else {
if ((ps.get(ind) & 1) != 0)
this.degree--;
ps.set(ind, ps.last());
ps.pop();
}
}
// On copie les litt?raux de la contrainte
lits = new int[ps.size()];
ps.moveTo(lits);
// On normalise la contrainte au sens de Barth
normalize();
// Mise en place de l'observation maximale
watchCumul = 0;
// On observe les litt?raux non falsifi?
for (int i = 0; i < lits.length; i++) {
// Rappel: les ?l?ments falsifi?s ne seront jamais d?pil?s
if (!voc.isFalsified(lits[i])) {
watchCumul++;
voc.watch(lits[i] ^ 1, this);
}
}
}