|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmetal.core.SolutionSet
public class SolutionSet
Class representing a SolutionSet (a set of solutions)
Field Summary | |
---|---|
protected java.util.List<Solution> |
solutionsList_
Stores a list of solution objects. |
Constructor Summary | |
---|---|
SolutionSet()
Constructor. |
|
SolutionSet(int maximumSize)
Creates a empty solutionSet with a maximum capacity. |
Method Summary | |
---|---|
boolean |
add(int index,
Solution solution)
|
boolean |
add(Solution solution)
Inserts a new solution into the SolutionSet. |
Solution |
best(java.util.Comparator comparator)
Returns the best Solution using a Comparator . |
void |
clear()
Empties the SolutionSet |
Solution |
get(int i)
Returns the ith solution in the set. |
int |
getCapacity()
|
int |
getMaxSize()
Returns the maximum capacity of the solution set |
int |
indexWorst(java.util.Comparator comparator)
Returns the index of the worst Solution using a Comparator . |
java.util.Iterator<Solution> |
iterator()
Returns an Iterator to access to the solution set list. |
void |
printFeasibleFUN(java.lang.String path)
Write the function values of feasible solutions into a file |
void |
printFeasibleVAR(java.lang.String path)
Write the encodings.variable values of feasible solutions into a file |
void |
printObjectives()
|
void |
printObjectivesToFile(java.lang.String path)
Writes the objective function values of the Solution
objects into the set in a file. |
void |
printVariablesToFile(java.lang.String path)
Writes the decision encodings.variable values of the Solution
solutions objects into the set in a file. |
void |
remove(int i)
Deletes the Solution at position i in the set. |
void |
replace(int position,
Solution solution)
Replaces a solution by a new one |
void |
setCapacity(int capacity)
|
int |
size()
Returns the number of solutions in the SolutionSet. |
void |
sort(java.util.Comparator comparator)
Sorts a SolutionSet using a Comparator . |
SolutionSet |
union(SolutionSet solutionSet)
Returns a new SolutionSet which is the result of the union
between the current solution set and the one passed as a parameter. |
Solution |
worst(java.util.Comparator comparator)
Returns the worst Solution using a Comparator . |
double[][] |
writeObjectivesToMatrix()
Copies the objectives of the solution set to a matrix |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.List<Solution> solutionsList_
solution
objects.
Constructor Detail |
---|
public SolutionSet()
public SolutionSet(int maximumSize)
maximumSize
- Maximum size.Method Detail |
---|
public boolean add(Solution solution)
solution
- The Solution
to store
Solution
has been inserted, false
otherwise.public boolean add(int index, Solution solution)
public Solution get(int i)
i
- Position of the solution to obtain.
Solution
at the position i.
java.lang.IndexOutOfBoundsException
- Exceptionpublic int getMaxSize()
public void sort(java.util.Comparator comparator)
Comparator
.
comparator
- Comparator
used to sort.public Solution best(java.util.Comparator comparator)
Comparator
.
If there are more than one occurrences, only the first one is returned
comparator
- Comparator
used to compare solutions.
null
if the SolutionSet is empty
public int indexWorst(java.util.Comparator comparator)
Comparator
.
If there are more than one occurrences, only the index of the first one is returned
comparator
- Comparator
used to compare solutions.
-1 if the SolutionSet is empty
public Solution worst(java.util.Comparator comparator)
Comparator
.
If there are more than one occurrences, only the first one is returned
comparator
- Comparator
used to compare solutions.
null
if the SolutionSet is empty
public int size()
public void printObjectivesToFile(java.lang.String path)
Solution
objects into the set in a file.
path
- The output file namepublic void printVariablesToFile(java.lang.String path)
Solution
solutions objects into the set in a file.
path
- The output file namepublic void printFeasibleFUN(java.lang.String path)
path
- File namepublic void printFeasibleVAR(java.lang.String path)
path
- File namepublic void clear()
public void remove(int i)
Solution
at position i in the set.
i
- The position of the solution to remove.public java.util.Iterator<Solution> iterator()
Iterator
to access to the solution set list.
Iterator
.public SolutionSet union(SolutionSet solutionSet)
SolutionSet
which is the result of the union
between the current solution set and the one passed as a parameter.
solutionSet
- SolutionSet to join with the current solutionSet.
public void replace(int position, Solution solution)
position
- The position of the solution to replacesolution
- The new solutionpublic double[][] writeObjectivesToMatrix()
public void printObjectives()
public void setCapacity(int capacity)
public int getCapacity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |