com.rubecula.darwin.examples.travelingsalesman
Class Phenotype_TS
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<String,Trait>
com.rubecula.darwin.core.TraitMap_Abstract
com.rubecula.darwin.core.Phenotype_Abstract
com.rubecula.darwin.examples.travelingsalesman.Phenotype_TS
- All Implemented Interfaces:
- Fit, Phenotype, TraitMap, Auditable, Identifiable, Serializable, Cloneable, Map<String,Trait>
public class Phenotype_TS
- extends Phenotype_Abstract
- Author:
- Robin
- See Also:
- Serialized Form
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, values |
Phenotype_TS
public Phenotype_TS()
evaluateFitness
public double evaluateFitness(Phenome phenome,
Environment environment)
- Description copied from class:
Phenotype_Abstract
- This implementation of evaluateFitness is relatively obvious:
for each trait in
this phenotype,
and for every factor in the environment, calculate the fitness and weight
and add these to total fitness and total weight.
Finally, assuming that there was at least one trait,
calculate the result as the ratio of total fitness to total weight.
- Specified by:
evaluateFitness in interface Fit- Overrides:
evaluateFitness in class Phenotype_Abstract
- Parameters:
phenome - the phenome from which we get the fitness function (used to get the fitness/weight for a trait/factor pair).environment - the environment from which we get the set of eco factors.
- Returns:
- the result calculated as above.
- See Also:
Phenome.getFitnessFunction(),
Fit.evaluateFitness(com.rubecula.darwin.core.Phenome, com.rubecula.darwin.core.Environment)
getClients
public Client[] getClients(Environment environment)
- Parameters:
environment -
- Returns:
- an array of Client objects which form the clients of this environment.
getClientsInOrder
public Client[] getClientsInOrder(Client[] clients)
- Parameters:
clients - array derived directly from the environment
- Returns:
- method to get the clients in their order of visitation.
getClientsInOrder
public Client[] getClientsInOrder(Environment environment)
- Parameters:
environment -
- Returns:
- method to get the clients in their order of visitation.
equals
public boolean equals(Object o)
- Specified by:
equals in interface Map<String,Trait>- Overrides:
equals in class AbstractMap<String,Trait>
hashCode
public int hashCode()
- Specified by:
hashCode in interface Map<String,Trait>- Overrides:
hashCode in class AbstractMap<String,Trait>