The Goal of my function is to use a 1 point crossover function between two Vector to get a new hybrid "Son" Vector having some element from the first Vector and some from the second one .
public Vector crossover(int Sol1,int Sol2){
int size;
Vector sol1 = new Vector();
Vector sol2 = new Vector();
sol1 = (Vector) allpop.get(Sol1);
sol2 = (Vector) allpop.get(Sol2);
int crosspoint = (int) sol1.size()/2 ;
Vector son = new Vector();
son= (Vector) sol1.clone() ;
if (sol1.size() < sol2.size())
size = sol1.size();
else size = sol2.size();
for(int j=(crosspoint-1);j<size;j++)
son.set(j,sol2.get(j));
return son;
}
sometimes it works good and sometimes it gives me the "java.lang.ArrayIndexOutOfBoundsException " error .. Some Ideas ?
Fixed already :) and here i share the answer with you :)