bool schedSolution::load(const char* filename) { graphError(); ifstream file(filename); if (file) { clear(); unsigned int size = _graph->size(); resize(size); for (unsigned int i = 0; i < size; i++) { file >> at(i); } file.close(); set (NAN); } else {
void schedSolution::init() { graphError(); clear(); unsigned int size = _graph->size(); for (unsigned int i = 0; i < size; i++) { push_back(i); } // Swap cities for (unsigned int i = 0; i < size; i++) { unsigned int j = eda::rnd.random(size); eda::swap(at(i), at(j)); // printf("swap at %d and %d\n",i,j); } // Set NAN vale for route length set (NAN); }
void mtspSolution::init() { graphError(); _size = _graph->size(); _route = new unsigned int[_size]; _come = new unsigned int[_size]; _wait = new unsigned int[_size]; _late = new unsigned int[_size]; _move = new unsigned int[_size]; for (unsigned int i = 0; i < _size; i++) { _route[i] = i; _come[i] = _wait[i] = _late[i] = _move[i] = 0; } // Swap cities for (unsigned int i = 0; i < _size; i++) { unsigned int j = eda::rnd.random(_size); eda::swap(_route[i], _route[j]); } // Set NAN vale for route length set(NAN); }
void mtspSolution::checkError() const { graphError(); initError(); }
const mtspProblem& mtspSolution::pro() const { graphError(); return *_graph; }
const schedProblem& schedSolution::pro() const { graphError(); return *_graph; }