Example #1
0
def problem():
    ## QUBO problem
    problem = Problem(name="test")
    problem.terms = [
        Term(c=3, indices=[1, 0]),
        Term(c=5, indices=[2, 0]),
    ]
    problem.uploaded_blob_uri = "mock_blob_uri"

    # Create equivalent NPZ file for translation
    problem.row = numpy.array([1, 2])
    problem.col = numpy.array([0, 0])
    problem.data = numpy.array([3, 5])
    return problem
Example #2
0
def pubo_problem():
    ## PUBO problem
    pubo_problem = Problem(name="test")
    pubo_problem.terms = [
        Term(c=3, indices=[1, 0, 1]),
        Term(c=5, indices=[2, 0, 0]),
        Term(c=-1, indices=[1, 0, 0]),
        Term(c=4, indices=[0, 2, 1])
    ]

    # Create equivalent NPZ file for translation
    pubo_problem.i = numpy.array([1, 2, 1, 0])
    pubo_problem.j = numpy.array([0, 0, 0, 2])
    pubo_problem.k = numpy.array([1, 0, 0, 1])
    pubo_problem.c = numpy.array([3, 5, -1, 4])
    return pubo_problem