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:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<ElementOfCombinatoricsProb>
,java.util.Collection<ElementOfCombinatoricsProb>
,java.util.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(java.util.ArrayList<ElementOfCombinatoricsProb> elements)
-
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
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
-
TravelingSalesman
public TravelingSalesman(java.util.ArrayList<ElementOfCombinatoricsProb> elements)
-
-
Method Detail
-
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
-
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
-
-