Visualisation tool for the PureCircuit problem.
The tool was built using Rust
with Bevy
as the UI library.
Rust version used to compile
cargo --version: cargo 1.85.0 (d73d2caf9 2024-12-31)
rustc --version: rustc 1.85.0 (4d91de4e4 2025-02-17)
All the workspaces
come with their own Cargo.toml
files
as well as the Cargo.lock
configuration for the versioning of all the libraries.
Total size of dependencies could add up to 26GB
.
To download all the necessary libraries and build the project run the command:
cargo build
Since we are using Bevy
, additional requirements:
- Installed GPU with its drivers in place and configured.
- Build tools: Please refer to the website https://bevy.org/learn/quick-start/getting-started/setup/ for further installation instructions or in case of any further issues
- For Linux please consult the following website: For Linux installation instructions
To run the tests run the command
cargo test
To clean any auxiliary files
cargo clean
To run on release mode
cargo run --release
Workspaces to define the EnumCycle
trait and the procedural macro that
auto implements it.
PureCircuit library that exports the following types:
Value
: Enum value that containsZero, Bot, One
Gate
: Enum gates that containsCopy, Not, And, Or, Nand, Nor, Purify
The PureCircuitGraph
data structure. Contains a directed
graph datastructue that contains two types of nodes:
Value
nodes and Gate
nodes. Node is equipped
with its value as well as additional information. Moreover,
gate nodes are attached with status fields that indicate
whether they are Valid
, InvalidArity
or InvalidValue
.
We implement the following core operations:
Add
orRemove
node/edgeUpdate
the gate status- Get node neighbours
We expand more on its API on files pure-circuit-lib::graph
backtracking
: Backtracking algorithm implementationevo_search
: Meta-heuristic algorithm implementations- Implementation of the Hill Climbing and the Genetic Algorithm
base_finder
:PureCircuit
API extension for fitness evaluationgate_backtrack
: Set simplification implementation and testingsolver_trait
: Trait for the solution finders
Main UI implementation.
We refer to the bevy documentation for further information at to how Bevy
works.
List of important files:
ui_plugin
: File for the setup and rendering of theUI
windowmain
: Main file that connects all plugins and components. Responsible for running the application.drawing_plugin
: Responsible for the rendering and interaction between graph nodescamera_plugin
: Spawns the camera and handles camera movement such as panning and moving aroundassets
: Contain the SVG paths for rendering the value nodesstate_management
mouse_state
: Contains the states for mouse management such asnode/edge
modes. Moreover, addition of current mouse position resourcestate_init
: Responsible for initialising all essential resources and states of the application.edge_management
: Responsible initialising the edge management states and resources as well as handling edge addition/removal operations.events
: Initialisation of all events of the application. Set of events that we use:NodeUpdate
: Re-render the current node and notify the status of all localised gatesNodeStatusUpdate
: Update the status of the gate by re-rendering or removing error circlesButtonEvoEvent
: Run theGenetic Algorithm
algorithmButtonHillEvent
: Run theHill Climbing
algorithmBacktrackEvent
: Run theBacktracking
algorithmSolutionReset
: When the current topology of the circuit changes, reset the solution setIndexReset
: When the current state of the circuit changes, reset the selected solution index
algo_execution
back
: Responsible for importing and running the backtracking algorithmplugin
: Responsible for importing and running the meta-heuristic algorithms
We provide a full excerpt of our test results in test-output.log