0
11
0
... | ... |
@@ -408,6 +408,6 @@ |
408 | 408 |
|
409 |
In general NetworkSimplex is the most efficient implementation, |
|
410 |
but in special cases other algorithms could be faster. |
|
409 |
In general, \ref NetworkSimplex and \ref CostScaling are the most efficient |
|
410 |
implementations, but the other two algorithms could be faster in special cases. |
|
411 | 411 |
For example, if the total supply and/or capacities are rather small, |
412 |
CapacityScaling is usually the fastest algorithm (without effective scaling). |
|
412 |
\ref CapacityScaling is usually the fastest algorithm (without effective scaling). |
|
413 | 413 |
*/ |
... | ... |
@@ -473,3 +473,3 @@ |
473 | 473 |
|
474 |
In practice, the \ref HowardMmc "Howard" algorithm |
|
474 |
In practice, the \ref HowardMmc "Howard" algorithm turned out to be by far the |
|
475 | 475 |
most efficient one, though the best known theoretical bound on its running |
... | ... |
@@ -541,3 +541,3 @@ |
541 | 541 |
/** |
542 |
@defgroup planar |
|
542 |
@defgroup planar Planar Embedding and Drawing |
|
543 | 543 |
@ingroup algs |
... | ... |
@@ -91,4 +91,4 @@ |
91 | 91 |
/// be integer. |
92 |
/// \warning This algorithm does not support negative costs for such |
|
93 |
/// arcs that have infinite upper bound. |
|
92 |
/// \warning This algorithm does not support negative costs for |
|
93 |
/// arcs having infinite upper bound. |
|
94 | 94 |
#ifdef DOXYGEN |
... | ... |
@@ -425,3 +425,3 @@ |
425 | 425 |
/// Using this function has the same effect as using \ref supplyMap() |
426 |
/// with |
|
426 |
/// with a map in which \c k is assigned to \c s, \c -k is |
|
427 | 427 |
/// assigned to \c t and all other nodes have zero supply value. |
... | ... |
@@ -99,2 +99,5 @@ |
99 | 99 |
/// |
100 |
/// In general, \ref NetworkSimplex and \ref CostScaling are the fastest |
|
101 |
/// implementations available in LEMON for this problem. |
|
102 |
/// |
|
100 | 103 |
/// Most of the parameters of the problem (except for the digraph) |
... | ... |
@@ -118,4 +121,4 @@ |
118 | 121 |
/// be integer. |
119 |
/// \warning This algorithm does not support negative costs for such |
|
120 |
/// arcs that have infinite upper bound. |
|
122 |
/// \warning This algorithm does not support negative costs for |
|
123 |
/// arcs having infinite upper bound. |
|
121 | 124 |
/// |
... | ... |
@@ -181,3 +184,3 @@ |
181 | 184 |
/// By default, the so called \ref PARTIAL_AUGMENT |
182 |
/// "Partial Augment-Relabel" method is used, which |
|
185 |
/// "Partial Augment-Relabel" method is used, which turned out to be |
|
183 | 186 |
/// the most efficient and the most robust on various test inputs. |
... | ... |
@@ -450,3 +453,3 @@ |
450 | 453 |
/// Using this function has the same effect as using \ref supplyMap() |
451 |
/// with |
|
454 |
/// with a map in which \c k is assigned to \c s, \c -k is |
|
452 | 455 |
/// assigned to \c t and all other nodes have zero supply value. |
... | ... |
@@ -70,4 +70,4 @@ |
70 | 70 |
/// be integer. |
71 |
/// \warning This algorithm does not support negative costs for such |
|
72 |
/// arcs that have infinite upper bound. |
|
71 |
/// \warning This algorithm does not support negative costs for |
|
72 |
/// arcs having infinite upper bound. |
|
73 | 73 |
/// |
... | ... |
@@ -119,4 +119,3 @@ |
119 | 119 |
/// methods. By default, \ref CANCEL_AND_TIGHTEN "Cancel and Tighten" |
120 |
/// is used, which proved to be the most efficient and the most robust |
|
121 |
/// on various test inputs. |
|
120 |
/// is used, which is by far the most efficient and the most robust. |
|
122 | 121 |
/// However, the other methods can be selected using the \ref run() |
... | ... |
@@ -352,3 +351,3 @@ |
352 | 351 |
/// Using this function has the same effect as using \ref supplyMap() |
353 |
/// with |
|
352 |
/// with a map in which \c k is assigned to \c s, \c -k is |
|
354 | 353 |
/// assigned to \c t and all other nodes have zero supply value. |
... | ... |
@@ -48,4 +48,8 @@ |
48 | 48 |
/// This class provides a simple but highly efficient and robust heuristic |
49 |
/// method that quickly finds a large clique, but not necessarily the |
|
49 |
/// method that quickly finds a quite large clique, but not necessarily the |
|
50 | 50 |
/// largest one. |
51 |
/// The algorithm performs a certain number of iterations to find several |
|
52 |
/// cliques and selects the largest one among them. Various limits can be |
|
53 |
/// specified to control the running time and the effectiveness of the |
|
54 |
/// search process. |
|
51 | 55 |
/// |
... | ... |
@@ -86,2 +90,18 @@ |
86 | 90 |
|
91 |
/// \brief Constants for the causes of search termination. |
|
92 |
/// |
|
93 |
/// Enum type containing constants for the different causes of search |
|
94 |
/// termination. The \ref run() function returns one of these values. |
|
95 |
enum TerminationCause { |
|
96 |
|
|
97 |
/// The iteration count limit is reached. |
|
98 |
ITERATION_LIMIT, |
|
99 |
|
|
100 |
/// The step count limit is reached. |
|
101 |
STEP_LIMIT, |
|
102 |
|
|
103 |
/// The clique size limit is reached. |
|
104 |
SIZE_LIMIT |
|
105 |
}; |
|
106 |
|
|
87 | 107 |
private: |
... | ... |
@@ -95,2 +115,3 @@ |
95 | 115 |
|
116 |
// The underlying graph |
|
96 | 117 |
const GR &_graph; |
... | ... |
@@ -102,2 +123,11 @@ |
102 | 123 |
|
124 |
// Search options |
|
125 |
bool _delta_based_restart; |
|
126 |
int _restart_delta_limit; |
|
127 |
|
|
128 |
// Search limits |
|
129 |
int _iteration_limit; |
|
130 |
int _step_limit; |
|
131 |
int _size_limit; |
|
132 |
|
|
103 | 133 |
// The current clique |
... | ... |
@@ -382,3 +412,5 @@ |
382 | 412 |
_graph(graph), _id(_graph), _rnd(rnd) |
383 |
{ |
|
413 |
{ |
|
414 |
initOptions(); |
|
415 |
} |
|
384 | 416 |
|
... | ... |
@@ -393,3 +425,5 @@ |
393 | 425 |
_graph(graph), _id(_graph), _rnd(seed) |
394 |
{ |
|
426 |
{ |
|
427 |
initOptions(); |
|
428 |
} |
|
395 | 429 |
|
... | ... |
@@ -404,17 +438,127 @@ |
404 | 438 |
_graph(graph), _id(_graph), _rnd(random) |
405 |
{ |
|
439 |
{ |
|
440 |
initOptions(); |
|
441 |
} |
|
406 | 442 |
|
407 | 443 |
/// \name Execution Control |
444 |
/// The \ref run() function can be used to execute the algorithm.\n |
|
445 |
/// The functions \ref iterationLimit(int), \ref stepLimit(int), and |
|
446 |
/// \ref sizeLimit(int) can be used to specify various limits for the |
|
447 |
/// search process. |
|
448 |
|
|
408 | 449 |
/// @{ |
409 | 450 |
|
451 |
/// \brief Sets the maximum number of iterations. |
|
452 |
/// |
|
453 |
/// This function sets the maximum number of iterations. |
|
454 |
/// Each iteration of the algorithm finds a maximal clique (but not |
|
455 |
/// necessarily the largest one) by performing several search steps |
|
456 |
/// (node selections). |
|
457 |
/// |
|
458 |
/// This limit controls the running time and the success of the |
|
459 |
/// algorithm. For larger values, the algorithm runs slower, but it more |
|
460 |
/// likely finds larger cliques. For smaller values, the algorithm is |
|
461 |
/// faster but probably gives worse results. |
|
462 |
/// |
|
463 |
/// The default value is \c 1000. |
|
464 |
/// \c -1 means that number of iterations is not limited. |
|
465 |
/// |
|
466 |
/// \warning You should specify a reasonable limit for the number of |
|
467 |
/// iterations and/or the number of search steps. |
|
468 |
/// |
|
469 |
/// \return <tt>(*this)</tt> |
|
470 |
/// |
|
471 |
/// \sa stepLimit(int) |
|
472 |
/// \sa sizeLimit(int) |
|
473 |
GrossoLocatelliPullanMc& iterationLimit(int limit) { |
|
474 |
_iteration_limit = limit; |
|
475 |
return *this; |
|
476 |
} |
|
477 |
|
|
478 |
/// \brief Sets the maximum number of search steps. |
|
479 |
/// |
|
480 |
/// This function sets the maximum number of elementary search steps. |
|
481 |
/// Each iteration of the algorithm finds a maximal clique (but not |
|
482 |
/// necessarily the largest one) by performing several search steps |
|
483 |
/// (node selections). |
|
484 |
/// |
|
485 |
/// This limit controls the running time and the success of the |
|
486 |
/// algorithm. For larger values, the algorithm runs slower, but it more |
|
487 |
/// likely finds larger cliques. For smaller values, the algorithm is |
|
488 |
/// faster but probably gives worse results. |
|
489 |
/// |
|
490 |
/// The default value is \c -1, which means that number of steps |
|
491 |
/// is not limited explicitly. However, the number of iterations is |
|
492 |
/// limited and each iteration performs a finite number of search steps. |
|
493 |
/// |
|
494 |
/// \warning You should specify a reasonable limit for the number of |
|
495 |
/// iterations and/or the number of search steps. |
|
496 |
/// |
|
497 |
/// \return <tt>(*this)</tt> |
|
498 |
/// |
|
499 |
/// \sa iterationLimit(int) |
|
500 |
/// \sa sizeLimit(int) |
|
501 |
GrossoLocatelliPullanMc& stepLimit(int limit) { |
|
502 |
_step_limit = limit; |
|
503 |
return *this; |
|
504 |
} |
|
505 |
|
|
506 |
/// \brief Sets the desired clique size. |
|
507 |
/// |
|
508 |
/// This function sets the desired clique size that serves as a search |
|
509 |
/// limit. If a clique of this size (or a larger one) is found, then the |
|
510 |
/// algorithm terminates. |
|
511 |
/// |
|
512 |
/// This function is especially useful if you know an exact upper bound |
|
513 |
/// for the size of the cliques in the graph or if any clique above |
|
514 |
/// a certain size limit is sufficient for your application. |
|
515 |
/// |
|
516 |
/// The default value is \c -1, which means that the size limit is set to |
|
517 |
/// the number of nodes in the graph. |
|
518 |
/// |
|
519 |
/// \return <tt>(*this)</tt> |
|
520 |
/// |
|
521 |
/// \sa iterationLimit(int) |
|
522 |
/// \sa stepLimit(int) |
|
523 |
GrossoLocatelliPullanMc& sizeLimit(int limit) { |
|
524 |
_size_limit = limit; |
|
525 |
return *this; |
|
526 |
} |
|
527 |
|
|
528 |
/// \brief The maximum number of iterations. |
|
529 |
/// |
|
530 |
/// This function gives back the maximum number of iterations. |
|
531 |
/// \c -1 means that no limit is specified. |
|
532 |
/// |
|
533 |
/// \sa iterationLimit(int) |
|
534 |
int iterationLimit() const { |
|
535 |
return _iteration_limit; |
|
536 |
} |
|
537 |
|
|
538 |
/// \brief The maximum number of search steps. |
|
539 |
/// |
|
540 |
/// This function gives back the maximum number of search steps. |
|
541 |
/// \c -1 means that no limit is specified. |
|
542 |
/// |
|
543 |
/// \sa stepLimit(int) |
|
544 |
int stepLimit() const { |
|
545 |
return _step_limit; |
|
546 |
} |
|
547 |
|
|
548 |
/// \brief The desired clique size. |
|
549 |
/// |
|
550 |
/// This function gives back the desired clique size that serves as a |
|
551 |
/// search limit. \c -1 means that this limit is set to the number of |
|
552 |
/// nodes in the graph. |
|
553 |
/// |
|
554 |
/// \sa sizeLimit(int) |
|
555 |
int sizeLimit() const { |
|
556 |
return _size_limit; |
|
557 |
} |
|
558 |
|
|
410 | 559 |
/// \brief Runs the algorithm. |
411 | 560 |
/// |
412 |
/// This function runs the algorithm. |
|
561 |
/// This function runs the algorithm. If one of the specified limits |
|
562 |
/// is reached, the search process terminates. |
|
413 | 563 |
/// |
414 |
/// \param step_num The maximum number of node selections (steps) |
|
415 |
/// during the search process. |
|
416 |
/// This parameter controls the running time and the success of the |
|
417 |
/// algorithm. For larger values, the algorithm runs slower but it more |
|
418 |
/// likely finds larger cliques. For smaller values, the algorithm is |
|
419 |
/// faster but probably gives worse results. |
|
420 | 564 |
/// \param rule The node selection rule. For more information, see |
... | ... |
@@ -422,5 +566,5 @@ |
422 | 566 |
/// |
423 |
/// \return The size of the found clique. |
|
424 |
int run(int step_num = 100000, |
|
425 |
|
|
567 |
/// \return The termination cause of the search. For more information, |
|
568 |
/// see \ref TerminationCause. |
|
569 |
TerminationCause run(SelectionRule rule = PENALTY_BASED) |
|
426 | 570 |
{ |
... | ... |
@@ -429,9 +573,8 @@ |
429 | 573 |
case RANDOM: |
430 |
return start<RandomSelectionRule>( |
|
574 |
return start<RandomSelectionRule>(); |
|
431 | 575 |
case DEGREE_BASED: |
432 |
return start<DegreeBasedSelectionRule>(step_num); |
|
433 |
case PENALTY_BASED: |
|
434 |
return start< |
|
576 |
return start<DegreeBasedSelectionRule>(); |
|
577 |
default: |
|
578 |
return start<PenaltyBasedSelectionRule>(); |
|
435 | 579 |
} |
436 |
return 0; // avoid warning |
|
437 | 580 |
} |
... | ... |
@@ -441,2 +584,5 @@ |
441 | 584 |
/// \name Query Functions |
585 |
/// The results of the algorithm can be obtained using these functions.\n |
|
586 |
/// The run() function must be called before using them. |
|
587 |
|
|
442 | 588 |
/// @{ |
... | ... |
@@ -533,2 +679,14 @@ |
533 | 679 |
|
680 |
// Initialize search options and limits |
|
681 |
void initOptions() { |
|
682 |
// Search options |
|
683 |
_delta_based_restart = true; |
|
684 |
_restart_delta_limit = 4; |
|
685 |
|
|
686 |
// Search limits |
|
687 |
_iteration_limit = 1000; |
|
688 |
_step_limit = -1; // this is disabled by default |
|
689 |
_size_limit = -1; // this is disabled by default |
|
690 |
} |
|
691 |
|
|
534 | 692 |
// Adds a node to the current clique |
... | ... |
@@ -588,8 +746,4 @@ |
588 | 746 |
template <typename SelectionRuleImpl> |
589 |
int start(int max_select) { |
|
590 |
// Options for the restart rule |
|
591 |
const bool delta_based_restart = true; |
|
592 |
const int restart_delta_limit = 4; |
|
593 |
|
|
594 |
if (_n == 0) return 0; |
|
747 |
TerminationCause start() { |
|
748 |
if (_n == 0) return SIZE_LIMIT; |
|
595 | 749 |
if (_n == 1) { |
... | ... |
@@ -597,17 +751,23 @@ |
597 | 751 |
_best_size = 1; |
598 |
return |
|
752 |
return SIZE_LIMIT; |
|
599 | 753 |
} |
600 | 754 |
|
601 |
// Iterated local search |
|
755 |
// Iterated local search algorithm |
|
756 |
const int max_size = _size_limit >= 0 ? _size_limit : _n; |
|
757 |
const int max_restart = _iteration_limit >= 0 ? |
|
758 |
_iteration_limit : std::numeric_limits<int>::max(); |
|
759 |
const int max_select = _step_limit >= 0 ? |
|
760 |
_step_limit : std::numeric_limits<int>::max(); |
|
761 |
|
|
602 | 762 |
SelectionRuleImpl sel_method(*this); |
603 |
int select = 0; |
|
763 |
int select = 0, restart = 0; |
|
604 | 764 |
IntVector restart_nodes; |
605 |
|
|
606 |
while (select < max_select) { |
|
765 |
while (select < max_select && restart < max_restart) { |
|
607 | 766 |
|
608 | 767 |
// Perturbation/restart |
609 |
|
|
768 |
restart++; |
|
769 |
if (_delta_based_restart) { |
|
610 | 770 |
restart_nodes.clear(); |
611 | 771 |
for (int i = 0; i != _n; i++) { |
612 |
if (_delta[i] >= |
|
772 |
if (_delta[i] >= _restart_delta_limit) |
|
613 | 773 |
restart_nodes.push_back(i); |
... | ... |
@@ -665,3 +825,3 @@ |
665 | 825 |
_best_size = _size; |
666 |
if (_best_size |
|
826 |
if (_best_size >= max_size) return SIZE_LIMIT; |
|
667 | 827 |
} |
... | ... |
@@ -670,3 +830,3 @@ |
670 | 830 |
|
671 |
return |
|
831 |
return (restart >= max_restart ? ITERATION_LIMIT : STEP_LIMIT); |
|
672 | 832 |
} |
... | ... |
@@ -49,6 +49,6 @@ |
49 | 49 |
/// |
50 |
/// In general, %NetworkSimplex is the fastest implementation available |
|
51 |
/// in LEMON for this problem. |
|
52 |
/// Moreover, it supports both directions of the supply/demand inequality |
|
53 |
/// constraints. For more information, see \ref SupplyType. |
|
50 |
/// In general, \ref NetworkSimplex and \ref CostScaling are the fastest |
|
51 |
/// implementations available in LEMON for this problem. |
|
52 |
/// Furthermore, this class supports both directions of the supply/demand |
|
53 |
/// inequality constraints. For more information, see \ref SupplyType. |
|
54 | 54 |
/// |
... | ... |
@@ -128,3 +128,3 @@ |
128 | 128 |
/// By default, \ref BLOCK_SEARCH "Block Search" is used, which |
129 |
/// |
|
129 |
/// turend out to be the most efficient and the most robust on various |
|
130 | 130 |
/// test inputs. |
... | ... |
@@ -737,2 +737,4 @@ |
737 | 737 |
/// \return <tt>(*this)</tt> |
738 |
/// |
|
739 |
/// \sa supplyType() |
|
738 | 740 |
template<typename SupplyMap> |
... | ... |
@@ -753,3 +755,3 @@ |
753 | 755 |
/// Using this function has the same effect as using \ref supplyMap() |
754 |
/// with |
|
756 |
/// with a map in which \c k is assigned to \c s, \c -k is |
|
755 | 757 |
/// assigned to \c t and all other nodes have zero supply value. |
... | ... |
@@ -45,3 +45,3 @@ |
45 | 45 |
/// In a sense, the path can be treated as a list of arcs. The |
46 |
/// |
|
46 |
/// LEMON path type stores just this list. As a consequence, it |
|
47 | 47 |
/// cannot enumerate the nodes of the path and the source node of |
... | ... |
@@ -137,3 +137,3 @@ |
137 | 137 |
|
138 |
/// \brief The |
|
138 |
/// \brief The n-th arc. |
|
139 | 139 |
/// |
... | ... |
@@ -145,3 +145,3 @@ |
145 | 145 |
|
146 |
/// \brief Initialize arc iterator to point to the |
|
146 |
/// \brief Initialize arc iterator to point to the n-th arc |
|
147 | 147 |
/// |
... | ... |
@@ -233,3 +233,3 @@ |
233 | 233 |
/// In a sense, the path can be treated as a list of arcs. The |
234 |
/// |
|
234 |
/// LEMON path type stores just this list. As a consequence it |
|
235 | 235 |
/// cannot enumerate the nodes in the path and the zero length paths |
... | ... |
@@ -329,3 +329,3 @@ |
329 | 329 |
|
330 |
/// \brief The |
|
330 |
/// \brief The n-th arc. |
|
331 | 331 |
/// |
... | ... |
@@ -336,3 +336,3 @@ |
336 | 336 |
|
337 |
/// \brief Initializes arc iterator to point to the |
|
337 |
/// \brief Initializes arc iterator to point to the n-th arc. |
|
338 | 338 |
ArcIt nthIt(int n) const { |
... | ... |
@@ -397,3 +397,3 @@ |
397 | 397 |
/// In a sense, the path can be treated as a list of arcs. The |
398 |
/// |
|
398 |
/// LEMON path type stores just this list. As a consequence it |
|
399 | 399 |
/// cannot enumerate the nodes in the path and the zero length paths |
... | ... |
@@ -506,5 +506,5 @@ |
506 | 506 |
|
507 |
/// \brief The |
|
507 |
/// \brief The n-th arc. |
|
508 | 508 |
/// |
509 |
/// This function looks for the |
|
509 |
/// This function looks for the n-th arc in O(n) time. |
|
510 | 510 |
/// \pre \c n is in the <tt>[0..length() - 1]</tt> range. |
... | ... |
@@ -518,3 +518,3 @@ |
518 | 518 |
|
519 |
/// \brief Initializes arc iterator to point to the |
|
519 |
/// \brief Initializes arc iterator to point to the n-th arc. |
|
520 | 520 |
ArcIt nthIt(int n) const { |
... | ... |
@@ -737,3 +737,3 @@ |
737 | 737 |
/// In a sense, the path can be treated as a list of arcs. The |
738 |
/// |
|
738 |
/// LEMON path type stores just this list. As a consequence it |
|
739 | 739 |
/// cannot enumerate the nodes in the path and the source node of |
... | ... |
@@ -833,3 +833,3 @@ |
833 | 833 |
|
834 |
/// \brief The |
|
834 |
/// \brief The n-th arc. |
|
835 | 835 |
/// |
... | ... |
@@ -840,3 +840,3 @@ |
840 | 840 |
|
841 |
/// \brief The arc iterator pointing to the |
|
841 |
/// \brief The arc iterator pointing to the n-th arc. |
|
842 | 842 |
ArcIt nthIt(int n) const { |
... | ... |
@@ -1044,3 +1044,3 @@ |
1044 | 1044 |
/// In a sense, the path can be treated as a list of arcs. The |
1045 |
/// |
|
1045 |
/// LEMON path type stores only this list. As a consequence, it |
|
1046 | 1046 |
/// cannot enumerate the nodes in the path and the zero length paths |
... | ... |
@@ -60,3 +60,3 @@ |
60 | 60 |
template <typename Param> |
61 |
void checkMaxCliqueGeneral( |
|
61 |
void checkMaxCliqueGeneral(Param rule) { |
|
62 | 62 |
typedef ListGraph GR; |
... | ... |
@@ -70,3 +70,4 @@ |
70 | 70 |
McAlg mc(g); |
71 |
|
|
71 |
mc.iterationLimit(50); |
|
72 |
check(mc.run(rule) == McAlg::SIZE_LIMIT, "Wrong termination cause"); |
|
72 | 73 |
check(mc.cliqueSize() == 0, "Wrong clique size"); |
... | ... |
@@ -75,3 +76,3 @@ |
75 | 76 |
GR::Node u = g.addNode(); |
76 |
check(mc.run( |
|
77 |
check(mc.run(rule) == McAlg::SIZE_LIMIT, "Wrong termination cause"); |
|
77 | 78 |
check(mc.cliqueSize() == 1, "Wrong clique size"); |
... | ... |
@@ -84,3 +85,3 @@ |
84 | 85 |
GR::Node v = g.addNode(); |
85 |
check(mc.run( |
|
86 |
check(mc.run(rule) == McAlg::ITERATION_LIMIT, "Wrong termination cause"); |
|
86 | 87 |
check(mc.cliqueSize() == 1, "Wrong clique size"); |
... | ... |
@@ -92,3 +93,3 @@ |
92 | 93 |
g.addEdge(u, v); |
93 |
check(mc.run( |
|
94 |
check(mc.run(rule) == McAlg::SIZE_LIMIT, "Wrong termination cause"); |
|
94 | 95 |
check(mc.cliqueSize() == 2, "Wrong clique size"); |
... | ... |
@@ -112,3 +113,4 @@ |
112 | 113 |
McAlg mc(g); |
113 |
|
|
114 |
mc.iterationLimit(50); |
|
115 |
check(mc.run(rule) == McAlg::ITERATION_LIMIT, "Wrong termination cause"); |
|
114 | 116 |
check(mc.cliqueSize() == 4, "Wrong clique size"); |
... | ... |
@@ -129,3 +131,3 @@ |
129 | 131 |
template <typename Param> |
130 |
void checkMaxCliqueFullGraph( |
|
132 |
void checkMaxCliqueFullGraph(Param rule) { |
|
131 | 133 |
typedef FullGraph GR; |
... | ... |
@@ -138,3 +140,3 @@ |
138 | 140 |
McAlg mc(g); |
139 |
check(mc.run( |
|
141 |
check(mc.run(rule) == McAlg::SIZE_LIMIT, "Wrong termination cause"); |
|
140 | 142 |
check(mc.cliqueSize() == size, "Wrong clique size"); |
... | ... |
@@ -152,3 +154,3 @@ |
152 | 154 |
template <typename Param> |
153 |
void checkMaxCliqueGridGraph( |
|
155 |
void checkMaxCliqueGridGraph(Param rule) { |
|
154 | 156 |
GridGraph g(5, 7); |
... | ... |
@@ -156,3 +158,13 @@ |
156 | 158 |
GrossoLocatelliPullanMc<GridGraph> mc(g); |
157 |
|
|
159 |
|
|
160 |
mc.iterationLimit(100); |
|
161 |
check(mc.run(rule) == mc.ITERATION_LIMIT, "Wrong termination cause"); |
|
162 |
check(mc.cliqueSize() == 2, "Wrong clique size"); |
|
163 |
|
|
164 |
mc.stepLimit(100); |
|
165 |
check(mc.run(rule) == mc.STEP_LIMIT, "Wrong termination cause"); |
|
166 |
check(mc.cliqueSize() == 2, "Wrong clique size"); |
|
167 |
|
|
168 |
mc.sizeLimit(2); |
|
169 |
check(mc.run(rule) == mc.SIZE_LIMIT, "Wrong termination cause"); |
|
158 | 170 |
check(mc.cliqueSize() == 2, "Wrong clique size"); |
... | ... |
@@ -162,13 +174,13 @@ |
162 | 174 |
int main() { |
163 |
checkMaxCliqueGeneral(50, GrossoLocatelliPullanMc<ListGraph>::RANDOM); |
|
164 |
checkMaxCliqueGeneral(50, GrossoLocatelliPullanMc<ListGraph>::DEGREE_BASED); |
|
165 |
checkMaxCliqueGeneral( |
|
175 |
checkMaxCliqueGeneral(GrossoLocatelliPullanMc<ListGraph>::RANDOM); |
|
176 |
checkMaxCliqueGeneral(GrossoLocatelliPullanMc<ListGraph>::DEGREE_BASED); |
|
177 |
checkMaxCliqueGeneral(GrossoLocatelliPullanMc<ListGraph>::PENALTY_BASED); |
|
166 | 178 |
|
167 |
checkMaxCliqueFullGraph(50, GrossoLocatelliPullanMc<FullGraph>::RANDOM); |
|
168 |
checkMaxCliqueFullGraph(50, GrossoLocatelliPullanMc<FullGraph>::DEGREE_BASED); |
|
169 |
checkMaxCliqueFullGraph( |
|
179 |
checkMaxCliqueFullGraph(GrossoLocatelliPullanMc<FullGraph>::RANDOM); |
|
180 |
checkMaxCliqueFullGraph(GrossoLocatelliPullanMc<FullGraph>::DEGREE_BASED); |
|
181 |
checkMaxCliqueFullGraph(GrossoLocatelliPullanMc<FullGraph>::PENALTY_BASED); |
|
170 | 182 |
|
171 |
checkMaxCliqueGridGraph(50, GrossoLocatelliPullanMc<GridGraph>::RANDOM); |
|
172 |
checkMaxCliqueGridGraph(50, GrossoLocatelliPullanMc<GridGraph>::DEGREE_BASED); |
|
173 |
checkMaxCliqueGridGraph( |
|
183 |
checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::RANDOM); |
|
184 |
checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::DEGREE_BASED); |
|
185 |
checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::PENALTY_BASED); |
|
174 | 186 |
|
0 comments (0 inline)