Skip to main content

Model

Struct Model 

Source
pub struct Model { /* private fields */ }
Expand description

A constraint programming model that owns variables and constraints.

Models are the root of object lifetimes and create variables, constraints, and solvers associated with the same backend instance.

Implementations§

Source§

impl Model

Source

pub fn new(name: Option<&str>) -> Self

Creates a new Model instance.

§Panics

if the string name contains a null byte.

Source

pub fn name(&self) -> Option<String>

Returns the name of the model, if set.

Source

pub fn int_var<'b, X>(&'b self, x: X, name: Option<&str>) -> IntVar<'b>
where for<'a> (X, Option<&'a str>): NewIntVarT,

New integer variable associated with this model. x can be:

  • a single integer value (constant variable)
  • a slice of possible integer values
Source

pub fn int_var_bounded<'b, X, Y>( &'b self, x: X, y: Y, name: Option<&str>, bounded: Option<bool>, ) -> IntVar<'b>
where for<'a> (X, Y, Option<&'a str>, bool): NewIntVarT, for<'a> (X, Y, Option<&'a str>): NewIntVarT,

New bounded integer variable associated with this model. x and y shall be integer values bounded: Force bounded (True) or enumerated domain (False). If None, Choco will automatically choose the best option.

Source

pub fn bool_var<'model>( &'model self, value: Option<bool>, name: Option<&str>, ) -> BoolVar<'model>

Source

pub fn solver(&self) -> Solver<'_>

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl !Send for Model

§

impl !Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.