lemon/network_simplex.h
changeset 2598 71f4bd3a9ae8
parent 2588 4d3bc1d04c1d
child 2619 30fb4d68b0e8
equal deleted inserted replaced
12:616daeef198f 13:3dea823e213e
   278 
   278 
   279       NetworkSimplex &_ns;
   279       NetworkSimplex &_ns;
   280       EdgeIt _next_edge, _min_edge;
   280       EdgeIt _next_edge, _min_edge;
   281       int _sample_size;
   281       int _sample_size;
   282 
   282 
       
   283       static const int SAMPLE_SIZE_FACTOR = 15;
   283       static const int MIN_SAMPLE_SIZE = 10;
   284       static const int MIN_SAMPLE_SIZE = 10;
   284       static const double SAMPLE_SIZE_FACTOR = 0.0015;
       
   285 
   285 
   286     public:
   286     public:
   287 
   287 
   288       /// Constructor.
   288       /// Constructor.
   289       LimitedSearchPivotRule(NetworkSimplex &ns) :
   289       LimitedSearchPivotRule(NetworkSimplex &ns) :
   290         _ns(ns), _next_edge(ns._graph), _min_edge(ns._graph)
   290         _ns(ns), _next_edge(ns._graph), _min_edge(ns._graph)
   291       {
   291       {
   292         _sample_size = int(SAMPLE_SIZE_FACTOR * countEdges(_ns._graph));
   292         _sample_size = countEdges(_ns._graph) *
       
   293                        SAMPLE_SIZE_FACTOR / 10000;
   293         if (_sample_size < MIN_SAMPLE_SIZE)
   294         if (_sample_size < MIN_SAMPLE_SIZE)
   294           _sample_size = MIN_SAMPLE_SIZE;
   295           _sample_size = MIN_SAMPLE_SIZE;
   295       }
   296       }
   296 
   297 
   297       /// Finds the next entering edge.
   298       /// Finds the next entering edge.
   340       int _minor_limit;
   341       int _minor_limit;
   341 
   342 
   342       int _minor_count;
   343       int _minor_count;
   343       EdgeIt _next_edge;
   344       EdgeIt _next_edge;
   344 
   345 
   345       static const double LIST_LENGTH_FACTOR = 0.002;
   346       static const int LIST_LENGTH_FACTOR = 20;
   346       static const double MINOR_LIMIT_FACTOR = 0.1;
   347       static const int MINOR_LIMIT_FACTOR = 10;
   347       static const int MIN_LIST_LENGTH = 10;
   348       static const int MIN_LIST_LENGTH = 10;
   348       static const int MIN_MINOR_LIMIT = 2;
   349       static const int MIN_MINOR_LIMIT = 2;
   349 
   350 
   350     public:
   351     public:
   351 
   352 
   353       CandidateListPivotRule(NetworkSimplex &ns) :
   354       CandidateListPivotRule(NetworkSimplex &ns) :
   354         _ns(ns), _next_edge(ns._graph)
   355         _ns(ns), _next_edge(ns._graph)
   355       {
   356       {
   356         int edge_num = countEdges(_ns._graph);
   357         int edge_num = countEdges(_ns._graph);
   357         _minor_count = 0;
   358         _minor_count = 0;
   358         _list_length = int(edge_num * LIST_LENGTH_FACTOR);
   359         _list_length = edge_num * LIST_LENGTH_FACTOR / 10000;
   359         if (_list_length < MIN_LIST_LENGTH)
   360         if (_list_length < MIN_LIST_LENGTH)
   360           _list_length = MIN_LIST_LENGTH;
   361           _list_length = MIN_LIST_LENGTH;
   361         _minor_limit = int(_list_length * MINOR_LIMIT_FACTOR);
   362         _minor_limit = _list_length * MINOR_LIMIT_FACTOR / 100;
   362         if (_minor_limit < MIN_MINOR_LIMIT)
   363         if (_minor_limit < MIN_MINOR_LIMIT)
   363           _minor_limit = MIN_MINOR_LIMIT;
   364           _minor_limit = MIN_MINOR_LIMIT;
   364       }
   365       }
   365 
   366 
   366       /// Finds the next entering edge.
   367       /// Finds the next entering edge.