|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Tests for howard_minimum_mean_cycle() (Howard_Min_Mean_Cycle.H), against Karp's algorithm and an exhaustive oracle. More...
#include <Howard_Min_Mean_Cycle.H>#include <gtest/gtest.h>#include <cmath>#include <functional>#include <limits>#include <random>#include <set>#include <thread>#include <tuple>#include <vector>#include <Min_Mean_Cycle.H>#include <tpl_agraph.H>#include <tpl_graph.H>#include "negative_cycles_test_support.H"Go to the source code of this file.
Functions | |
| TEST (HowardMinMeanCycleTest, EmptyDigraphReturnsNoCycle) | |
| TEST (HowardMinMeanCycleTest, DagReturnsNoCycle) | |
| TEST (HowardMinMeanCycleTest, SelfLoopCanBeOptimalCycle) | |
| TEST (HowardMinMeanCycleTest, ChoosesMinimumAmongMultipleCycles) | |
| TEST (HowardMinMeanCycleTest, SupportsNegativeMeanCycles) | |
| TEST (HowardMinMeanCycleTest, ArcFilterChangesResult) | |
| TEST (HowardMinMeanCycleTest, FloatingWeightsAndValueOnlyApiWork) | |
| TEST (HowardMinMeanCycleTest, NonFiniteFloatingWeightsThrowDomainError) | |
| TEST (HowardMinMeanCycleTest, IntegerOverflowThrowsLikeKarp) | |
| TEST (HowardMinMeanCycleTest, SupportsArrayDigraphBackend) | |
| TEST (HowardMinMeanCycleTest, UndirectedGraphThrowsDomainError) | |
| TEST (HowardMinMeanCycleTest, ResultCanReplaceKarpsResult) | |
| TEST (HowardMinMeanCycleTest, WitnessIsASimpleCycleWhereKarpsIsAClosedWalk) | |
| TEST (HowardMinMeanCycleTest, MaxCostIsAnOrdinaryCost) | |
| TEST (HowardMinMeanCycleTest, AnswersWhereKarpsSumsLeaveTheCostType) | |
| TEST (HowardMinMeanCycleTest, DistanceIsCalledOncePerArc) | |
| TEST (HowardMinMeanCycleTest, NonNullCookiesAndBitsAreLeftUntouched) | |
| TEST (HowardMinMeanCycleTest, RandomSmallGraphsMatchTheExactOracleAndKarp) | |
| TEST (HowardMinMeanCycleTest, RandomLargerGraphsMatchKarpExactly) | |
| TEST (HowardMinMeanCycleTest, RandomFloatingGraphsMatchKarpWithinTolerance) | |
| TEST (HowardMinMeanCycleTest, SmallRangeFloatingWeightsDoNotStopTheIterationEarly) | |
| TEST (HowardMinMeanCycleTest, DecimalWeightsWithRoundingNoiseDoNotMakeThePolicyOscillate) | |
| TEST (HowardMinMeanCycleTest, EachComponentKeepsItsOwnMeanAndTheSmallestWins) | |
| TEST (HowardMinMeanCycleTest, ReferenceNodeOfACycleDoesNotMakeThePolicyOscillate) | |
| TEST (HowardMinMeanCycleTest, MeanOfAFloatingCycleDoesNotDependOnWhereTheWalkEntersIt) | |
| TEST (HowardMinMeanCycleTest, IterationLimitFallsBackToKarp) | |
| TEST (HowardMinMeanCycleTest, ScaledBiasOverflowFallsBackToKarp) | |
| TEST (HowardMinMeanCycleTest, FallbackDoesNotReadTheGraphAgain) | |
| TEST (HowardMinMeanCycleTest, ValueOnlyMatchesTheFullFunctionBitForBit) | |
| TEST (HowardMinMeanCycleTest, ValueOnlyReadsTheAccessorOncePerArcAlsoAfterTheFallback) | |
| TEST (HowardMinMeanCycleTest, ValueOnlyAnswersWhereTheCostOfTheCycleDoesNotFit) | |
| TEST (HowardMinMeanCycleTest, FallbackReasonSaysWhyKarpAnswered) | |
| TEST (HowardMinMeanCycleTest, CycleCostIsAddedInTheOrderTheEvaluationProvedSafe) | |
| TEST (HowardMinMeanCycleTest, FallbackWithinTheMemoryLimitAnswersAsWithout) | |
| TEST (HowardMinMeanCycleTest, FallbackBeyondTheMemoryLimitThrowsLengthError) | |
| TEST (HowardMinMeanCycleTest, TheLimitIsCheckedAgainstTheLargestComponentWhereverItIs) | |
| TEST (HowardMinMeanCycleTest, FallbackRunsKarpOnEachComponent) | |
| TEST (HowardMinMeanCycleTest, EveryFallbackPassesTheChecksOfHowardsOwnAnswer) | |
| TEST (HowardMinMeanCycleTest, FallbackSumsInsideAComponentDoNotOverflow) | |
| TEST (HowardMinMeanCycleTest, CancellationDoesNotChooseAWorseCycle) | |
| TEST (HowardMinMeanCycleTest, OverflowOfTheExactVerificationFallsBackToTheExactChoice) | |
| TEST (HowardMinMeanCycleTest, ImprovementsBelowTheToleranceAreFoundExactly) | |
| TEST (HowardMinMeanCycleTest, ACycleOfExactTotalZeroIsNeverNegative) | |
| TEST (HowardMinMeanCycleTest, CostsOfAboutTenToTheEighteenAgreeWithKarp) | |
| TEST (HowardMinMeanCycleTest, FractionsAreComparedWithoutOverflow) | |
| TEST (HowardMinMeanCycleTest, MeansAreReducedAndStepsReportOverflow) | |
| TEST (HowardMinMeanCycleTest, ConcurrentSearchesOnTheSameGraphAgree) | |
Tests for howard_minimum_mean_cycle() (Howard_Min_Mean_Cycle.H), against Karp's algorithm and an exhaustive oracle.
Definition in file howard_min_mean_cycle_test.cc.
| TEST | ( | HowardMinMeanCycleTest | , |
| ACycleOfExactTotalZeroIsNeverNegative | |||
| ) |
Definition at line 1413 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| AnswersWhereKarpsSumsLeaveTheCostType | |||
| ) |
Definition at line 398 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| ArcFilterChangesResult | |||
| ) |
Definition at line 236 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::filter(), and Aleph::howard_minimum_mean_cycle().
| TEST | ( | HowardMinMeanCycleTest | , |
| CancellationDoesNotChooseAWorseCycle | |||
| ) |
Definition at line 1331 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| ChoosesMinimumAmongMultipleCycles | |||
| ) |
Definition at line 210 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| ConcurrentSearchesOnTheSameGraphAgree | |||
| ) |
Definition at line 1630 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), and Aleph::howard_minimum_mean_cycle().
| TEST | ( | HowardMinMeanCycleTest | , |
| CostsOfAboutTenToTheEighteenAgreeWithKarp | |||
| ) |
Definition at line 1443 of file howard_min_mean_cycle_test.cc.
References Aleph::and, Negative_Cycles_Test_Support::build_graph(), Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::cycle_length, Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::cycle_total_cost, Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::has_cycle, Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), m, Aleph::Min_Mean_Cycle_Result< GT, Cost_Type >::minimum_mean, rng, Aleph::Howard_Mean_Cycle_Result< GT, Cost_Type >::used_karp, and w.
| TEST | ( | HowardMinMeanCycleTest | , |
| CycleCostIsAddedInTheOrderTheEvaluationProvedSafe | |||
| ) |
Definition at line 941 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| DagReturnsNoCycle | |||
| ) |
Definition at line 187 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::Min_Mean_Cycle_Value_Result::has_cycle, Aleph::howard_minimum_mean_cycle(), Aleph::howard_minimum_mean_cycle_value(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| DecimalWeightsWithRoundingNoiseDoNotMakeThePolicyOscillate | |||
| ) |
Definition at line 603 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), m, and rng.
| TEST | ( | HowardMinMeanCycleTest | , |
| DistanceIsCalledOncePerArc | |||
| ) |
Definition at line 427 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| EachComponentKeepsItsOwnMeanAndTheSmallestWins | |||
| ) |
Definition at line 634 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| EmptyDigraphReturnsNoCycle | |||
| ) |
Definition at line 176 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| EveryFallbackPassesTheChecksOfHowardsOwnAnswer | |||
| ) |
Definition at line 1236 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), m, rng, and w.
| TEST | ( | HowardMinMeanCycleTest | , |
| FallbackBeyondTheMemoryLimitThrowsLengthError | |||
| ) |
Definition at line 1034 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), FAIL, Aleph::howard_minimum_mean_cycle(), Aleph::howard_minimum_mean_cycle_value(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| FallbackDoesNotReadTheGraphAgain | |||
| ) |
Definition at line 744 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| FallbackReasonSaysWhyKarpAnswered | |||
| ) |
| TEST | ( | HowardMinMeanCycleTest | , |
| FallbackRunsKarpOnEachComponent | |||
| ) |
Definition at line 1199 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::karp_minimum_mean_cycle(), r, and w.
| TEST | ( | HowardMinMeanCycleTest | , |
| FallbackSumsInsideAComponentDoNotOverflow | |||
| ) |
Definition at line 1290 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and Aleph::karp_minimum_mean_cycle().
| TEST | ( | HowardMinMeanCycleTest | , |
| FallbackWithinTheMemoryLimitAnswersAsWithout | |||
| ) |
Definition at line 1003 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::howard_minimum_mean_cycle_value(), and Aleph::Min_Mean_Cycle_Value_Result::minimum_mean.
| TEST | ( | HowardMinMeanCycleTest | , |
| FloatingWeightsAndValueOnlyApiWork | |||
| ) |
Definition at line 253 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::howard_minimum_mean_cycle_value(), r, and value.
| TEST | ( | HowardMinMeanCycleTest | , |
| FractionsAreComparedWithoutOverflow | |||
| ) |
Definition at line 1526 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), r, and rng.
| TEST | ( | HowardMinMeanCycleTest | , |
| ImprovementsBelowTheToleranceAreFoundExactly | |||
| ) |
Definition at line 1388 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| IntegerOverflowThrowsLikeKarp | |||
| ) |
Definition at line 295 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and Aleph::karp_minimum_mean_cycle().
| TEST | ( | HowardMinMeanCycleTest | , |
| IterationLimitFallsBackToKarp | |||
| ) |
Definition at line 697 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), and Aleph::howard_minimum_mean_cycle().
| TEST | ( | HowardMinMeanCycleTest | , |
| MaxCostIsAnOrdinaryCost | |||
| ) |
Definition at line 377 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::low(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| MeanOfAFloatingCycleDoesNotDependOnWhereTheWalkEntersIt | |||
| ) |
Definition at line 673 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| MeansAreReducedAndStepsReportOverflow | |||
| ) |
Definition at line 1573 of file howard_min_mean_cycle_test.cc.
References Aleph::and, Negative_Cycles_Test_Support::build_graph(), and out.
| TEST | ( | HowardMinMeanCycleTest | , |
| NonFiniteFloatingWeightsThrowDomainError | |||
| ) |
Definition at line 274 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| NonNullCookiesAndBitsAreLeftUntouched | |||
| ) |
Definition at line 443 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Negative_Cycles_Test_Support::Planted_State< GT >::plant(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| OverflowOfTheExactVerificationFallsBackToTheExactChoice | |||
| ) |
Definition at line 1366 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| RandomFloatingGraphsMatchKarpWithinTolerance | |||
| ) |
Definition at line 536 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), m, and rng.
| TEST | ( | HowardMinMeanCycleTest | , |
| RandomLargerGraphsMatchKarpExactly | |||
| ) |
Definition at line 504 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), m, and rng.
| TEST | ( | HowardMinMeanCycleTest | , |
| RandomSmallGraphsMatchTheExactOracleAndKarp | |||
| ) |
Definition at line 460 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), and rng.
| TEST | ( | HowardMinMeanCycleTest | , |
| ReferenceNodeOfACycleDoesNotMakeThePolicyOscillate | |||
| ) |
Definition at line 653 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| ResultCanReplaceKarpsResult | |||
| ) |
Definition at line 344 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and Aleph::karp_minimum_mean_cycle().
| TEST | ( | HowardMinMeanCycleTest | , |
| ScaledBiasOverflowFallsBackToKarp | |||
| ) |
Definition at line 723 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and Aleph::karp_minimum_mean_cycle().
| TEST | ( | HowardMinMeanCycleTest | , |
| SelfLoopCanBeOptimalCycle | |||
| ) |
Definition at line 196 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| SmallRangeFloatingWeightsDoNotStopTheIterationEarly | |||
| ) |
Definition at line 573 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::karp_minimum_mean_cycle(), m, and rng.
| TEST | ( | HowardMinMeanCycleTest | , |
| SupportsArrayDigraphBackend | |||
| ) |
Definition at line 306 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| SupportsNegativeMeanCycles | |||
| ) |
Definition at line 224 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| TheLimitIsCheckedAgainstTheLargestComponentWhereverItIs | |||
| ) |
Definition at line 1079 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), and Aleph::howard_minimum_mean_cycle().
| TEST | ( | HowardMinMeanCycleTest | , |
| UndirectedGraphThrowsDomainError | |||
| ) |
Definition at line 318 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::howard_minimum_mean_cycle_value(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node().
| TEST | ( | HowardMinMeanCycleTest | , |
| ValueOnlyAnswersWhereTheCostOfTheCycleDoesNotFit | |||
| ) |
Definition at line 874 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), Aleph::howard_minimum_mean_cycle_value(), Aleph::karp_minimum_mean_cycle_value(), max(), Aleph::Min_Mean_Cycle_Value_Result::minimum_mean, and value.
| TEST | ( | HowardMinMeanCycleTest | , |
| ValueOnlyMatchesTheFullFunctionBitForBit | |||
| ) |
Definition at line 766 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_detail::default_iterations, Aleph::howard_minimum_mean_cycle(), Aleph::howard_minimum_mean_cycle_value(), m, rng, value, and w.
| TEST | ( | HowardMinMeanCycleTest | , |
| ValueOnlyReadsTheAccessorOncePerArcAlsoAfterTheFallback | |||
| ) |
Definition at line 855 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_detail::default_iterations, and r.
| TEST | ( | HowardMinMeanCycleTest | , |
| WitnessIsASimpleCycleWhereKarpsIsAClosedWalk | |||
| ) |
Definition at line 357 of file howard_min_mean_cycle_test.cc.
References Negative_Cycles_Test_Support::build_graph(), Aleph::howard_minimum_mean_cycle(), and Aleph::karp_minimum_mean_cycle().