Optimizer

Struct Optimizer 

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

Optimizer for optimizing rectangular cut pieces from rectangular stock pieces.

Implementations§

Source§

impl Optimizer

Source

pub fn new() -> Self

Create a new optimizer.

Source

pub fn add_stock_piece(&mut self, stock_piece: StockPiece) -> &mut Self

Add a stock piece that the optimizer can use to optimize cut pieces. If the same stock piece is added multiple times, the quantities will be summed up. If any have a None quantity, the quantity on other equivalent pieces will be ignored.

Source

pub fn add_stock_pieces<I>(&mut self, stock_pieces: I) -> &mut Self
where I: IntoIterator<Item = StockPiece>,

Add a stock pieces that the optimizer can use to optimize cut pieces. If the same stock piece is added multiple times, the quantities will be summed up. If any have a None quantity, the quantity on other equivalent pieces will be ignored.

Source

pub fn add_cut_piece(&mut self, cut_piece: CutPiece) -> &mut Self

Add a desired cut piece that you need cut from a stock piece.

Source

pub fn add_cut_pieces<I>(&mut self, cut_pieces: I) -> &mut Self
where I: IntoIterator<Item = CutPiece>,

Add desired cut pieces that you need cut from a stock piece.

Source

pub fn set_cut_width(&mut self, cut_width: usize) -> &mut Self

Set the width of the cut to use between cut pieces. This could represent blade or kerf thickness.

Source

pub fn set_random_seed(&mut self, seed: u64) -> &mut Self

Set the random seed used by the genetic algorithms in the optimizer. Using the same random seed will give you the same result for the same input.

Source

pub fn allow_mixed_stock_sizes(&mut self, allow: bool) -> &mut Self

Set whether the optimizer should allow mixed sized stock pieces in the results. If set to false, and multiple stock sizes are given, only one stock size will be used in the results.

Source

pub fn optimize_guillotine<F>( &self, progress_callback: F, ) -> Result<Solution, Error>
where F: Fn(f64),

Optimize in a way where each cut piece can be cut out using only guillotine cuts, where each cut extends from one side to the other.

This method is suitable for cutting with a panel saw.

Source

pub fn optimize_nested<F>( &self, progress_callback: F, ) -> Result<Solution, Error>
where F: Fn(f64),

Optimize without the requirement of guillotine cuts. Cuts can start and stop in the middle of the stock piece.

This method is suitable for cutting on a CNC.

Trait Implementations§

Source§

impl Default for Optimizer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V