GeneticMotor and Activity
- By Peter Winzell
- February 5, 2001
POWER JAVA
Genetic Programming in Java—A Scheduling Example
Peter Winzell
Listing 2. GeneticMotor and Activity.
public class GeneticMotor implements Runnable{
static population ArrayList;
private int populationsize = 100;
Thread geneticThread = null;
...
GeneticMotor(int popsize){
Population = new ArrayList(popsize*2);
Populationsize = popsize;
...
}
Chromosome select(int startIndex,int endIndex){
...
}
}
...
public class Activity extends Object {
HashMap positionsList = new HashMap(25);
ArrayList resourceIdList = new ArrayList(10);
ArrayList intersectingActs = new ArrayList(30);
ArrayList currentPointList = new ArrayList(10);
...
public int getCurrentPoint(int position){
adjustInterSectingActivities(position,
getResourceId(position));
return ((PointObject)currentPointList.get(position)).point;
}
public int getResourceId(int position){...}
protected void adjustInterSectingActivities(int position,int resourceId){
...
}
protected void checkDoubleBook(int resId,Activity interSectee){
searchObject.resourceId = resId;
PriorityObject pObject = (PriorityObject)
InterSectee.positionsList.get(searchObject);
...
}
...