void addSolution(sol::Solution const & solution) { if (_pool.size() < _maxNumSolutions) { insertSolution(solution); } else if (solution.objValue().objValue() < _pool.back().objValue().objValue()) { bool inserted = insertSolution(solution); if (inserted) removeWorst(); } }
void handle_new_solution(int sock, msgpack::unpacker& unpack) { #ifdef DEBUG std::cout << "mdps.cpp: handling new solution from socket " << sock << ".\n"; #endif ProblemDescription desc; Solution sol; read(unpack, desc); read(unpack, sol); std::cout << "Answer dimentsions: " << sol.matrix.getLength() << " x " << sol.matrix.getWidth() << "\n"; // Send an ACK // FIXME Paul doesn't like this ACK code, or the ACK in general, but that's another story send_ack(sock, STORE_QUERY_RESPONSE_ID); insertSolution(desc, sol); }