|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jmetal.core.Solution
public class Solution
Class representing a solution for a problem.
Constructor Summary | |
---|---|
Solution()
Constructor. |
|
Solution(int numberOfObjectives)
Constructor |
|
Solution(Problem problem)
Constructor. |
|
Solution(Problem problem,
Variable[] variables)
Constructor |
|
Solution(Solution solution)
Copy constructor. |
Method Summary | |
---|---|
double |
getAggregativeValue()
Returns the aggregative value of the solution |
double |
getCrowdingDistance()
Gets the crowding distance of the solution into a SolutionSet . |
Variable[] |
getDecisionVariables()
Returns the decision variables of the solution. |
double |
getDistanceToSolutionSet()
Gets the distance from the solution to a SolutionSet . |
double |
getFitness()
Gets the fitness of the solution. |
int |
getLocation()
Gets the location of this solution in a SolutionSet . |
static Solution |
getNewSolution(Problem problem)
|
int |
getNumberOfBits()
Returns the number of bits of the chromosome in case of using a binary representation |
int |
getNumberOfObjectives()
Returns the number of objectives. |
int |
getNumberOfViolatedConstraint()
Gets the number of constraint violated by the solution. |
double |
getObjective(int i)
Returns the value of the i-th objective. |
double |
getOverallConstraintViolation()
Gets the overall constraint violated by the solution. |
Problem |
getProblem()
|
int |
getRank()
Gets the rank of the solution. |
SolutionType |
getType()
Gets the type of the encodings.variable |
boolean |
isMarked()
Indicates if the solution is marked. |
void |
marked()
Establishes the solution as marked. |
int |
numberOfVariables()
Returns the number of decision variables of the solution. |
void |
setCrowdingDistance(double distance)
Sets the crowding distance of a solution in a SolutionSet . |
void |
setDecisionVariables(Variable[] variables)
Sets the decision variables for the solution. |
void |
setDistanceToSolutionSet(double distance)
Sets the distance between this solution and a SolutionSet . |
void |
setFitness(double fitness)
Sets the fitness of a solution. |
void |
setKDistance(double distance)
Sets the distance between the solution and its k-nearest neighbor in a SolutionSet . |
void |
setLocation(int location)
Sets the location of the solution into a solutionSet. |
void |
setNumberOfViolatedConstraint(int value)
Sets the number of constraints violated by the solution. |
void |
setObjective(int i,
double value)
Sets the value of the i-th objective. |
void |
setOverallConstraintViolation(double value)
Sets the overall constraints violated by the solution. |
void |
setRank(int value)
Sets the rank of a solution. |
void |
setType(SolutionType type)
Sets the type of the encodings.variable. |
java.lang.String |
toString()
Returns a string representing the solution. |
void |
unMarked()
Established the solution as unmarked. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Solution()
public Solution(int numberOfObjectives)
numberOfObjectives
- Number of objectives of the solution
This constructor is used mainly to read objective values from a file to
variables of a SolutionSet to apply quality indicatorspublic Solution(Problem problem) throws java.lang.ClassNotFoundException
problem
- The problem to solve
java.lang.ClassNotFoundException
public Solution(Problem problem, Variable[] variables)
problem
- The problem to solvepublic Solution(Solution solution)
solution
- Solution to copy.Method Detail |
---|
public static Solution getNewSolution(Problem problem) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public void setDistanceToSolutionSet(double distance)
SolutionSet
.
The value is stored in distanceToSolutionSet_
.
distance
- The distance to a solutionSet.public double getDistanceToSolutionSet()
SolutionSet
.
REQUIRE : this method has to be invoked after calling
setDistanceToPopulation
.
public void setKDistance(double distance)
SolutionSet
. The value is stored in kDistance_
.
distance
- The distance to the k-nearest neighbor.public void setCrowdingDistance(double distance)
SolutionSet
.
The value is stored in crowdingDistance_
.
distance
- The crowding distance of the solution.public double getCrowdingDistance()
SolutionSet
.
Returns the value stored in crowdingDistance_
.
REQUIRE : this method has to be invoked after calling
setCrowdingDistance
.
public void setFitness(double fitness)
fitness_
.
fitness
- The fitness of the solution.public double getFitness()
fitness_
.
REQUIRE : This method has to be invoked after calling
setFitness()
.
public void setObjective(int i, double value)
i
- The number identifying the objective.value
- The value to be stored.public double getObjective(int i)
i
- The value of the objective.public int getNumberOfObjectives()
public int numberOfVariables()
public java.lang.String toString()
toString
in class java.lang.Object
public Variable[] getDecisionVariables()
DecisionVariables
object representing the decision
variables of the solution.public void setDecisionVariables(Variable[] variables)
variables
- The DecisionVariables
object
representing the decision variables of the solution.public Problem getProblem()
public boolean isMarked()
marked
has been called and, after
that, the method unmarked
hasn't been called. False in other
case.public void marked()
public void unMarked()
public void setRank(int value)
value
- The rank of the solution.public int getRank()
setRank()
.
public void setOverallConstraintViolation(double value)
value
- The overall constraints violated by the solution.public double getOverallConstraintViolation()
overallConstraintViolation
.
public void setNumberOfViolatedConstraint(int value)
value
- The number of constraints violated by the solution.public int getNumberOfViolatedConstraint()
setNumberOfViolatedConstraint
.
public void setLocation(int location)
location
- The location of the solution.public int getLocation()
SolutionSet
.
REQUIRE : This method has to be invoked after calling
setLocation
.
public void setType(SolutionType type)
type
- The type of the encodings.variable.public SolutionType getType()
public double getAggregativeValue()
public int getNumberOfBits()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |