pub struct QAOA<P: CostFunction> { /* private fields */ }Expand description
Implementations§
Source§impl<P: CostFunction> QAOA<P>
impl<P: CostFunction> QAOA<P>
Sourcepub fn new(problem: P, num_layers: usize) -> Result<Self, AlgorithmError>
pub fn new(problem: P, num_layers: usize) -> Result<Self, AlgorithmError>
Create a new QAOA instance.
§Arguments
problem- The optimization problemnum_layers- Number of QAOA layers (p)
Sourcepub fn with_shots(self, shots: u32) -> Self
pub fn with_shots(self, shots: u32) -> Self
Set the number of shots.
Sourcepub fn build_circuit(
&self,
gamma: &[f64],
beta: &[f64],
) -> Result<Circuit, AlgorithmError>
pub fn build_circuit( &self, gamma: &[f64], beta: &[f64], ) -> Result<Circuit, AlgorithmError>
Build the QAOA circuit for given parameters.
Sourcepub fn run(&self) -> Result<QAOAResult, AlgorithmError>
pub fn run(&self) -> Result<QAOAResult, AlgorithmError>
Run the QAOA optimization.
Auto Trait Implementations§
impl<P> Freeze for QAOA<P>where
P: Freeze,
impl<P> RefUnwindSafe for QAOA<P>where
P: RefUnwindSafe,
impl<P> Send for QAOA<P>
impl<P> Sync for QAOA<P>
impl<P> Unpin for QAOA<P>where
P: Unpin,
impl<P> UnwindSafe for QAOA<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more