Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1501,16 +1501,16 @@
"\n",
"optimizer_config = OptimizerConfig(max_iteration=1, alpha_cvar=0.6)\n",
"\n",
"qmod = construct_combinatorial_optimization_model(\n",
"qmod_large = construct_combinatorial_optimization_model(\n",
" pyo_model=tasks_model_large,\n",
" qaoa_config=qaoa_config,\n",
" optimizer_config=optimizer_config,\n",
")\n",
"\n",
"qmod = set_execution_preferences(\n",
" qmod, backend_preferences=ClassiqBackendPreferences(backend_name=\"simulator\")\n",
"qmod_large = set_execution_preferences(\n",
" qmod_large, backend_preferences=ClassiqBackendPreferences(backend_name=\"simulator\")\n",
")\n",
"write_qmod(qmod, \"task_scheduling_problem_large\")"
"write_qmod(qmod_large, \"task_scheduling_problem_large\")"
]
},
{
Expand Down Expand Up @@ -1539,8 +1539,8 @@
}
],
"source": [
"qprog = synthesize(qmod)\n",
"show(qprog)"
"qprog_large = synthesize(qmod_large)\n",
"show(qprog_large)"
]
},
{
Expand All @@ -1558,7 +1558,7 @@
},
"outputs": [],
"source": [
"result = execute(qprog).result_value()"
"result_large = execute(qprog_large).result_value()"
]
},
{
Expand Down Expand Up @@ -1688,7 +1688,7 @@
"\n",
"solution = get_optimization_solution_from_pyo(\n",
" tasks_model_large,\n",
" vqe_result=result,\n",
" vqe_result=result_large,\n",
" penalty_energy=qaoa_config.penalty_energy,\n",
")\n",
"optimization_result = pd.DataFrame.from_records(solution)\n",
Expand Down
21 changes: 21 additions & 0 deletions tests/notebooks/test_facility_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from tests.utils_for_testbook import (
validate_quantum_program_size,
validate_quantum_model,
wrap_testbook,
)
from testbook.client import TestbookNotebookClient


@wrap_testbook("facility_location", timeout_seconds=1656)
def test_notebook(tb: TestbookNotebookClient) -> None:
# test models
validate_quantum_model(tb.ref("qmod"))
# test quantum programs
validate_quantum_program_size(
tb.ref("qprog"),
expected_width=15, # actual width: 12
expected_depth=1000, # actual depth: 9237
)

# test notebook content
pass # todo
27 changes: 27 additions & 0 deletions tests/notebooks/test_task_scheduling_problem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from tests.utils_for_testbook import (
validate_quantum_program_size,
validate_quantum_model,
wrap_testbook,
)
from testbook.client import TestbookNotebookClient


@wrap_testbook("task_scheduling_problem", timeout_seconds=840)
def test_notebook(tb: TestbookNotebookClient) -> None:
# test models
validate_quantum_model(tb.ref("qmod"))
validate_quantum_model(tb.ref("qmod_large"))
# test quantum programs
validate_quantum_program_size(
tb.ref("qprog"),
expected_width=8, # actual width: 6
expected_depth=120, # actual depth: 92
)
validate_quantum_program_size(
tb.ref("qprog_large"),
expected_width=30, # actual width: 24
expected_depth=500, # actual depth: 428
)

# test notebook content
pass # todo
21 changes: 21 additions & 0 deletions tests/notebooks/test_traveling_salesman_problem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from tests.utils_for_testbook import (
validate_quantum_program_size,
validate_quantum_model,
wrap_testbook,
)
from testbook.client import TestbookNotebookClient


@wrap_testbook("traveling_salesman_problem", timeout_seconds=1068)
def test_notebook(tb: TestbookNotebookClient) -> None:
# test models
validate_quantum_model(tb.ref("qmod"))
# test quantum programs
validate_quantum_program_size(
tb.ref("qprog"),
expected_width=16, # actual width: 16
expected_depth=567, # actual depth: 567
)

# test notebook content
pass # todo