本文整理汇总了Java中org.cpsolver.ifs.extension.ConflictStatistics类的典型用法代码示例。如果您正苦于以下问题:Java ConflictStatistics类的具体用法?Java ConflictStatistics怎么用?Java ConflictStatistics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConflictStatistics类属于org.cpsolver.ifs.extension包,在下文中一共展示了ConflictStatistics类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
@Override
public boolean init(Solver<Lecture, Placement> solver) {
super.init(solver);
for (Extension<Lecture, Placement> extension : solver.getExtensions()) {
if (ConflictStatistics.class.isInstance(extension))
iStat = (ConflictStatistics<Lecture, Placement>) extension;
}
solver.currentSolution().addSolutionListener(this);
return true;
}
示例2: solutionUpdated
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
@Override
public void solutionUpdated(Solution<Lecture, Placement> solution) {
if (!initialized) {
for (Extension<Lecture, Placement> extension : iSolver.getExtensions()) {
if (MacPropagation.class.isInstance(extension))
iProp = (MacPropagation<Lecture, Placement>) extension;
if (ConflictStatistics.class.isInstance(extension)) {
iStat = (ConflictStatistics<Lecture, Placement>) extension;
}
}
}
}
示例3: init
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
/**
* Initialization -- methods
* {@link org.cpsolver.ifs.heuristics.VariableSelection#init(Solver)} and
* {@link org.cpsolver.ifs.heuristics.ValueSelection#init(Solver)} are
* called.
*/
@Override
public void init(Solver<V, T> solver) {
getValueSelection().init(solver);
getVariableSelection().init(solver);
iSolver = solver;
for (Extension<V, T> ext: solver.getExtensions())
if (ext instanceof ConflictStatistics)
iStat = (ConflictStatistics<V, T>)ext;
}
示例4: init
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
/** Solver initialization */
@Override
public void init(Solver<V, T> solver) {
super.init(solver);
for (Extension<V, T> extension : solver.getExtensions()) {
if (ConflictStatistics.class.isInstance(extension))
iStat = (ConflictStatistics<V, T>) extension;
}
}
示例5: init
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
/** Initialization */
@Override
public void init(Solver<V, T> solver) {
for (Extension<V, T> extension : solver.getExtensions()) {
if (ConflictStatistics.class.isInstance(extension))
iStat = (ConflictStatistics<V, T>) extension;
if (MacPropagation.class.isInstance(extension))
iProp = (MacPropagation<V, T>) extension;
if (ViolatedInitials.class.isInstance(extension))
iViolatedInitials = (ViolatedInitials<V, T>) extension;
}
}
示例6: init
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
/** Initialization */
@Override
public void init(Solver<Exam, ExamPlacement> solver) {
super.init(solver);
for (Extension<Exam, ExamPlacement> extension : solver.getExtensions()) {
if (ConflictStatistics.class.isInstance(extension))
iStat = (ConflictStatistics<Exam, ExamPlacement>) extension;
}
}
示例7: init
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
/** Initialization */
@Override
public void init(Solver<Request, Enrollment> solver) {
for (Extension<Request, Enrollment> extension : solver.getExtensions()) {
if (ConflictStatistics.class.isInstance(extension))
iStat = (ConflictStatistics<Request, Enrollment>) extension;
if (MacPropagation.class.isInstance(extension))
iProp = (MacPropagation<Request, Enrollment>) extension;
if (ViolatedInitials.class.isInstance(extension))
iViolatedInitials = (ViolatedInitials<Request, Enrollment>) extension;
}
}
示例8: createConfig
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
@Override
public DataProperties createConfig(Long settingsId, Map<Long, String> options) {
DataProperties properties = new DataProperties();
// Load properties
for (SolverParameterDef def: (List<SolverParameterDef>)SolverPredefinedSettingDAO.getInstance().getSession().createQuery(
"from SolverParameterDef where group.type = :type").setInteger("type", SolverParameterGroup.SolverType.EXAM.ordinal()).list()) {
if (def.getDefault() != null) properties.put(def.getName(), def.getDefault());
if (options != null && options.containsKey(def.getUniqueId()))
properties.put(def.getName(), options.get(def.getUniqueId()));
}
SolverPredefinedSetting settings = SolverPredefinedSettingDAO.getInstance().get(settingsId);
for (SolverParameter param: settings.getParameters()) {
if (!param.getDefinition().isVisible() || param.getDefinition().getGroup().getSolverType() != SolverParameterGroup.SolverType.EXAM) continue;
properties.put(param.getDefinition().getName(),param.getValue());
if (options != null && options.containsKey(param.getDefinition().getUniqueId()))
properties.put(param.getDefinition().getName(), options.get(param.getDefinition().getUniqueId()));
}
properties.setProperty("General.SettingsId", settings.getUniqueId().toString());
// Generate extensions
String ext = properties.getProperty("Extensions.Classes", "");
if (properties.getPropertyBoolean("ExamGeneral.CBS", true)) {
if (!ext.isEmpty()) ext += ";";
ext += ConflictStatistics.class.getName();
properties.setProperty("ConflictStatistics.Print","true");
}
String mode = properties.getProperty("ExamBasic.Mode","Initial");
if ("MPP".equals(mode))
properties.setProperty("General.MPP","true");
properties.setProperty("Extensions.Classes", ext);
// Interactive mode?
if (properties.getPropertyBoolean("Basic.DisobeyHard",false))
properties.setProperty("General.InteractiveMode", "true");
// When finished?
if ("No Action".equals(properties.getProperty("ExamBasic.WhenFinished"))) {
properties.setProperty("General.Save","false");
properties.setProperty("General.CreateNewSolution","false");
properties.setProperty("General.Unload","false");
} else if ("Save".equals(properties.getProperty("ExamBasic.WhenFinished"))) {
properties.setProperty("General.Save","true");
properties.setProperty("General.CreateNewSolution","false");
properties.setProperty("General.Unload","false");
} else if ("Save and Unload".equals(properties.getProperty("ExamBasic.WhenFinished"))) {
properties.setProperty("General.Save","true");
properties.setProperty("General.CreateNewSolution","false");
properties.setProperty("General.Unload","true");
}
// XML save/load properties
properties.setProperty("Xml.ShowNames", "true");
properties.setProperty("Exam.GreatDeluge", ("Great Deluge".equals(properties.getProperty("Exam.Algorithm","Great Deluge"))?"true":"false"));
properties.setProperty("Search.GreatDeluge", ("Great Deluge".equals(properties.getProperty("Exam.Algorithm","Great Deluge"))?"true":"false"));
// Distances Matrics
if (properties.getProperty("Distances.Ellipsoid") == null || properties.getProperty("Distances.Ellipsoid").equals("DEFAULT"))
properties.setProperty("Distances.Ellipsoid", ApplicationProperties.getProperty(ApplicationProperty.DistanceEllipsoid));
if (properties.getProperty("Parallel.NrSolvers") == null) {
properties.setProperty("Parallel.NrSolvers", String.valueOf(Math.max(1, Runtime.getRuntime().availableProcessors() / 2)));
}
properties.setProperty("General.UseAmPm", CONSTANTS.useAmPm() ? "true" : "false");
properties.expand();
return properties;
}
示例9: createConfig
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
@Override
public DataProperties createConfig(Long settingsId, Map<Long, String> options) {
DataProperties properties = new DataProperties();
try {
InputStream is = getClass().getClassLoader().getResourceAsStream("org/cpsolver/instructor/default.properties");
if (is != null) properties.load(is);
} catch (IOException e) {
sLog.warn("Failed to load configuration defaults:" + e.getMessage());
}
// Load properties
for (SolverParameterDef def: (List<SolverParameterDef>)SolverPredefinedSettingDAO.getInstance().getSession().createQuery(
"from SolverParameterDef where group.type = :type").setInteger("type", SolverParameterGroup.SolverType.INSTRUCTOR.ordinal()).list()) {
if (def.getDefault() != null) properties.put(def.getName(), def.getDefault());
if (options != null && options.containsKey(def.getUniqueId()))
properties.put(def.getName(), options.get(def.getUniqueId()));
}
SolverPredefinedSetting settings = SolverPredefinedSettingDAO.getInstance().get(settingsId);
for (SolverParameter param: settings.getParameters()) {
if (!param.getDefinition().isVisible() || param.getDefinition().getGroup().getSolverType() != SolverParameterGroup.SolverType.INSTRUCTOR) continue;
properties.put(param.getDefinition().getName(),param.getValue());
if (options != null && options.containsKey(param.getDefinition().getUniqueId()))
properties.put(param.getDefinition().getName(), options.get(param.getDefinition().getUniqueId()));
}
properties.setProperty("General.SettingsId", settings.getUniqueId().toString());
// Generate extensions
String ext = properties.getProperty("Extensions.Classes", "");
if (properties.getPropertyBoolean("General.CBS", true)) {
if (!ext.isEmpty()) ext += ";";
ext += ConflictStatistics.class.getName();
properties.setProperty("ConflictStatistics.Print","true");
}
String mode = properties.getProperty("Basic.Mode","Initial");
if ("MPP".equals(mode))
properties.setProperty("General.MPP","true");
properties.setProperty("Extensions.Classes", ext);
// Interactive mode?
if (properties.getPropertyBoolean("Basic.DisobeyHard", false))
properties.setProperty("General.InteractiveMode", "true");
// When finished?
if ("No Action".equals(properties.getProperty("Basic.WhenFinished"))) {
properties.setProperty("General.Save","false");
properties.setProperty("General.CreateNewSolution","false");
properties.setProperty("General.Unload","false");
} else if ("Save".equals(properties.getProperty("Basic.WhenFinished"))) {
properties.setProperty("General.Save","true");
properties.setProperty("General.CreateNewSolution","false");
properties.setProperty("General.Unload","false");
} else if ("Save and Unload".equals(properties.getProperty("Basic.WhenFinished"))) {
properties.setProperty("General.Save","true");
properties.setProperty("General.CreateNewSolution","false");
properties.setProperty("General.Unload","true");
}
// XML save/load properties
properties.setProperty("Xml.ShowNames", "true");
properties.setProperty("Search.GreatDeluge", ("Great Deluge".equals(properties.getProperty("General.Algorithm","Great Deluge"))?"true":"false"));
// Distances Matrics
if (properties.getProperty("Distances.Ellipsoid") == null || properties.getProperty("Distances.Ellipsoid").equals("DEFAULT"))
properties.setProperty("Distances.Ellipsoid", ApplicationProperties.getProperty(ApplicationProperty.DistanceEllipsoid));
if (properties.getProperty("Parallel.NrSolvers") == null) {
properties.setProperty("Parallel.NrSolvers", "1"); // String.valueOf(Math.max(1, Runtime.getRuntime().availableProcessors() / 2))
}
properties.setProperty("General.UseAmPm", CONSTANTS.useAmPm() ? "true" : "false");
properties.expand();
return properties;
}
示例10: load
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
public void load(Solver<Lecture, Placement> solver, ConflictStatistics cbs) {
load(solver, cbs, null);
}
示例11: load
import org.cpsolver.ifs.extension.ConflictStatistics; //导入依赖的package包/类
public void load(ConflictStatistics cbs) {
load(cbs, null);
}