-
Notifications
You must be signed in to change notification settings - Fork 4
GA‐QAS: Full pipeline
Vu Tuan Hai edited this page May 20, 2024
·
1 revision
In the introduction part, we have introduced the function fitnessW
, we also know this function will be called at least fitnessW
is a heavy function, that requires a lot of time for GA-QAS, then we propose another way.
The old fitnessW
:
def fitnessW(qc: qiskit.QuantumCircuit):
compiler = QuantumStatePreparation(
u = qc,
target_state = state.w(3).inverse()
).fit(num_steps = 100)
return 1 - compiler.compiler.metrics['loss_fubini_study'][-1] # Fitness value
can be reduced by decreasing the num_steps
:
def reduced_fitnessW(qc: qiskit.QuantumCircuit):
compiler = QuantumStatePreparation(
u = qc,
target_state = state.w(3).inverse()
).fit(num_steps = 10)
return 1 - compiler.compiler.metrics['loss_fubini_study'][-1] # Fitness value
The, pass both reduced_fitnessW
and fitnessW
into EEnvironement
:
from qoop.evolution.environment import EEnvironment
env = EEnvironment(
metadata = env_metadata,
fitness_func = [reduced_fitnessW, fitnessW]
)
The function reduced_fitnessW
will be called fitnessW
is
Copyright @ 2024 Hai et al
- Home
- Contribute guideline
- Installation guideline
- Package requirements
- Core
- GA-QAS
- Example
- Advanced