Package net.sf.tweety.math.examples
Class KnapSack
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.HashSet<ElementOfCombinatoricsProb>
-
- net.sf.tweety.math.opt.problem.CombinatoricsProblem
-
- net.sf.tweety.math.examples.KnapSack
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<ElementOfCombinatoricsProb>
,java.util.Collection<ElementOfCombinatoricsProb>
,java.util.Set<ElementOfCombinatoricsProb>
public class KnapSack extends CombinatoricsProblem
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class net.sf.tweety.math.opt.problem.CombinatoricsProblem
MAXIMIZE, MINIMIZE
-
-
Constructor Summary
Constructors Constructor Description KnapSack(java.util.ArrayList<ElementOfCombinatoricsProb> elements, Term maxWeight)
-
Method Summary
Modifier and Type Method Description java.util.ArrayList<ElementOfCombinatoricsProb>
createRandomNewSolution(java.util.ArrayList<ElementOfCombinatoricsProb> currSol)
double
evaluate(java.util.ArrayList<ElementOfCombinatoricsProb> sol)
boolean
isValid(java.util.ArrayList<ElementOfCombinatoricsProb> sol)
double
sumOfValues(java.util.ArrayList<ElementOfCombinatoricsProb> sol)
double
sumOfWeights(java.util.ArrayList<ElementOfCombinatoricsProb> sol)
-
Methods inherited from class net.sf.tweety.math.opt.problem.CombinatoricsProblem
createDifference, formNeighborhood
-
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size, spliterator
-
-
-
-
Constructor Detail
-
KnapSack
public KnapSack(java.util.ArrayList<ElementOfCombinatoricsProb> elements, Term maxWeight)
-
-
Method Detail
-
sumOfWeights
public double sumOfWeights(java.util.ArrayList<ElementOfCombinatoricsProb> sol)
- Specified by:
sumOfWeights
in classCombinatoricsProblem
- Parameters:
sol
- is the solution to be viewd- Returns:
- if the solution sol is valid under the constraints of the problem
-
sumOfValues
public double sumOfValues(java.util.ArrayList<ElementOfCombinatoricsProb> sol)
-
createRandomNewSolution
public java.util.ArrayList<ElementOfCombinatoricsProb> createRandomNewSolution(java.util.ArrayList<ElementOfCombinatoricsProb> currSol)
- Specified by:
createRandomNewSolution
in classCombinatoricsProblem
-
isValid
public boolean isValid(java.util.ArrayList<ElementOfCombinatoricsProb> sol)
- Specified by:
isValid
in classCombinatoricsProblem
-
evaluate
public double evaluate(java.util.ArrayList<ElementOfCombinatoricsProb> sol)
- Specified by:
evaluate
in classCombinatoricsProblem
-
-