Skip to content

Add transition-aware filament source and U1 head placement optimizer #5

Description

@physicsG

Summary

Add an optimizer that chooses compatible ACE spool sources and assigns logical project filaments to the U1's four physical heads while minimizing slow source swaps, purge, tool changes, and unnecessary spool movement.

Scope

  • Build a weighted transition graph from predicted filament transitions.
  • Generate compatible source candidates using hard constraints and soft preferences.
  • Support exact RFID/profile matches, material subtype, color distance, brand, remaining quantity, loaded state, and uncertainty scoring.
  • Assign frequently alternating filaments to different heads when hardware routes allow.
  • Respect hard user pins.
  • Produce deterministic results and an explainable cost breakdown.
  • Show suggested spool moves and estimated savings compared with the current layout.
  • Preserve a manual routing workflow when optimization is disabled or infeasible.

Suggested objective

total cost =
    source swaps * source-swap time
  + physical head changes * tool-change time
  + purge volume * purge cost
  + temperature-transition time
  + spool relocation penalty
  + inventory uncertainty penalty

Proposed code areas

src/libslic3r/FilamentPlacementOptimizer.hpp
src/libslic3r/FilamentPlacementOptimizer.cpp

Acceptance criteria

  • Every proposed route satisfies all hard material, state, quantity, nozzle, temperature, and reachability constraints.
  • The optimizer never assigns a physical head outside 0..3.
  • Hard user pins are preserved or produce an explicit conflict.
  • Output is deterministic for identical input and seed/configuration.
  • Exact small scenarios match an exhaustive optimum.
  • Larger scenarios complete within a documented performance budget.
  • The UI can compare current and optimized cost and list required spool moves.
  • No-solution cases provide actionable rejection reasons.
  • Unit tests cover duplicate colors, restricted materials, insufficient quantity, multiple sources per head, and multiple reachable heads.
  • Property tests assert routing invariants across generated inventories.

Dependencies

Design references

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions