Skip to content
SlothISIPPublic

About

Routing CAD workbench for cables and pipes in ship and vehicle compartments. A solver draws each route, a physics verifier measures it, and only a route that passes every check is stored as verified. C++20, OCCT, Qt 6.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Obrussa

A routing CAD workbench for cables and pipes. The solver draws, a physics verifier decides, and learning only chooses what to try.

Obrussa routes cables and pipes through ship and vehicle compartments. A solver draws each route, a physics verifier measures it, and only a route that passes every check is stored as verified. Learning and the language model sit only where something is chosen: which candidate routes to build, which command a sentence means. They never produce coordinates and never decide a pass, so a wrong model can cost routes but cannot let a wrong route through.

A typed sentence becomes a cable route, and the verifier passes it

A sentence typed into the command window is read by the offline rule parser, which shows the command it understood. Execute starts the solver, which draws the cable through its tray. The verifier measures the route, and since all 484 checks pass, the run is stored as verified.

  • Benchmark, 1,000 port pairs: the solver leaves 0 illegal routes. A naive axis-aligned route standing in for a human leaves 642.
  • Tests: 342 kernel test cases (151,513 assertions) and 1,778 Python tests.
  • Ship-wide assignment on a virtual offshore support vessel, 25 to 1,000 runs: a short single-thread exact optimisation stays within 2 % of the proven optimum up to 250 runs.
  • Learning: one claim. A supervised candidate generator routes 1.68 % more runs at 100 runs, and 1.20 % more on ship families it never saw. There is no reinforcement-learning claim; what was tried and why it fell short is in docs/rl-summary.md.

C++20, OCCT 8.0.1, Qt 6.11.2, SQLite. Windows, MSVC x64.

Everything here is in English: the documents, the code comments, the user interface, the messages of the kernel, the sentences the AI command window reads, the part names of the demo scenes, the screenplays in docs/demo/ and the source notes of the rule packs.

What it does

The workbench: one compartment

  • Scene. Import STEP geometry or place and move primitive solids, and attach ports to equipment. Mark the cable trays and the corridors.
  • Route (Run). A person sketches it, or picks two ports and the solver recommends one, or the solver recommends many systems at once in the order the rule pack sets. Either way it is the same Run and gets the same verification.
  • Verification. It measures clashes (C-CLASH), separation between runs (C-SEG), bend radius (C-BEND), the straight length in front of a port (C-STRAIGHT), support spacing (C-CLIP), tray fill (C-FILL), separation of redundant runs (C-SEP), slope (C-SLOPE), forbidden zones (C-ZONE), axis alignment of pipes (C-ORTHO), elbow angles (C-ELBOW), the spec (C-SPEC) and the segments (C-SEGMENTS). The result window shows the measured value and the limit for each item.
  • Verifying again. When a part is placed or moved, the runs become stale, and only re-verification makes them verified again. Changing the rule pack can fail a run that used to pass.
  • Telling it in words. An English sentence such as "recommend from the generator HV terminal to the switchboard panel HV input" is turned into an existing command and IDs that are already in the document. No coordinate is made. The default is an offline rule parser. Only when the environment variable ANTHROPIC_API_KEY is set is an LLM called, for a sentence the parser could not read, and what the LLM read also comes out as a preview that runs only when Execute is pressed.

A box is moved onto the cable, and Reverify fails the run with a clash

Here a box is moved onto the cable from the clip above. Placing the box had already made every run stale. Reverify measures the cable 12 mm inside the box, so the run becomes failed, and the check list names the part it hit.

Ship-wide assignment

  • On a virtual offshore support vessel, it decides which corridor and lane each of 25 – 1,000 runs of power, signal, fresh water, waste water and fuel goes into. The aim is to lay more runs without breaking a rule.
  • Up to 250 runs the baseline is exact optimisation (CP-SAT), and at 500 runs and above it is large neighbourhood search (LNS). Neither uses learning.
  • At the 100-run scale a supervised model chooses which new candidate routes to build. The kernel builds only those candidates, and the verifier judges them.
  • An assignment is realised as a document and saved, and a fresh kernel opens the file and verifies every run again.

