Skip to content

From Business Examples to Your Application ​

After a first lesson, keep the small example application before adding an HTTP service: read one fixed input, make one real framework call and print independently checkable results. Add databases, queues and UI after input mapping, outcomes and error handling are stable.

1. Keep the Shortest Path ​

This is an application responsibility diagram, not a shared callable API. Framework entry points and return types differ. Do not discard original reports, quantities or errors to force them into a uniform interface.

LayerIncludeKeep out
Input adapterExplicit conversion of order IDs, units, time, stock and resourcesSilent zeros, dropped orders or merging distinct IDs by dimensions
Application orchestrationDomain problem, configuration, backend, budgets and extension wiringA second implementation of existing conservation or overlap constraints
Business rulesSingle-candidate policies or global modeling extensionsDiscovering hard-rule violations only during report export
Output adapterValidated plan, status, metrics, shortfalls and diagnosticsPresenting mocks, empty render objects or runs without a feasible solution as plans

2. Change Five Things in Order ​

  1. Retain the hand-checkable baseline: run the first-lesson business function and main before importing production orders.
  2. Confirm the execution path: real backend examples need real backends; preserve heuristic semantics where documented. Configure backends for both restricted-master and final-integer phases in BPP2D/BPP3D and retain their reports.
  3. Handle request-boundary errors: translate CLI errors into structured server responses and retain reports for normal runs without a solution. Entry points have different return types.
  4. Replace one data category at a time: demand, then resources, then rules, preserving independently checkable invariants.
  5. Add infrastructure last: databases, queues and UI; reject stale outputs and redact credentials and licenses from diagnostics.

Configure dependencies and native libraries using Setup. First-lesson sources include imports; similarly named Kotlin/Rust constructors are not interchangeable.

3. Check Input Before Modeling ​

InputBusiness decision required
IDs and referencesUnique identities and existing product, container, resource and node references
Counts and unitsInteger pieces/rolls, explicit length/weight conversions and zero-demand treatment
Stock and boundsMeaning of absent stock; distinguish null, zero and a missing field
Time and calendarsTime zone, allowed starts, intervals, frozen choices and execution facts
ObjectivePriority of count, consumption, cost or service level, with explicit weight normalization
BudgetsCandidate, node, iteration and total-time limits, including how partial results are displayed

Do not invent cancellation support where an entry point does not provide it; check backend capabilities. Prevent a cancelled or stale run from overwriting a newer schedule.

4. Success Still Requires Two Outcome Checks ​

Outer success means a report or result was returned. It may still describe infeasibility, a time limit without a feasible solution, a feasible solution found before a time limit or optimality. Read the actual language-specific fields and enums.

ObservationApplication action
Input or technical errorReturn a locatable error; do not present an old plan as this run's success
Run completed without an acceptable planShow diagnostics; distinguish full-problem infeasibility from an insufficient pool
A feasible solution existsValidate business feasibility and retain its real termination status
Current model proven optimalPreserve model scope, candidate completeness, custom rules and evidence source
Geometry, stock or process validation failsDo not deliver; retain input/report and inspect modeling or extraction

A business response should retain request/input revision, configuration, actual backend, deliverability, original termination status, objective with units, plan, shortfalls and diagnostics. This is an application design recommendation, not a common OSPF serialization schema. Missing bounds/gaps remain unavailable, not zero.

5. Protect Integration with Three Test Groups ​

GroupExamplesAcceptance
Feasible baselineOne container, one pattern, two activities, four-node flowExact demand, geometry/process/conservation, resources and recomputed cost
Deliberately infeasibleOversized item, frozen-calendar conflict, insufficient shared resourceNo fabricated plan; correctly scoped conclusions
Boundaries and failuresDuplicate IDs, wrong units, zero stock, backend failure, time limit without a feasible solutionNo silent input changes; technical errors separate from business outcomes

Do not assert only the objective. Equivalent optima can differ in coordinates or activity order; prefer invariants and objective tolerances. Lock down a particular plan only when the business actually requires it.

Use second-lesson hand calculations to establish acceptance criteria for your application. Linked contract tests provide additional references for individual capabilities; validate the complete extended scenario with your own input and backend.

6. Continue with a Concrete Scenario ​

Determine rule ownership first: single-candidate rules belong in generation/policies; cross-candidate or cross-domain rules belong in a joint model. Use the modeling workflow and solver result guide, rather than extending by copying the solve loop.