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


Java SolutionComparator类代码示例

本文整理汇总了Java中org.cpsolver.ifs.solution.SolutionComparator的典型用法代码示例。如果您正苦于以下问题:Java SolutionComparator类的具体用法?Java SolutionComparator怎么用?Java SolutionComparator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setSolutionComparator

import org.cpsolver.ifs.solution.SolutionComparator; //导入依赖的package包/类
/** Sets solution comparator
 * @param solutionComparator solution comparator
 **/
public void setSolutionComparator(SolutionComparator<V, T> solutionComparator) {
    iSolutionComparator = solutionComparator;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:7,代码来源:Solver.java

示例2: getSolutionComparator

import org.cpsolver.ifs.solution.SolutionComparator; //导入依赖的package包/类
/** Returns solution comparator
 * @return solution comparator
 **/
public SolutionComparator<V, T> getSolutionComparator() {
    return iSolutionComparator;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:7,代码来源:Solver.java

示例3: autoConfigure

import org.cpsolver.ifs.solution.SolutionComparator; //导入依赖的package包/类
/**
 * Automatic configuratin of the solver -- when Solver.AutoConfigure is true
 */
@SuppressWarnings("unchecked")
protected void autoConfigure() {
    try {
        boolean mpp = getProperties().getPropertyBoolean("General.MPP", false);

        String terminationConditionClassName = getProperties().getProperty(
                "Termination.Class",
                (mpp ? "org.cpsolver.ifs.termination.MPPTerminationCondition"
                        : "org.cpsolver.ifs.termination.GeneralTerminationCondition"));
        sLogger.info("Using " + terminationConditionClassName);
        Class<?> terminationConditionClass = Class.forName(terminationConditionClassName);
        Constructor<?> terminationConditionConstructor = terminationConditionClass
                .getConstructor(new Class[] { DataProperties.class });
        setTerminalCondition((TerminationCondition<V, T>) terminationConditionConstructor
                .newInstance(new Object[] { getProperties() }));

        String solutionComparatorClassName = getProperties().getProperty(
                "Comparator.Class",
                (mpp ? "org.cpsolver.ifs.solution.MPPSolutionComparator"
                        : "org.cpsolver.ifs.solution.GeneralSolutionComparator"));
        sLogger.info("Using " + solutionComparatorClassName);
        Class<?> solutionComparatorClass = Class.forName(solutionComparatorClassName);
        Constructor<?> solutionComparatorConstructor = solutionComparatorClass
                .getConstructor(new Class[] { DataProperties.class });
        setSolutionComparator((SolutionComparator<V, T>) solutionComparatorConstructor
                .newInstance(new Object[] { getProperties() }));

        String neighbourSelectionClassName = getProperties().getProperty("Neighbour.Class",
                "org.cpsolver.ifs.heuristics.StandardNeighbourSelection");
        sLogger.info("Using " + neighbourSelectionClassName);
        Class<?> neighbourSelectionClass = Class.forName(neighbourSelectionClassName);
        Constructor<?> neighbourSelectionConstructor = neighbourSelectionClass
                .getConstructor(new Class[] { DataProperties.class });
        setNeighbourSelection((NeighbourSelection<V, T>) neighbourSelectionConstructor
                .newInstance(new Object[] { getProperties() }));

        String perturbationCounterClassName = getProperties().getProperty("PerturbationCounter.Class",
                "org.cpsolver.ifs.perturbations.DefaultPerturbationsCounter");
        sLogger.info("Using " + perturbationCounterClassName);
        Class<?> perturbationCounterClass = Class.forName(perturbationCounterClassName);
        Constructor<?> perturbationCounterConstructor = perturbationCounterClass
                .getConstructor(new Class[] { DataProperties.class });
        setPerturbationsCounter((PerturbationsCounter<V, T>) perturbationCounterConstructor
                .newInstance(new Object[] { getProperties() }));

        for (Extension<V, T> extension : iExtensions) {
            extension.unregister(iCurrentSolution.getModel());
        }
        iExtensions.clear();
        String extensionClassNames = getProperties().getProperty("Extensions.Classes", null);
        if (extensionClassNames != null) {
            StringTokenizer extensionClassNameTokenizer = new StringTokenizer(extensionClassNames, ";");
            while (extensionClassNameTokenizer.hasMoreTokens()) {
                String extensionClassName = extensionClassNameTokenizer.nextToken().trim();
                if (extensionClassName.isEmpty()) continue;
                sLogger.info("Using " + extensionClassName);
                Class<?> extensionClass = Class.forName(extensionClassName);
                Constructor<?> extensionConstructor = extensionClass.getConstructor(new Class[] { Solver.class,
                        DataProperties.class });
                addExtension((Extension<V, T>) extensionConstructor.newInstance(new Object[] { this,
                        getProperties() }));
            }
        }
    } catch (Exception e) {
        sLogger.error("Unable to autoconfigure solver.", e);
    }
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:71,代码来源:Solver.java


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