当前位置: 首页>>代码示例>>Java>>正文


Java IVecInt.moveTo方法代码示例

本文整理汇总了Java中org.sat4j.specs.IVecInt.moveTo方法的典型用法代码示例。如果您正苦于以下问题:Java IVecInt.moveTo方法的具体用法?Java IVecInt.moveTo怎么用?Java IVecInt.moveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sat4j.specs.IVecInt的用法示例。


在下文中一共展示了IVecInt.moveTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: simpleSimplification

import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
private void simpleSimplification(IVecInt conflictToReduce) {
	int i, j;
	final boolean[] seen = mseen;
	for (i = j = 1; i < conflictToReduce.size(); i++) {
		IConstr r = voc.getReason(conflictToReduce.get(i));
		if (r == null) {
			conflictToReduce.moveTo(j++, i);
		} else {
			for (int k = 0; k < r.size(); k++)
				if (voc.isFalsified(r.get(k)) && !seen[r.get(k) >> 1]
						&& (voc.getLevel(r.get(k)) != 0)) {
					conflictToReduce.moveTo(j++, i);
					break;
				}
		}
	}
	conflictToReduce.shrink(i - j);
	stats.reducedliterals += (i - j);
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:20,代码来源:Solver.java

示例2: AtLeast

import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
/**
 * @param ps
 *            a vector of literals
 * @param degree
 *            the minimal number of satisfied literals
 */
protected AtLeast(ILits voc, IVecInt ps, int degree) {
	maxUnsatisfied = ps.size() - degree;
	this.voc = voc;
	counter = 0;
	lits = new int[ps.size()];
	ps.moveTo(lits);
	for (int q : lits) {
		voc.watch(q ^ 1, this);
	}
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:17,代码来源:AtLeast.java

示例3: expensiveSimplification

import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
private void expensiveSimplification(IVecInt conflictToReduce) {
	// Simplify conflict clause (a lot):
	//
	int i, j;
	// (maintain an abstraction of levels involved in conflict)
	analyzetoclear.clear();
	conflictToReduce.copyTo(analyzetoclear);
	for (i = 1, j = 1; i < conflictToReduce.size(); i++)
		if (voc.getReason(conflictToReduce.get(i)) == null
				|| !analyzeRemovable(conflictToReduce.get(i)))
			conflictToReduce.moveTo(j++, i);
	conflictToReduce.shrink(i - j);
	stats.reducedliterals += (i - j);
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:15,代码来源:Solver.java

示例4: expensiveSimplificationWLOnly

import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
private void expensiveSimplificationWLOnly(IVecInt conflictToReduce) {
	// Simplify conflict clause (a lot):
	//
	int i, j;
	// (maintain an abstraction of levels involved in conflict)
	analyzetoclear.clear();
	conflictToReduce.copyTo(analyzetoclear);
	for (i = 1, j = 1; i < conflictToReduce.size(); i++)
		if (voc.getReason(conflictToReduce.get(i)) == null
				|| !analyzeRemovableWLOnly(conflictToReduce.get(i)))
			conflictToReduce.moveTo(j++, i);
	conflictToReduce.shrink(i - j);
	stats.reducedliterals += (i - j);
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:15,代码来源:Solver.java

示例5: 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);
		}
	}
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:61,代码来源:MaxWatchCard.java

示例6: MinWatchCard

import org.sat4j.specs.IVecInt; //导入方法依赖的package包/类
/**
 * Constructs and normalizes a cardinality constraint. used by
 * minWatchCardNew in the non-normalized case.
 * 
 * @param voc
 *            vocabulary used by the constraint
 * @param ps
 *            literals involved in the constraint
 * @param moreThan
 *            should be ATLEAST or ATMOST;
 * @param degree
 *            degree of the constraint
 */
public MinWatchCard(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];
	// Fresh array should have all elements set to 0

	// On repertorie les litt?raux utiles
	for (int i = 0; i < ps.size(); i++) {
		int p = ps.get(i);
		if (index[p ^ 1] == 0) {
			index[p]++;
		} else {
			index[p ^ 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.delete(ind);
		}
	}

	// 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();

}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:55,代码来源:MinWatchCard.java


注:本文中的org.sat4j.specs.IVecInt.moveTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。