(problem)
return problem
Extends the problem bounds to the nearest power of two

    Parameters
    ----------
    problem : dict
        The problem definition
Extends the problem bounds to the nearest power of two
Extends the problem bounds to the nearest power of two
def extend_bounds(problem):
    """Extends the problem bounds to the nearest power of two

    Parameters
    ----------
    problem : dict
        The problem definition
    """

    num_vars = problem['num_vars']
    num_ff_vars = 2 ** find_smallest(num_vars)
    num_dummy_variables = num_ff_vars - num_vars

    bounds = list(problem['bounds'])
    names = problem['names']
    if num_dummy_variables > 0:
        bounds.extend([[0, 1] for x in range(num_dummy_variables)])
        names.extend(["dummy_" + str(var)
                      for var in range(num_dummy_variables)])
        problem['bounds'] = bounds
        problem['names'] = names
        problem['num_vars'] = num_ff_vars

    return problem
def extend_bounds ( problem ) : num_vars = problem [ 'num_vars' ] num_ff_vars = 2 ** find_smallest ( num_vars ) num_dummy_variables = num_ff_vars - num_vars bounds = list ( problem [ 'bounds' ] ) names = problem [ 'names' ] if num_dummy_variables > 0 : bounds . extend ( [ [ 0 , 1 ] for x in range ( num_dummy_variables ) ] ) names . extend ( [ "dummy_" + str ( var ) for var in range ( num_dummy_variables ) ] ) problem [ 'bounds' ] = bounds problem [ 'names' ] = names problem [ 'num_vars' ] = num_ff_vars return problem