Skip to content
Closed
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
3 changes: 1 addition & 2 deletions .github/workflows/Test-CI-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:

# The caching we do follows from
# https://stackoverflow.com/questions/59127258/how-can-i-use-pip-cache-in-github-actions
- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache-pip
with:
path: ~/.cache/pip
Expand All @@ -107,7 +107,6 @@ jobs:
mask-aws-account-id: true

- name: Install dependencies
if: steps.cache-pip.outputs.cache-hit != 'true'
run: |
set -e
python -m pip install -U pip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@
},
"source": [
"## Defining HHL Algorithm for the Quantum Solution\n",
"This section is based on Classiq HHL in the user guide, [here](https://github.com/Classiq/classiq-library/blob/main/tutorials/technology_demonstrations/hhl/hhl.ipynb) and [here](https://github.com/Classiq/classiq-library/blob/main/algorithms/hhl/hhl/hhl.ipynb).\n",
"This section is based on Classiq HHL in the user guide, [here](https://github.com/Classiq/classiq-library/blob/main/tutorials/technology_demonstrations/hhl/hhl_example.ipynb) and [here](https://github.com/Classiq/classiq-library/blob/main/algorithms/hhl/hhl/hhl.ipynb).\n",
"\n",
"Note the rescaling in `simple_eig_inv` based on the matrix rescaling."
]
Expand Down
467 changes: 467 additions & 0 deletions algorithms/qaoa/knapsack/qaoa_knapsack.ipynb

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions algorithms/qaoa/knapsack/qaoa_knapsack.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"friendly_name": "Constrained QAOA: Knapsack",
"description": "Optimizing the Knapsack problem using the QAOA Algorithm",
"problem_domain_tags": ["optimization"],
"qmod_type": ["algorithms"],
"level": ["demos"]
}
26 changes: 26 additions & 0 deletions algorithms/qaoa/knapsack/qaoa_knapsack.qmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
qstruct KnapsackVars {
a: qnum<3>;
b: qnum<2>;
}

qfunc apply_cost(gamma: real, v: KnapsackVars) {
aux: qbit;
within {
aux = ((v.a * 2) + (v.b * 3)) <= 12;
} apply {
control (aux) {
phase (-((v.a * 3) + (v.b * 5)), gamma);
}
}
}

qfunc main(params: real[6], output v: KnapsackVars) {
allocate(v.size, v);
hadamard_transform(v);
repeat (i: 3) {
apply_cost(params[2 * i], v);
apply_to_all(lambda(q) {
RX(params[(2 * i) + 1], q);
}, v);
}
}
44 changes: 44 additions & 0 deletions algorithms/qaoa/knapsack/qaoa_knapsack.synthesis_options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"constraints": {
"max_gate_count": {},
"optimization_parameter": "no_opt"
},
"preferences": {
"machine_precision": 8,
"custom_hardware_settings": {
"basis_gates": [
"id",
"cy",
"sx",
"z",
"cx",
"u",
"rx",
"y",
"r",
"t",
"u1",
"tdg",
"rz",
"cz",
"x",
"s",
"sxdg",
"h",
"u2",
"sdg",
"ry",
"p"
],
"is_symmetric_connectivity": true
},
"debug_mode": true,
"synthesize_all_separately": false,
"optimization_level": 3,
"output_format": ["qasm"],
"pretty_qasm": true,
"transpilation_option": "auto optimize",
"timeout_seconds": 300,
"random_seed": 695440439
}
}
2 changes: 1 addition & 1 deletion algorithms/qpe/qpe_for_matrix/qpe_for_matrix.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@
"## References\n",
"\n",
"<a name='NC'>[1]</a>: [Michael A. Nielsen and Isaac L. Chuang. 2011. Quantum Computation and Quantum Information: 10th Anniversary Edition, Cambridge University Press, New York, NY, USA.\n",
"](http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf)\n"
"](https://archive.org/details/QuantumComputationAndQuantumInformation10thAnniversaryEdition)\n"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@
"## References\n",
"\n",
"<a name='NC'>[1]</a>: [Michael A. Nielsen and Isaac L. Chuang. 2011. Quantum Computation and Quantum Information: 10th Anniversary Edition, Cambridge University Press, New York, NY, USA.\n",
"](http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf)\n"
"](https://archive.org/details/QuantumComputationAndQuantumInformation10thAnniversaryEdition)\n"
]
}
],
Expand Down
Loading
Loading