Vector CutOffPlaneSolver::_nextVector() { cout << _Sk << endl; SimplexSolver lp_solver(_Sk); Vector tmp, res(_T._taskDimension + 1); lp_solver.solve(tmp); for (int i = 0; i != res.size(); i ++) res[i] = tmp[i] - tmp[res.size() + i]; return res; }
//你要完成的功能总入口 void search_route(char *topo[5000], int edge_num, char *demand) { start_time = get_now_time(); read_topo(topo); read_demand(demand); if((node_size<=100) || node_size > 500) { int tmp_up = find_cnt_up + 2; bool flag = false; if(node_size<=500) { flag = true; } if(node_size <= 100) // 顶点小于100搜一次即可 { find_cnt_up = 4; tmp_up = find_cnt_up+1; } else if(must_node_cnt < 15) { tmp_up++; find_cnt_up++; } //if(node_size >= 200) // tmp_up += 5; cout << "flag:" << flag << endl; while(find_cnt_up < tmp_up) //&& good_cost < last_cost) { //last_cost = good_cost; bool tag[MAX_NODE_NUM] = {0}; int cnt = must_node_cnt; tag[sid] = true; int now_time = get_now_time(); int res,tb; if(node_size>=100 && node_size<150) res = dfs(sid,tag,cnt,tb); else res = dfs_large(sid,tag,cnt,tb,flag); if(res == END_OUT) break; cout << "find res : " << res << endl; find_cnt_up++; } } else { lp_solver(sid,eid,edge_cnt,edge_set,node_size,must_node,ans_sum,ans,node_next); update_ans(ans_sum,ans); } //cout << ans_sum << endl; cout << "route_len: " << good_sum << endl; cout << "good_cost: " << good_cost << endl; for (int i = 0; i < good_sum; i++) { if (0 == i) //cout << edge_set[ans[i]].edge_id; cout << good_ans[i]; else cout<< "|" << good_ans[i]; record_result(edge_set[good_ans[i]].edge_id); } cout << endl; end_time = get_now_time(); cout << "used time : " << (end_time - start_time) << endl; }