Examples of conflictValues()


Examples of net.sf.cpsolver.ifs.model.Model.conflictValues()

            for (Enumeration f=variable.values().elements();f.hasMoreElements();) {
                Value value = (Value)f.nextElement();
                if (value.equals(assigned)) continue;
                double eval = iValueWeight*value.toDouble() - assignedVal;
                if (acceptConflicts) {
                    Set conflicts = model.conflictValues(value);
                    for (Iterator i=conflicts.iterator();i.hasNext();) {
                        Value conflict = (Value)i.next();
                        eval -= iValueWeight*conflict.toDouble();
                        eval += iConflictWeight * (1.0+(iStat==null?0.0:iStat.countRemovals(solution.getIteration(), conflict, value)));
                    }
View Full Code Here

Examples of net.sf.cpsolver.ifs.model.Model.conflictValues()

            return null;
        }
        Value bestVal = (Value)ToolBox.random(best);
       
        if (sLog.isDebugEnabled()) {
            Set conflicts = model.conflictValues(bestVal);
            double wconf = (iStat==null?0.0:iStat.countRemovals(solution.getIteration(), conflicts, bestVal));
            sLog.debug("  [tabu] "+bestVal+" ("+(bestVal.variable().getAssignment()==null?"":"was="+bestVal.variable().getAssignment()+", ")+"val="+bestEval+(conflicts.isEmpty()?"":", conf="+(wconf+conflicts.size())+"/"+conflicts)+")");
        }
       
        if (iTabu!=null)
View Full Code Here

Examples of net.sf.cpsolver.ifs.model.Model.conflictValues()

        //double assignedVal = (assigned==null?-iConflictWeight:iValueWeight*assigned.toDouble());
        double assignedVal = (assigned==null?iConflictWeight:iValueWeight*assigned.toDouble());
        for (Enumeration f=variable.values().elements();f.hasMoreElements();) {
            Value value = (Value)f.nextElement();
            if (value.equals(assigned)) continue;
            Set conflicts = model.conflictValues(value);
            double eval = iValueWeight*value.toDouble() - assignedVal;
            for (Iterator i=conflicts.iterator();i.hasNext();) {
                Value conflict = (Value)i.next();
                eval -= iValueWeight*conflict.toDouble();
                eval += iConflictWeight * (1.0+(iStat==null?0.0:iStat.countRemovals(solution.getIteration(), conflict, value)));
View Full Code Here

Examples of net.sf.cpsolver.ifs.model.Model.conflictValues()

       
        if (best==null) return null;
        Value bestVal = (Value)ToolBox.random(best);
       
        if (sLog.isDebugEnabled()) {
            Set conflicts = model.conflictValues(bestVal);
            double wconf = (iStat==null?0.0:iStat.countRemovals(solution.getIteration(), conflicts, bestVal));
            sLog.debug("  [tabu] "+bestVal+" ("+(bestVal.variable().getAssignment()==null?"":"was="+bestVal.variable().getAssignment()+", ")+"val="+bestEval+(conflicts.isEmpty()?"":", conf="+(wconf+conflicts.size())+"/"+conflicts)+")");
        }
       
        if (iTabu!=null) iTabu.add(tabuElement(bestVal));
View Full Code Here

Examples of net.sf.cpsolver.ifs.model.Model.conflictValues()

            if (iVariable.equals(anotherVariable)) return null;
            return ((Swapable)iVariable).findSwap(anotherVariable);
        } else {
            Value value = (Value)object;
            if (value.equals(iVariable.getAssignment())) return null;
            Set conflicts = model.conflictValues(value);
            double eval = iValueWeight * value.toDouble();
            if (iVariable.getAssignment()!=null)
                eval -= iValueWeight * iVariable.getAssignment().toDouble();
            else
                eval -= iConflictWeight;
View Full Code Here

Examples of net.sf.cpsolver.ifs.model.Model.conflictValues()

            double eval = iValueWeight * value.toDouble();
            if (iVariable.getAssignment()!=null)
                eval -= iValueWeight * iVariable.getAssignment().toDouble();
            else
                eval -= iConflictWeight;
            eval += iConflictWeight * model.conflictValues(value).size();
            return new ItcSimpleNeighbour(iVariable,value,eval);
        }
    }
   
    /** Randomized enumeration */
 
View Full Code Here

Examples of net.sf.cpsolver.ifs.model.Model.conflictValues()

        Model model = solution.getModel();
        boolean canConflict = model.nrAssignedVariables()!=0;
        Variable variable = (Variable)ToolBox.random(model.variables());
        Value value = (Value)ToolBox.random(variable.values());
        if (value.equals(variable.getAssignment())) return null;
        Set conflicts = model.conflictValues(value);
        double eval = iValueWeight * value.toDouble();
        if (variable.getAssignment()!=null)
            eval -= iValueWeight * variable.getAssignment().toDouble();
        else
            eval -= iConflictWeight;
View Full Code Here

Examples of net.sf.cpsolver.ifs.model.Model.conflictValues()

        double eval = iValueWeight * value.toDouble();
        if (variable.getAssignment()!=null)
            eval -= iValueWeight * variable.getAssignment().toDouble();
        else
            eval -= iConflictWeight;
        eval += iConflictWeight * model.conflictValues(value).size();
        return new ItcSimpleNeighbour(variable,value,eval);
    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.