Skip to main content

oreblocks

CI License Version DOI

Software note (CC-BY-4.0): "oreblocks: License-Free Synthetic Ore-Body Block Models with a Stamped Exact Ultimate-Pit Optimum", concept DOI 10.5281/zenodo.21512088 (source in manuscripts/ore-body-twins/). It gives the deposit archetypes, the exact max-closure ultimate-pit solver, and an independent LP cross-check to machine precision (~1e-15).

Synthetic 3-D ore-body block models of the MineLib nature, and their scheduling, seeded deposit archetypes with per-block grades, bench (level) structure, slope precedence, UPIT economics with per-block optimal destination, an exact max-closure solver, extraction states with loading faces, MineLib .blocks/.prec/.upit/.cpit/.pcpsp read/write, the certified CPIT LP bound by the critical multiplier algorithm, the TopoSort rounding heuristics, and spatial-coherence metrics. Deterministic given a seed; every generated instance is clearly labelled SYNTHETIC.

Why: per-block ground truth on real mines is licensed or proprietary (MineLib grants academic download only, no redistribution). oreblocks generates instances of the same nature, 3-D benches, grades, precedence, net values, with a stamped exact optimum, so solvers, dispatch simulators and teaching apps get license-free realistic instances with known-by-construction answers.

Install

pip install oreblocks

Quickstart: a MineLib-format twin with a stamped optimum

from oreblocks import make_twin

twin = make_twin("porphyry", dims=(20, 20, 10), seed=42)
print(twin.upit.pit_value, twin.upit.n_in_pit)   # the EXACT optimum, stamped
twin.write("out/")   # -> twin-*.blocks / .prec / .upit / .meta.json (MineLib format)

The emitted triplet is byte-consumable by any MineLib UPIT reader. Cross-validated against an independent TypeScript min-cut engine (CAOS PitForge, which reproduces the published newman1 / zuck_small / kd optima): relative disagreement ~1e-11 on a 4,000-block twin.

Scheduling: which blocks, and WHEN

The ultimate pit says which blocks are worth mining. The constrained pit limit problem (CPIT) says when: assign every block a period so slope precedence holds in every period, per-period capacities hold, and discounted value is maximised. It is NP-hard, so what ships is a certified upper bound plus feasible schedules, with the gap between them reported rather than hidden.

import oreblocks as ob

inst = ob.read_cpit("newman1.cpit")                    # periods, discount rate, capacities
prec = ob.read_prec("newman1.prec", inst.n_blocks)
result, relaxations = ob.solve_cpit(inst, prec)        # bound, schedule, local search
print(f"{result.npv:,.0f}  bound {result.bound:,.0f}  gap {result.gap_pct:.2f}%")

controls = ob.run_controls(inst, prec, result)         # duality, bound, order invariance
assert controls.all_pass

The bound needs no LP solver. Chicoisne et al. 2012 (Operations Research 60(3):517-528, doi:10.1287/opre.1120.1050, Theorem 3.1) show the CPIT LP relaxation is solved exactly in O(mn log n) for one resource per period, as a sequence of parametric nested pits, which are maximum closures, which this package already computes exactly.

On the published newman1.cpit with its two resources, Algorithm 4 (one resource relaxed at a time) returns 24 487 410 and the joint Bienstock-Zuckerberg bound (cpit_bz_bound) returns 24 486 184, which is the CPIT LP upper bound MineLib publishes for that instance. On newman1.pcpsp, where the model also chooses each block's destination, pcpsp_lp_bound returns 24 486 549, the published PCPSP LP upper bound (Jelvez, Morales and Nancel-Penard 2018, Table 3). The PCPSP bound sits above the CPIT one because PCPSP is the richer problem.

Full detail, including the three file-format traps and the explicit list of what is not implemented (stockpiles, blending, minimum-production constraints, two-stage stochastic scheduling): docs/scheduling.md.

Pieces

Module What
BlockGrid regular grid; LEVELS increase upward (the MineLib convention)
make_deposit seeded archetypes: porphyry, vein, layered, core_halo (trend + correlated noise)
Econ / block_values UPIT net value at the optimal destination (floating cutoff = the max)
build_precedence slope-cone template one level up (45° cubic → the classic 9-point), CSR
solve_upit exact Picard max-closure → Dinic min-cut; closure + value-identity self-checks
extraction_state / loading_faces top-down bench extraction + seeded k-means shovel faces (grade at face, ore fraction, tonnes), the bridge to haulage simulators
write_minelib / read_* the .blocks/.prec/.upit triplet + a meta sidecar with the stamped optimum
read_cpit / read_pcpsp / write_* the MineLib scheduling files, with the forbidden-destination sentinel
cpit_lp_relaxation / cpit_bound_two_resources the critical multiplier bound (exact LP for one resource), Algorithm 4
cpit_bz_bound the joint LP bound over every resource, Bienstock-Zuckerberg
toposort_schedule GrTS, GeTS (successor-set weights) and ExTS (LP expected times)
improve_schedule / exact_local_search shift local search; the exact C-PIT[D] re-solve
sliding_window_schedule Cullenbine, Wood and Newman 2011, LP-guided candidate set
destination_toposort / exact_destination_local_search / pcpsp_lp_bound PCPSP: destination choice, OPBSP-[D], the PCPSP LP bound
enforce_min_width / schedule_coherence capacity-feasible sliver absorption; components and widths per period
perturb_values / evaluate_across a correlated, mean-preserving value ensemble and the robust choice

Convention notes

  • Levels (z) increase upward: level 0 is the deepest bench: exactly how published MineLib instances index (verified against newman1). Depth-down viewers flip with z_down = nz-1-level.
  • .blocks free columns written by oreblocks are documented in the meta sidecar: grade (mass fraction) · tonnage (t) · density (t/m³).
  • Nothing here downloads or redistributes published MineLib data.

Used by

  • minehaulsim (haulage DES): geology-grounded scenarios: loading faces with grade/bench.
  • CAOS PitForge: license-free synthetic twins next to the published-instance lane.

License

MIT, as LICENSE and pyproject.toml state.

Metadata

Release files for oreblocks 0.6.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oreblocks 0.6.3
File Size Uploaded
oreblocks-0.6.3.tar.gz 96.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oreblocks 0.6.3
File Interpreter ABI Platform
oreblocks-0.6.3-py3-none-any.whl Python 3 none any Details

Total release size: 181.1 kB

Release files / oreblocks-0.6.3.tar.gz

Download URL oreblocks-0.6.3.tar.gz
Size 96.2 kB
Tags Source
SHA-256 checksum
How to use checksums
45dd555bd6d0e75862aba95cc11390e048a1169c5c4d2b02b0444af31e6eff67
BLAKE2b-256 checksum
How to use checksums
3becc22f8ec9951c2d9d49606aed5e31637539d21353000ecd9e29d0bf70fdcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / oreblocks-0.6.3-py3-none-any.whl

Download URL oreblocks-0.6.3-py3-none-any.whl
Size 84.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92b4b38d8363fca9986d99d1f3dfc71eadc090e214f8d509553d62f507080a3b
BLAKE2b-256 checksum
How to use checksums
48a50ef914fa19a7a9ac330da6e7d4e9d1c12021e89121c3ce4920aa319196f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.3 This release

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page