Beispiel #1
0
def add_to_map_from_problem_to_reduction_method(problem, reduction_method):
    if problem not in _problem_to_reduction_method_map or is_jupyter():
        if hasattr(type(problem), "__is_exact__"):
            problem = problem.__decorated_problem__
        _problem_to_reduction_method_map[problem] = reduction_method
    else:
        assert _problem_to_reduction_method_map[problem] is reduction_method
Beispiel #2
0
def add_to_map_from_problem_name_to_problem(problem_name, problem):
    if hasattr(type(problem), "__is_exact__"):
        assert type(problem).__is_exact__ is True
        problem_name = problem.__decorated_problem__.name()
        assert problem_name in _problem_name_to_problem_map
    else:
        if problem_name not in _problem_name_to_problem_map or is_jupyter():
            _problem_name_to_problem_map[problem_name] = problem
        else:
            assert _problem_name_to_problem_map[problem_name] is problem
 def CustomizeReductionMethodFor_Decorator(customizer):
     if not is_jupyter():
         assert Problem not in _cache
     _cache[Problem] = customizer
     return customizer