Class ConstraintSatisfactionProblem
java.lang.Object
java.util.AbstractCollection<OptProbElement>
java.util.AbstractSet<OptProbElement>
java.util.HashSet<OptProbElement>
org.tweetyproject.math.opt.problem.GeneralConstraintSatisfactionProblem
org.tweetyproject.math.opt.problem.ConstraintSatisfactionProblem
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<OptProbElement>
,Collection<OptProbElement>
,Set<OptProbElement>
- Direct Known Subclasses:
OptimizationProblem
This class models a general constraint satisfaction problem.
- Author:
- Matthias Thimm
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new and empty csp.ConstraintSatisfactionProblem
(Collection<? extends Statement> statements) Creates a new csp with the given statements -
Method Summary
Modifier and TypeMethodDescriptionclone()
void
This method collapses all associative operations appearing in the target function and the constraints, e.g.Returns all minimums appearing in this problem.Returns all variables of this problem.boolean
Checks whether this problem is integer, i.e.boolean
isLinear()
Checks whether every constraint of this problem is linear.boolean
Checks whether this problem uses no minimum function.void
Resolves all occurrences of maximums by substituting a maximum "max{a,b}" by "0.5 a + 0.5 b + abs(a-b)".void
Resolves all occurrences of minimums by substituting a minimum "min{a,b}" by "0.5 a + 0.5 b - abs(a-b)".Normalizes this problem, i.e.toString()
Methods inherited from class java.util.HashSet
add, clear, contains, isEmpty, iterator, newHashSet, remove, size, spliterator, toArray, toArray
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
ConstraintSatisfactionProblem
public ConstraintSatisfactionProblem()Creates a new and empty csp. -
ConstraintSatisfactionProblem
Creates a new csp with the given statements- Parameters:
statements
- a collection of statements.
-
-
Method Details
-
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
-
getMinimums
-
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
- Overrides:
toString
in classAbstractCollection<OptProbElement>
-
clone
- Overrides:
clone
in classHashSet<OptProbElement>
-