#include #include #include #include struct location{ double x; double y; }; struct edge{ location l1; location l2; }; char * STOP='\0'; ifstream info; int patient_no; location * home; int nurse_no; location *start; edge * path; int max_serve_no; int pUnvisited; int pVisitEdge=0; int last_edge=0; int current_nurse=0; double totalLength[100]; double Distance(location l1, location l2) { return sqrt((l1.x-l2.x)*(l1.x-l2.x)+(l1.y-l2.y)*(l1.y-l2.y)); } double H(location l, edge e) { return Distance(e.l1,l)+Distance(l,e.l2)-Distance(e.l1,e.l2); } int main(int argc, char * argv[]) { if(argc!=2) { cout<<"please imput information file:\n"; return 1; } //read location info.open(argv[1]); int i=0; int j=0; char line[100]; char temp[10]; //read patient number info.getline(line,100); while(line[i]==' ')i++; while(line[i]!='\0')temp[j++]=line[i++]; temp[j]='\0'; patient_no=strtol(temp,&STOP,10); pUnvisited=patient_no; home=new location[patient_no]; path=new edge[patient_no+1]; //read each patient for(int k=0;k