Main Page   Class Hierarchy   Compound List   File List   Contact   Download   Symbolic Constraints   Examples  

compute_tour.c

00001 #include<scil/scil.h>
00002 #include<scil/constraints/tour.h>
00003 
00004 using namespace SCIL;
00005 
00006 void ComputeTour(graph& G, edge_array<double>& Cost, list<edge>& T) {
00007   cout<<"start\n";
00008 
00009   ILP_Problem IP(Optsense_Min);
00010 
00011   cout<<"init\n";
00012   edge e=nil;
00013   var_map<edge> VM;
00014   forall_edges(e,G) { 
00015     VM[e]=IP.add_variable(Cost[e], 0, 1, Vartype_Integer);
00016   }
00017   cout<<"vars added\n";
00018   IP.add_sym_constraint(new TOUR(G,VM));
00019   cout<<"hier\n";
00020   IP.optimize();
00021 
00022   forall_edges(e, G) {
00023     if(IP.get_solution(VM[e])==1) T.append(e);
00024   }
00025 }
00026 

Generated on Tue Nov 16 15:18:14 2004 for SCIL by doxygen1.2.16