Constraint programming · Semantic web · Port logistics · 2025
A scheduler for loading fertilizer onto ships at Jorf Lasfar port. The port is modelled as a flow network of storage halls, conveyors and berths. A MiniZinc constraint model decides when each load starts and ends, and an RDF/OWL knowledge layer keeps the data behind it consistent.
Background: the Portwise port visualiser replaying a day's schedule, with vessels moving between waiting area and berths
The system
At Jorf Lasfar, fertilizer grades such as DAP, MAP and TSP are stored in large halls. A network of conveyors, junctions, screening stations and weighing stations takes them to the quays, where loaders fill the vessels. Each conveyor has a fixed capacity and each hall holds a limited stock, and several ships are often waiting for different products at the same time.
Each hall holds a stock of one grade. Supplies arrive over time.
Capacity-limited belts. Junctions route material between lines.
Product is screened and weighed on its way to the quay.
Loads are scheduled per berth. This is what Portwise decides.
The problem
Planners have to decide which vessel loads which product, from which hall, at which berth, and when. A choice made for one ship limits what is possible for the others.
Portwise states the rules once, in a declarative model, and lets a solver find a plan that satisfies all of them.
The abstraction
Every piece of infrastructure becomes a node or an edge. Nodes have typed behaviour: dispensers only send material out (storage halls), drainers only take it in (vessels at a berth), and splitters route flow between conveyors. Conveyors are the edges, each with a throughput limit. The same model works for a new hall or berth: you add a node, not new code.
Simplified diagram. The real terminal has many more halls, transfer points, screening and weighing stations, and loaders.
Constraint programming with MiniZinc
The scheduling model is written in MiniZinc, a declarative constraint language. Its decision variables are the start and end time of every loading operation and the flow on each conveyor. The solver searches for values that satisfy four families of constraints and load as much as possible.
Throughput at each node equals the difference between what its input and output conveyors carry. Dispensers only output, and drainers only input.
Tracks how much material each dispenser has over time: incoming supplies are added and loads are subtracted, so no hall goes negative.
No conveyor carries more than its physical capacity in any time step.
Loads that share equipment cannot overlap, for example two loads at the same discharge point, and every load fits within its vessel's schedule.
Semantic web layer
A solver is only as good as its input. Portwise describes the port as a knowledge graph, so new equipment, products or rules can be added without rewriting the code, and bad data is caught before it reaches the solver.
Halls, conveyors, berths, vessels, products and loads stored as triples in one structured graph.
An ontology of the port domain: node types, what connects to what, and the properties each entity has.
Queries the graph for the entities and parameters a scheduling run needs.
Shape constraints check consistency before solving, for example that every load has a grade, a tonnage and a valid berth.
The platform
Planners use Portwise through a web platform. They manage materials, supplies, loads, configurations, vessels and clients, run the solver, and export the result. The port visualiser then replays the schedule on a map of the harbour, hour by hour.
In one line