static void setSolution(Data * d, Work * w, Sol * sol, Info * info) { idxint l = d->n + d->m + 1; setx(d, w, sol); sety(d, w, sol); sets(d, w, sol); if (info->statusVal == 0 || info->statusVal == SOLVED) { pfloat tau = w->u[l - 1]; pfloat kap = ABS(w->v[l - 1]); if (tau > INDETERMINATE_TOL && tau > kap) { info->statusVal = solved(d, sol, info, tau); } else { if (calcNorm(w->u, l) < INDETERMINATE_TOL * SQRTF((pfloat) l)) { info->statusVal = indeterminate(d, sol, info); } else { pfloat bTy = innerProd(d->b, sol->y, d->m); pfloat cTx = innerProd(d->c, sol->x, d->n); if (bTy < cTx) { info->statusVal = infeasible(d, sol, info); } else { info->statusVal = unbounded(d, sol, info); } } } } else if (info->statusVal == INFEASIBLE) { info->statusVal = infeasible(d, sol, info); } else { info->statusVal = unbounded(d, sol, info); } }
ull binary_search(ull hi) { ull lo = 0, mid; while (lo < hi) { mid = lo + (hi-lo)/2; if (infeasible(mid)) hi = mid; else lo = mid+1; } if (!infeasible(lo)) return -1; return lo; }
inline double changeDownInCost(int sequence) const { double returnValue = 0.0; if (CLP_METHOD1) { int iRange = whichRange_[sequence] + offset_[sequence]; if (iRange != start_[sequence] && !infeasible(iRange - 1)) returnValue = cost_[iRange] - cost_[iRange-1]; else returnValue = 1.0e100; } if (CLP_METHOD2) { returnValue = infeasibilityWeight_; } return returnValue; }
int main() { infeasible(7,13); return 0; }
stResult<TCity> * main_genetic(mySlimTree* SlimTree, TCity * queryObject, stDistance range) { time_t begin, end; begin = time(NULL); srand(time(NULL)); Population * pop = new_population(); Population * aux_pop = new_empty_population(); infeasible(SlimTree, pop); set_genotype(pop); evaluate_fitness(pop, SlimTree, queryObject, range); #if DEBUG print_population(pop ,"Pop", number_of_gerations); #endif while( (number_of_gerations < MAX_NUMBER_OF_GERATIONS) && (delta_fitness > 0.0001) ) { number_of_gerations++; #if DEBUG cout << "Number of Gerations: "<< number_of_gerations << endl; #endif selection_by_tournament(pop, aux_pop); #if DEBUG cout << "Torneio" << endl; #endif crossover_uniform(aux_pop); #if DEBUG cout << "Crossover Uniforme" << endl; #endif mutation(aux_pop); #if DEBUG cout << "Mutação" << endl; #endif set_phenotype(aux_pop); #if DEBUG cout << "Fenotipo" << endl; #endif infeasible(SlimTree, aux_pop); #if DEBUG cout << "Infactibilidade" << endl; #endif set_genotype(aux_pop); #if DEBUG cout << "Fenotipo" << endl; #endif copy_population(aux_pop, pop); #if DEBUG cout << "Copiar aux pop" << endl; #endif evaluate_fitness(pop, SlimTree, queryObject, range); #if DEBUG cout << "Fitness" << endl; #endif old_media_of_fitness = media_of_fitness; media_of_fitness = get_media_of_population(pop); delta_fitness = fabs(media_of_fitness - old_media_of_fitness); } end = time(NULL); #if DEBUG print_population(pop, "PopulatioN", number_of_gerations); print_statistic(pop, begin, end); #endif }