Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain Index Consistency When Using simplify=True in qubo_to_ising #68

Open
Jacomichi opened this issue Sep 3, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@Jacomichi
Copy link
Collaborator

Jacomichi commented Sep 3, 2024

Description

Currently, using simplify=True in the qubo_to_ising function causes an index mismatch between QUBO and Ising models. We need to address this issue to ensure that simplify=True can be used safely without compromising index consistency.

Objectives

  1. Maintain index consistency between QUBO and Ising models when using simplify=True in some cases.
    The test below is the case.

    def test_coloring_sample_decode():
    problem = graph_coloring_problem()
    instance_data = graph_coloring_instance()
    compiled_instance = jmt.compile_model(problem, instance_data)
    initial_circuit = create_graph_coloring_operator_ansatz_initial_state(compiled_instance, instance_data['V'], instance_data['N'])
    qaoa_converter = qm.qaoa.QAOAConverter(compiled_instance)
    qaoa_converter.ising_encode(multipliers={"one-color": 1})
    qp_transpiler = QuriPartsTranspiler()
    sampler = create_qulacs_vector_sampler()
    qp_circ = qp_transpiler.transpile_circuit(initial_circuit)
    qp_result = sampler(qp_circ, 10)
    sampleset = qaoa_converter.decode(qp_transpiler, (qp_result, initial_circuit.num_qubits))
    assert sampleset[0].var_values["x"].values == {(0, 0): 1, (1, 0): 1, (2, 0): 1, (3, 0): 1}
    assert sampleset[0].num_occurrences == 10

  2. Provide a way for users to easily access the correct indices after simplification.

Current Behavior

  • When simplify=True is used in qubo_to_ising, the resulting Ising model has different indices from the original QUBO model.
  • This mismatch can lead to wrong decode when working with var_map or performing other operations that rely on consistent indexing.

Desired Behavior

  • Using simplify=True should not break the index correspondence.
  • Users should be able to work with simplified models without worrying about index mismatches.

Related PR

#67

@Jacomichi Jacomichi added the enhancement New feature or request label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant