Skip to main content

Crate u_nesting

Crate u_nesting 

Source
Expand description

§U-Nesting

Domain-agnostic 2D/3D spatial optimization engine.

This crate provides algorithms for:

  • 2D Nesting: Polygon placement optimization (cutting, packing)
  • 3D Bin Packing: Box placement in containers

§Quick Start

use u_nesting::d2::{Boundary2D, Geometry2D, Nester2D};
use u_nesting::{Config, Solver, Strategy};

let geometries = vec![Geometry2D::rectangle("plate", 100.0, 50.0).with_quantity(4)];
let boundary = Boundary2D::rectangle(1000.0, 500.0);

let config = Config::new().with_strategy(Strategy::NfpGuided);
let result = Nester2D::new(config).solve(&geometries, &boundary)?;
assert_eq!(result.placements.len(), 4);

§Feature Flags

  • d2 (default): 2D nesting algorithms
  • d3 (default): 3D bin packing algorithms
  • cutting: cutting path optimization for a 2D layout
  • serde: Serialization support
  • parallel: evaluates a search’s population (GA, BRKGA) and computes no-fit polygons on rayon’s thread pool. Without it every solve runs on the calling thread. The solve uses the pool it is called from, so rayon::ThreadPool::install (or RAYON_NUM_THREADS) sets how many threads it uses.

Re-exports§

pub use u_nesting_core as core;
pub use u_nesting_d2 as d2;
pub use u_nesting_d3 as d3;

Structs§

Config
Common configuration for solvers.
Placement
Represents the placement of a geometry within a boundary.
SolveResult
Result of a nesting or packing solve operation.

Enums§

StopReason
Why a solve stopped – the same vocabulary every runner in u-metaheur reports, so a nesting run and any other search say it in one set of words. Each strategy here sets it where it stops; Completed is a fill that tried every piece, or a search that spent the budget it is given internally. Why a run stopped: the run’s own account of the solution it returns.
Strategy
Optimization strategy.

Traits§

Solver
Trait for nesting/packing solvers.