Class ConstraintSatisfactionProblem

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Statement>, java.util.Collection<Statement>, java.util.Set<Statement>
    Direct Known Subclasses:
    OptimizationProblem

    public class ConstraintSatisfactionProblem
    extends java.util.HashSet<Statement>
    This class models a general constraint satisfaction problem.
    Author:
    Matthias Thimm
    See Also:
    Serialized Form
    • Method Summary

      Modifier and Type Method Description
      ConstraintSatisfactionProblem clone()  
      void collapseAssociativeOperations()
      This method collapses all associative operations appearing in the target function and the constraints, e.g.
      java.util.Set<Minimum> getMinimums()
      Returns all minimums appearing in this problem.
      java.util.Set<Variable> getVariables()
      Returns all variables of this problem.
      boolean isInteger()
      Checks whether this problem is integer, i.e.
      boolean isLinear()
      Checks whether every constraint of this problem is linear.
      boolean isMinimumFree()
      Checks whether this problem uses no minimum function.
      void resolveMaximums()
      Resolves all occurrences of maximums by substituting a maximum "max{a,b}" by "0.5 a + 0.5 b + abs(a-b)".
      void resolveMinimums()
      Resolves all occurrences of minimums by substituting a minimum "min{a,b}" by "0.5 a + 0.5 b - abs(a-b)".
      ConstraintSatisfactionProblem toNormalizedForm()
      Normalizes this problem, i.e.
      java.lang.String toString()  
      • Methods inherited from class java.util.HashSet

        add, clear, contains, isEmpty, iterator, remove, size, spliterator
      • Methods inherited from class java.util.AbstractSet

        equals, hashCode, removeAll
      • Methods inherited from class java.util.AbstractCollection

        addAll, containsAll, retainAll, toArray, toArray
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
    • Constructor Detail

      • ConstraintSatisfactionProblem

        public ConstraintSatisfactionProblem()
        Creates a new and empty csp.
      • ConstraintSatisfactionProblem

        public ConstraintSatisfactionProblem​(java.util.Collection<? extends Statement> statements)
        Creates a new csp with the given statements
        Parameters:
        statements - a collection of statements.
    • Method Detail

      • toNormalizedForm

        public ConstraintSatisfactionProblem toNormalizedForm()
        Normalizes this problem, i.e. every constraint is brought into an equivalent form "T> 0" or "T >= 0" or "T = 0" or "T != 0".
        Returns:
        a csp.
      • isLinear

        public boolean isLinear()
        Checks whether every constraint of this problem is linear.
        Returns:
        "true" if every constraint of this problem is linear.
      • isInteger

        public boolean isInteger()
        Checks whether this problem is integer, i.e. whether all variables are integer variables.
        Returns:
        "true" if this problem is integer.
      • isMinimumFree

        public boolean isMinimumFree()
        Checks whether this problem uses no minimum function.
        Returns:
        "true" if this problem uses no minimum function.
      • resolveMinimums

        public void resolveMinimums()
        Resolves all occurrences of minimums by substituting a minimum "min{a,b}" by "0.5 a + 0.5 b - abs(a-b)".
      • resolveMaximums

        public void resolveMaximums()
        Resolves all occurrences of maximums by substituting a maximum "max{a,b}" by "0.5 a + 0.5 b + abs(a-b)".
      • getVariables

        public java.util.Set<Variable> getVariables()
        Returns all variables of this problem.
        Returns:
        all variables of this problem.
      • getMinimums

        public java.util.Set<Minimum> getMinimums()
        Returns all minimums appearing in this problem.
        Returns:
        all minimums appearing in this problem.
      • collapseAssociativeOperations

        public void collapseAssociativeOperations()
        This method collapses all associative operations appearing in the target function and the constraints, e.g. every min{min{a,b},c} becomes min{a,b,c}
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractCollection<Statement>