pub struct VisualProblemBuilder { /* private fields */ }Expand description
Visual problem builder for interactive QUBO construction
Implementations§
Source§impl VisualProblemBuilder
impl VisualProblemBuilder
Sourcepub fn new(config: BuilderConfig) -> Self
pub fn new(config: BuilderConfig) -> Self
Create new visual problem builder
Sourcepub fn add_variable(
&mut self,
name: &str,
var_type: VariableType,
position: Position,
) -> Result<String, String>
pub fn add_variable( &mut self, name: &str, var_type: VariableType, position: Position, ) -> Result<String, String>
Add variable to problem
Sourcepub fn add_constraint(
&mut self,
name: &str,
constraint_type: ConstraintType,
variables: Vec<String>,
) -> Result<String, String>
pub fn add_constraint( &mut self, name: &str, constraint_type: ConstraintType, variables: Vec<String>, ) -> Result<String, String>
Add constraint
Sourcepub fn set_objective(
&mut self,
name: &str,
expression: ObjectiveExpression,
direction: OptimizationDirection,
) -> Result<(), String>
pub fn set_objective( &mut self, name: &str, expression: ObjectiveExpression, direction: OptimizationDirection, ) -> Result<(), String>
Set objective function
Sourcepub fn auto_layout(&mut self, algorithm: LayoutAlgorithm) -> Result<(), String>
pub fn auto_layout(&mut self, algorithm: LayoutAlgorithm) -> Result<(), String>
Auto-layout variables
Sourcepub fn validate_problem(&mut self) -> Result<(), String>
pub fn validate_problem(&mut self) -> Result<(), String>
Validate current problem
Sourcepub fn generate_code(&self, format: ExportFormat) -> Result<String, String>
pub fn generate_code(&self, format: ExportFormat) -> Result<String, String>
Generate code in specified format
Sourcepub const fn get_problem(&self) -> &VisualProblem
pub const fn get_problem(&self) -> &VisualProblem
Get current problem
Sourcepub fn save_problem(&self) -> Result<String, String>
pub fn save_problem(&self) -> Result<String, String>
Save problem to JSON
Auto Trait Implementations§
impl Freeze for VisualProblemBuilder
impl RefUnwindSafe for VisualProblemBuilder
impl Send for VisualProblemBuilder
impl Sync for VisualProblemBuilder
impl Unpin for VisualProblemBuilder
impl UnwindSafe for VisualProblemBuilder
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.