z-quantum-optimizers
is a module with basic optimizers to be used in workflows with Orquestra โ a platform for performing computations on quantum computers developed by Zapata Computing.
Currently this library includes the following optimizers:
It also includes a task templates for optimization of variational circuits.
In order to use z-quantum-optimizers
in your workflow, you need to add it as a resource:
resources:
- name: z-quantum-optimizers
type: git
parameters:
url: "[email protected]:zapatacomputing/z-quantum-optimizers.git"
branch: "master"
and then import in a specific step:
- - name: my-task
template: template-1
arguments:
parameters:
- param_1: 1
- resources: [z-quantum-optimizers]
Once it's done you can:
- use any template from
templates/
directory - use tasks which import
zquantum.optimizers
in the python code (see below).
Here's an example how to do use methods from z-quantum-optimizers
in a python task:
from zquantum.optimizers import ScipyOptimizer
optimizer = ScipyOptimizer(method='L-BFGS-B')
or use optimizer-specs
parameter to make our code work with other backends too:
from zquantum.core.utils import create_object
optimizer_specs = {{inputs.parameters.optimizer-specs}}
optimizer = create_object(optimizer_specs)
Even though it's intended to be used with Orquestra, you can also use it as a standalone python module.
In order to install it run pip install .
from the src
directory.
You can find the development guidelines in the z-quantum-core
repository.
In order to run tests please run pytest .
from the main directory.
In order for the tests related to the daemon optimizer to work you need to first specify FLASK_APP environmental variable:
export FLASK_APP=/path/to/z-quantum-optimizer/src/python/orquestra/optimizers/daemon-optimizer/proxy/rest.py
.