Class PopulationVector
java.lang.Object
java.util.AbstractCollection<Integer>
java.util.AbstractList<Integer>
java.util.ArrayList<Integer>
solvers.dataStructures.EnhancedVector
solvers.dataStructures.PopulationVector
- All Implemented Interfaces:
Serializable, Cloneable, Comparable<EnhancedVector>, Iterable<Integer>, Collection<Integer>, List<Integer>, RandomAccess, SequencedCollection<Integer>
This class implements the PopulationVector object, which is used to
store a populations vector. It extends an EnhancedVector object.
- Author:
- Michail Makaronidis, 2010
- See Also:
-
Field Summary
Fields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty PopulationVector object.PopulationVector(int[] P) Creates an PopulationVector with content equal to the given matrix.PopulationVector(int k, int length) Creates a new PopulationVector of specific lenth, where all elements are equal to a specific value.PopulationVector(Integer[] P) Creates an PopulationVector with content equal to the given matrix. -
Method Summary
Modifier and TypeMethodDescriptionAdds two vectors.booleanChanges the population by subtracting the supplied Population Change Vectorcopy()This method returns a copy of the current PopulationVector object.Methods inherited from class EnhancedVector
compareTo, containsMinusOne, copyTo, countNonZeroElements, countZeroElements, equalsIgnoreHistory, fillFromMyVector, findFirstNonZeroElement, getAsBigRational, isOneVector, isZeroVector, max, min, minusOne, plusOne, print, restore, sumMethods inherited from class ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversed
-
Constructor Details
-
PopulationVector
public PopulationVector()Creates an empty PopulationVector object. -
PopulationVector
Creates an PopulationVector with content equal to the given matrix.- Parameters:
P- The matrix containing the vector elements
-
PopulationVector
public PopulationVector(int[] P) Creates an PopulationVector with content equal to the given matrix.- Parameters:
P- The matrix containing the vector elements
-
PopulationVector
public PopulationVector(int k, int length) Creates a new PopulationVector of specific lenth, where all elements are equal to a specific value.- Parameters:
k- The value of all elementslength- The length of the PopulationVector
-
-
Method Details
-
copy
This method returns a copy of the current PopulationVector object. Position and delta stacks are disregarded.- Overrides:
copyin classEnhancedVector- Returns:
- Copy of the initial PopulationVector object.
-
addVec
Description copied from class:EnhancedVectorAdds two vectors. The vectors must be of the same size.- Overrides:
addVecin classEnhancedVector- Parameters:
b- Vector to add- Returns:
- The result of the addition
-
subVec
- Overrides:
subVecin classEnhancedVector- Parameters:
b- Vector to add- Returns:
- The result of the subtraction
-
changePopulation
Changes the population by subtracting the supplied Population Change Vector- Parameters:
n- The PopulationChangeVector- Returns:
-
anyGreaterThan
-