Skip to content
Snippets Groups Projects
Commit fa523a16 authored by Lucas Hernan Bruzzone Rodriguez's avatar Lucas Hernan Bruzzone Rodriguez
Browse files

Update newGA.req.cc

parent cbcac453
No related branches found
No related tags found
No related merge requests found
......@@ -136,17 +136,16 @@ skeleton newGA
void Solution::initialize()
{
for (int i=0;i<_pbm.dimension();i++)
iSecret = rand() % 10 + 1;
_var[i]=rand() % EMPLEADOS + 1;//numero random entre 1 y CANT EMPLEADOS
_tareasSolucion[i]=rand() % _cantEmpleados + 1;//numero random entre 1 y CANT EMPLEADOS
}
double Solution::fitness ()
{
double fitness = 0.0;
for (int i=0;i<_var.size();i++) {
int tipo = _var[i];
fitness += tipo.getSueldo()*dias[i];
for (int i=0;i< _tareasSolucion.size();i++) {
int tipo = empleadoss[i];
fitness += tipo.sueldo()*tareasDiass[i];
}
return fitness;
}
......@@ -293,7 +292,7 @@ skeleton newGA
{
int i=0;
Rarray<int> aux(sol1.pbm().dimension());
aux=sol2.array_var();
aux=sol2._tareasSolucion();
int limit=rand_int((sol1.pbm().dimension()/2)+1,sol1.pbm().dimension()-1);
int limit2=rand_int(0,limit-1);
......@@ -358,7 +357,7 @@ skeleton newGA
{
if (rand01()<=probability[1])
{
sol.var(i) = rand() % EMPLEADOS + 1;
sol.var(i) = rand() % cantEmpleados + 1;
//if (sol.var(i)==1) sol.var(i)=0;
//else sol.var(i)=1;
}
......@@ -428,3 +427,4 @@ skeleton newGA
}
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment