|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
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
indexWorst
public int indexWorst(java.util.Comparator comparator)
- Returns the index of the worst Solution using a
Comparator
.
If there are more than one occurrences, only the index of the first one is returned
- Parameters:
comparator
- Comparator
used to compare solutions.
- Returns:
- The index of the worst Solution attending to the comparator or
-1 if the SolutionSet is empty
worst
public Solution worst(java.util.Comparator comparator)
- Returns the worst Solution using a
Comparator
.
If there are more than one occurrences, only the first one is returned
- Parameters:
comparator
- Comparator
used to compare solutions.
- Returns:
- The worst Solution attending to the comparator or
null
if the SolutionSet is empty
size
public int size()
- Returns the number of solutions in the SolutionSet.
- Returns:
- The size of the SolutionSet.
printObjectivesToFile
public void printObjectivesToFile(java.lang.String path)
- Writes the objective function values of the
Solution
objects into the set in a file.
- Parameters:
path
- The output file name
printVariablesToFile
public void printVariablesToFile(java.lang.String path)
- Writes the decision encodings.variable values of the
Solution
solutions objects into the set in a file.
- Parameters:
path
- The output file name
printFeasibleFUN
public void printFeasibleFUN(java.lang.String path)
- Write the function values of feasible solutions into a file
- Parameters:
path
- File name
printFeasibleVAR
public void printFeasibleVAR(java.lang.String path)
- Write the encodings.variable values of feasible solutions into a file
- Parameters:
path
- File name
clear
public void clear()
- Empties the SolutionSet
remove
public void remove(int i)
- Deletes the
Solution
at position i in the set.
- Parameters:
i
- The position of the solution to remove.
iterator
public java.util.Iterator<Solution> iterator()
- Returns an
Iterator
to access to the solution set list.
- Returns:
- the
Iterator
.
union
public 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.
- Parameters:
solutionSet
- SolutionSet to join with the current solutionSet.
- Returns:
- The result of the union operation.
replace
public void replace(int position,
Solution solution)
- Replaces a solution by a new one
- Parameters:
position
- The position of the solution to replacesolution
- The new solution
writeObjectivesToMatrix
public double[][] writeObjectivesToMatrix()
- Copies the objectives of the solution set to a matrix
- Returns:
- A matrix containing the objectives
printObjectives
public void printObjectives()
setCapacity
public void setCapacity(int capacity)
getCapacity
public int getCapacity()
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD