← Abderrahmane Moujar All projects

Constraint programming · Semantic web · Port logistics · 2025

Portwise

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

4
constraint families: node, balance, conveyor, timing
3
node types: dispenser, splitter, drainer
4
semantic-web standards: RDF, OWL, SPARQL, SHACL
1
objective: maximise tonnage loaded onto vessels

The system

From the storage hall to the ship's hold

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.

Storage halls

Each hall holds a stock of one grade. Supplies arrive over time.

Conveyors & junctions

Capacity-limited belts. Junctions route material between lines.

Screening & weighing

Product is screened and weighed on its way to the quay.

Berths & vessels

Loads are scheduled per berth. This is what Portwise decides.

The problem

Many ships, shared conveyors, limited stock

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.

  • respect each vessel's arrival and the time it is allowed to stay at the berth
  • keep conveyor flow within its physical capacity
  • load only stock that is actually in the hall, after counting incoming supplies
  • stop two loads from using the same discharge point at the same time
  • handle a different product grade, tonnage and quality for each load

Portwise states the rules once, in a declarative model, and lets a solver find a plan that satisfies all of them.

The abstraction

The port as a flow network

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.

Hall · DAP Hall · MAP Hall · TSP Berth 1 · vessel Berth 2 · vessel conveyor ≤ capacity conveyor ≤ capacity dispensers (output only) splitters (route flow) drainers (input only) flow in = flow out at every splitter
Dispenser: storage hall Splitter: junction or transfer point Drainer: vessel at a berth Dashed: an alternative route the solver may choose

Simplified diagram. The real terminal has many more halls, transfer points, screening and weighing stations, and loaders.

Constraint programming with MiniZinc

Decide when each load runs, and keep every rule true

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.

01

Node

Throughput at each node equals the difference between what its input and output conveyors carry. Dispensers only output, and drainers only input.

02

Balance

Tracks how much material each dispenser has over time: incoming supplies are added and loads are subtracted, so no hall goes negative.

03

Conveyor

No conveyor carries more than its physical capacity in any time step.

04

Timing

Loads that share equipment cannot overlap, for example two loads at the same discharge point, and every load fits within its vessel's schedule.

Inputs

  • Network: halls, conveyors, splitters, berths
  • Stocks and planned supplies per hall
  • Vessels, their windows and requested loads
  • Product grade, quality and tonnage per load
→

Output

  • Start and end hour of every load
  • Berth and storage hall for each load
  • A feasible plan that maximises total tonnage loaded
  • Exportable to the visualiser as a Gantt chart

Semantic web layer

An ontology so the data matches the model

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.

Data

RDF

Halls, conveyors, berths, vessels, products and loads stored as triples in one structured graph.

Vocabulary

OWL

An ontology of the port domain: node types, what connects to what, and the properties each entity has.

Query

SPARQL

Queries the graph for the entities and parameters a scheduling run needs.

Validation

SHACL

Shape constraints check consistency before solving, for example that every load has a grade, a tonnage and a valid berth.

The platform

From the plan to the quay

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.

Vessels move from the waiting area to their assigned berths (1N, 1Bis, 1Ter, 2N, 2Bis, 2Ter) as the red time cursor moves across the Gantt chart. Each bar shows the load's time window, product grade and tonnage, and hovering over a ship shows its quality, source storage hall, start and end hour.

In one line

Describe the port once as a graph, state the rules as constraints, and let the solver plan the loading.