Comments (5)
Hi,
Can you share FloatGenotypeFactory code?
from watchmaker.
Sure. It's just class wrapping list of Doubles. AbstractGenotype contains nothing at all.
public class FloatGenotype extends AbstractGenotype {
private List<Double> genes;
public FloatGenotype(final List<Double> genes) {
super();
this.genes = genes;
}
public FloatGenotype(final FloatGenotype genotype) {
super();
this.genes = genotype.getGenes();
}
public List<Double> getGenes() {
return genes;
}
public void setGenes(final List<Double> genes) {
this.genes = genes;
}
@Override
public String toString() {
String result = "[";
for(Double f : getGenes()) {
result += f + " ";
}
return result + "] ";
}
}
from watchmaker.
Hi,
It's FloatGenotype I was interested in FloatGenotypeFactory
from watchmaker.
My mistake.
public class FloatGenotypeFactory extends AbstractGenotypeFactory<FloatGenotype> {
private static final Double UPPERBOUND = 1.0d;
private static final Double LOWERBOUND = 0.0d;
private static final Integer DIM = 3;
private Integer dim;
public FloatGenotypeFactory() {
super(LOWERBOUND, UPPERBOUND);
this.dim = DIM;
}
public FloatGenotypeFactory(final Double lowerbound, final Double upperbound, final Integer dim) {
super(lowerbound, upperbound);
this.dim = dim;
}
@Override
public FloatGenotype generateRandomCandidate(final Random rng) {
List<Double> genes = new ArrayList<>();
for(int i=0; i<dim; i++) {
genes.add(uniform(rng));
}
return new FloatGenotype(genes);
}
}
public abstract class AbstractGenotypeFactory<T extends AbstractGenotype> extends AbstractCandidateFactory<T> {
private Double lowerbound;
private Double upperbound;
public AbstractGenotypeFactory(final Double lowerbound, final Double upperbound) {
this.lowerbound = lowerbound;
this.upperbound = upperbound;
}
protected Double uniform(final Random rng) {
return rng.nextDouble() * (this.upperbound - this.lowerbound) + this.lowerbound ;
}
}
from watchmaker.
Hi,
I had similar problem but not same. In my case sometimes population size was less then elite count (even in configuration was not). I resolved it in my forked version, seems like it was top of iceberg, and framework for some reasons can keep population on fixed size. If you can provide me with your whole source code, I'll try to resolve the problem in my fork(as this repo is not changed for years)
from watchmaker.
Related Issues (20)
- Update google-collections to guava HOT 2
- Broken link HOT 1
- Watchmaker framework
- Another broken link
- Tutorial performance
- List<EvaluatedCandidate<T>> from IslandEvolution
- Moving time HOT 1
- PopulationFitnessView is package private, why? HOT 1
- Maven repository link broken HOT 1
- AbstractEvolutionEngine Design Coupling Issue HOT 1
- Fitness Normalization
- Batch evaluation HOT 1
- EvaluatedCandidate & PopulationData classes must not be final
- Performance: Skip duplicate candidates with IdentityHashMap and make AbstractEvolutionEngine thread safe HOT 2
- Dependency on random.org on Windows HOT 1
- Elitism passes unfit candidates HOT 7
- Mutation fails to reach genes 4-7
- Random generator seed for an Island engine
- Search not wkrking HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from watchmaker.