A generated ship: the hull, then the trays, then only the runs, seen from above

A generated ship with 105 port pairs in five systems. 85 of them are routed here, about 2.1 km of cable and pipe, and all 85 are verified (this is the cell that used the learned generator: a demonstration, not a claim). The clip hides the parts, then the trays, and leaves the runs.

Who does what

Role Does Does not
A person Makes the scene and the ports, and sketches a route or asks for a recommendation
Solver Finds a route between ports. The same input, seed and rule pack give the same line Decide a pass
Verifier Measures a route and decides whether it passes. verified comes from here only Draw or repair a route
Rule pack Holds the numbers, such as separation, bend and fill (packs/*.json). The C++ has none of those numbers
Learning In the ship assignment, chooses which candidates to build (IDs of the slots the kernel enumerated) Coordinates, a pass
AI window Turns a sentence into an existing command and IDs of the document Coordinates, new numbers

Claims and evidence

Claim Measured How to measure it again Record
No route the solver produces is illegal On the bench of 240 scenes and 1,000 pairs it solved 626 pairs with 0 illegal. On the same pairs the human proxy (a right-angle path that joins the ports along the axes only) leaves 642 illegal Bench, below docs/progress.md
A pair it cannot solve is refused, not given a wrong route The other 374 pairs: no tray or corridor within reach 283, the front of a port blocked 91 Same Same
The same input gives the same line The same recommendation repeated 100 times gives the same line Tests, below (G7 determinism 100x) tests/test_golden.cpp
Tests guard the behaviour Kernel: 342 cases, 151,513 assertions. Python: 64 files, 1,778 tests Tests, below
Assignment without learning is close to the optimum At 25, 100 and 250 runs, exact optimisation under a short budget (number of runs × 0.1 s, one thread) is 0.0, 0.4 and 1.8 % from the proven optimum. At 500 runs the neighbourhood search raises the best baseline from 274.0 runs to 300.0 runs. On one 1,000-run cell it reaches 99.0 % of the best known Data, below docs/demo-table.md
Learning lays more runs at 100 runs On 10 new cells, 794 against 777 runs (+1.68 %, bootstrap lower bound 0.98 %). On 12 cells of ship families it had not seen, 958 against 943 runs (+1.20 %, lower bound 0.40 %). The opponent is the best value per cell among ten non-learned generators with the same budget Data, below docs/demo-table.md §8
An assignment becomes a real document Saving the 73 assigned runs of a 100-run cell as a document and opening it again with a fresh kernel, 73/73 pass. A new cell that used the learned generator gives 85/85 (a demonstration, not a claim) docs/demo-table.md §7 and §9

The learning verdicts were made on a surrogate evaluator, and the kernel checked the assignments of one cell per experiment (all 168 and 149 items accepted).

Not claimed

  • Shorter or better than what a person draws. The solver moves along the axes only, so in free space its length equals that of a right-angle path. On the 338 pairs that both passed, the median length and bends equal those of the human proxy.
  • Validation on a real ship, buildability, classification-society or OEM certification. The scenes are generated compartments and virtual ships assembled from public dimensions. No routes drawn by people were used.
  • A gain from reinforcement learning. It did not pass its gates (Learning, below).
  • That learning also wins at 25, 250 and 500 runs. The claim is at 100 runs only.
  • The accuracy of the LLM window. It was not measured.
  • That every rule number comes from a clause of a standard. In marine.dnv.v1, only 9 of the 86 numbers carry a clause tag.

Learning

Learning was put only where something is chosen, never where a route is drawn.

Where Method Result
Choosing the exit of one run Learning to rank No claim. It is in the kernel but switched off
The order of paths on a synthetic tray net GNN + deterministic MCTS No claim
Assignment of many runs GNN policy and value + PUCT; learning on top of the neighbourhood search No claim. The non-learned neighbourhood search became the baseline
Which candidates to build Supervised learning of pair verdicts (gradient-boosted trees) A claim at 100 runs (+1.68 %; unseen families +1.20 %). Failed at 250 runs
Sequential generation of candidates, and planning GNN + PUCT, an evolution strategy No claim. Better than the starting policy, but it did not beat the strong non-learned opponents

The five reasons reinforcement learning did not pass are in docs/rl-summary.md. Among them: the headroom left above the non-learned best was around 1 % of the runs; at 500 runs the noise of one reading was half the threshold of the gate; and each time the headroom was measured, a non-learned repair closed the gap first.

Structure

  • The kernel, obrussa-kernel.exe, does not link Qt. The UI, obrussa-cad.exe, starts the kernel as a child process and sends it commands over IPC.
  • A document (.obrussa) is an SQLite file. Units are mm and rad.
  • There are four rule packs: automotive.v1, marine.v1, the derived pack with clause tags marine.dnv.v1, and the made-up strict pack strict.v1 (it is not any standard).
  • The learning code is Python, and the kernel does not link it.
Path What
kernel/ Document, storage, solver, verifier, IPC server
ui/ The Qt 6 UI
packs/ Rule pack JSON
tests/ Kernel tests (Catch2) and golden JSON; Python tests
bench/ The generator and the runner of the bench corpus; the generators of the virtual engine room and ships
rl/ The learning code, and the frozen models and manifests (rl/data/)
scripts/ Distribution smoke, rule pack lint, the scripts that drive and analyse the experiments
docs/ Goal, state, data, result tables, the review of the grounds of the rule numbers
third_party/ SQLite, Catch2

Build

It needs Windows, MSVC x64 (Visual Studio 2022 Build Tools) and a conda-forge environment.

:: occt 8.0.1, qt6-main 6.11.2, cmake, ninja
conda env create -f environment.yml

:: in an x64 developer command prompt (vcvars64.bat)
chcp 65001
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release ^
  -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl ^
  -DOBRUSSA_REQUIRE_OCCT=ON -DCMAKE_PREFIX_PATH=<obrussa environment>\Library
cmake --build build
  • On a Korean Windows, leaving out chcp 65001 makes ninja record no header dependencies. Then a file that uses a header is not compiled again when the header is edited. If ninja -C build -t deps shows #deps 0, this is the case (sqlite3.c has 0 anyway).
  • cmake/FindOcct.cmake uses .deps/occt/Library first when it exists.
  • Without OCCT, OBRUSSA_REQUIRE_OCCT=ON stops at the configure step. With it off, the OCCT bridge is compiled as an empty shell and STEP cannot be read. Primitive solids still work.
  • Without Qt, only obrussa-cad.exe is left out.

Run

run_obrussa_cad.bat sets the OCCT and Qt DLL paths and QT_PLUGIN_PATH and starts build\ui\obrussa-cad.exe. It takes the repository path from the folder the batch file is in, and assumes Qt is under %USERPROFILE%\miniconda3.

  • Checks without a window: obrussa-cad.exe --nl-prove ["<sentence>"], --sketch-prove, --pick-prove, --cand-prove, --obrussa-roundtrip and others. Unless .deps\occt\Library\bin is at the front of PATH, the kernel dies with 0xC0000135 (DLL not found) and the UI prints nothing.
  • The kernel alone: obrussa-kernel.exe --oneshot <command> <JSON> runs one command and prints one line of result JSON.
  • Video: pwsh scripts/tour.ps1 <screenplay> <output folder> drives the real window through a screenplay (docs/demo/*.tour.json) and captures frames, and python scripts/tour_video.py <output folder> -o <mp4> adds the caption band and makes the video. A screenplay presses the widgets itself, so the frames hold no mouse pointer: the pointer in a video is drawn by tour_video.py, at the places the screenplay presses or types and resting in the 3D view while the camera moves (--no-pointer leaves it out). Filming stops when an expect of the screenplay differs from the value the window shows.
  • The three clips on this page are pieces of the video of docs/demo/demo-short.tour.json, written by tour_video.py --gif with --cuts, so their pointer is drawn too. Waits are cut out of them: in the first clip the solver and the verifier took about 5.5 seconds between Execute and the route.

Tests

ctest --test-dir build --output-on-failure --timeout 3600
node scripts/pack_lint.mjs
  • ctest runs obrussa-kernel-tests.exe once without arguments. All 342 cases take about 17 minutes. The performance test ([g10]) and the bench gate ([bench]) carry hidden tags and are left out. They run with cmake --build build --target obrussa_kernel_nightly_G10 and obrussa_kernel_nightly_G11 (the latter needs a bench report). In a fresh clone 337 cases pass and 5 are skipped: one needs the bench corpus (Bench, below, makes it), and four need a copy of the first version of the corpus, which no script in the repository makes.
  • pack_lint checks that every numeric key of a rule pack has a sources entry, that id is the file name and that all packs have the same set of keys, and counts the tag grades (clause of a standard / kernel tuning value / unconfirmed / other).
  • The Python tests are the 64 files tests/test_*.py, and each file runs as one process (for example python tests/test_ship_gen.py). They need numpy, scipy, ortools, scikit-learn and pytorch (the conda-forge build). Some read the kernel executable and frozen data kept outside the repository (Data, below); where that data is absent they are skipped (67 tests in 25 files) and the other 1,711 run.
  • The environment that was checked is MSVC 19.44 with tbb 2023.0.0. On the GitHub-hosted runner (MSVC 19.52, tbb 2023.2.0), the run of 2026-12-03 failed 36 of what were then 340 kernel test cases, and the cause has not been found yet (docs/progress.md, Known limits).

Bench

The human proxy and the solver are compared on the same corpus. The human proxy must leave illegal routes and the solver none, and the median length and bends must be no worse than the human proxy's.

pwsh bench/gen_corpus.ps1   # makes 240 scenes in build/bench
pwsh bench/run_bench.ps1    # leaves build/bench/report.json
  • The kernel must be able to find the OCCT DLLs. Put the Library\bin of the conda environment on PATH.
  • The numbers in the table above were measured on a corpus that was generated once and frozen. A corpus generated again in a fresh clone gave the same counts (626 solved, 0 illegal, the same refusals, 642 illegal for the human proxy), but its scenes have other IDs and 104 of the 626 routes differed, so it is not the same row by row.
  • Do not run a build or tests while it runs. The solver has wall-clock cuts (1 s and 8 s), so sharing the CPU changes the result.

Distribution

cmake --build build --target dist
pwsh -NoProfile -File scripts/smoke_dist.ps1

dist/obrussa-win64.zip holds the two executables, the rule packs, the OCCT resources and DLLs, and Qt. The smoke removes the development machine's paths from PATH and runs six checks inside the zip (--obrussa-roundtrip, --cand-prove, --pick-prove, --nl-prove, --llm-http-prove, --sketch-prove).

Data

  • There is no data of routes drawn by people. The scenes are generated compartments, a virtual engine room and virtual ships, and every label is a verdict of the verifier.
  • The bench corpus and the cells of the ship assignment were built once outside the repository (build/) and frozen. The repository holds the manifests that record their hashes (rl/data/).
  • So the numbers of the ship assignment and of learning cannot be measured again from the repository alone. The cells have to be built again (the generators are in bench/ship/, the driving scripts in scripts/), and cells that are built again have other IDs and may not be the same row by row.

Documents

Document What
docs/goal.md The goal and its measurements, and what is not done
docs/progress.md The present state and numbers, known limits
docs/demo-table.md The comparison tables of the ship assignment by scale, and the claims
docs/rl-summary.md Learning: what was tried, what holds, why the rest did not work
docs/data.md The data that is used and the frozen corpus
docs/f0-field-review.md The review that compares the numbers of the rule packs with the clauses of classification rules and standards

Out of scope

  • It is not a general CAD (part design, surfaces, drawings).
  • Moving harnesses are not handled. Only static compartments are.
  • It does not replace classification-society or OEM certification.
  • The LLM makes no route coordinates, verification does not use the display mesh, and learning does not replace the solver or the verifier.

License

MIT, see LICENSE. The licenses of the third-party code in the repository and of the libraries it links are listed in THIRD_PARTY_NOTICES.md.

About

Routing CAD workbench for cables and pipes in ship and vehicle compartments. A solver draws each route, a physics verifier measures it, and only a route that passes every check is stored as verified. C++20, OCCT, Qt 6.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages