Package net.sf.tweety.math.examples
Class TravelingSalesman
- 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.TravelingSalesman
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<ElementOfCombinatoricsProb>,Collection<ElementOfCombinatoricsProb>,Set<ElementOfCombinatoricsProb>
public class TravelingSalesman extends CombinatoricsProblem
implements the traveling salesman problem. Every element has an x- coordinate and a y- coordinate. Every city can be connected to each other and the distance is the cartesian distance bewteen them.- Author:
- Sebastian Franke
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class net.sf.tweety.math.opt.problem.CombinatoricsProblem
MAXIMIZE, MINIMIZE
-
-
Constructor Summary
Constructors Constructor Description TravelingSalesman(ArrayList<ElementOfCombinatoricsProb> elements)
-
Method Summary
Modifier and Type Method Description ArrayList<ElementOfCombinatoricsProb>createRandomNewSolution(ArrayList<ElementOfCombinatoricsProb> currSol)doubleevaluate(ArrayList<ElementOfCombinatoricsProb> sol)booleanisValid(ArrayList<ElementOfCombinatoricsProb> sol)doublesumOfWeights(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
-
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Constructor Detail
-
TravelingSalesman
public TravelingSalesman(ArrayList<ElementOfCombinatoricsProb> elements)
-
-
Method Detail
-
createRandomNewSolution
public ArrayList<ElementOfCombinatoricsProb> createRandomNewSolution(ArrayList<ElementOfCombinatoricsProb> currSol)
- Specified by:
createRandomNewSolutionin classCombinatoricsProblem
-
isValid
public boolean isValid(ArrayList<ElementOfCombinatoricsProb> sol)
- Specified by:
isValidin classCombinatoricsProblem
-
evaluate
public double evaluate(ArrayList<ElementOfCombinatoricsProb> sol)
- Specified by:
evaluatein classCombinatoricsProblem
-
sumOfWeights
public double sumOfWeights(ArrayList<ElementOfCombinatoricsProb> sol)
- Specified by:
sumOfWeightsin classCombinatoricsProblem- Parameters:
sol- is the solution to be viewd- Returns:
- if the solution sol is valid under the constraints of the problem
-
-