AI-COMPETE & SMART use case · system design

Ask the Plan a Question: An Energy-Aware Planning Copilot

A production planner asks in plain language: “If we move Thursday’s heat-treatment batch to the night, what happens to cost, carbon and due dates?” The copilot reads the plant’s constraints from its documents, fetches tomorrow’s electricity prices and grid carbon intensity, runs the scheduling optimiser, checks the result on a simulation of the line, and returns a trade-off table the planner approves or rejects. The language model decides which tools to call. The optimiser and the simulation produce every number.

ContextUniversity of Skövde · AI-COMPETE (Vinnova) & SMART (KK-stiftelsen) · 2026 · system design
Analytics stages
QualitativeDescriptiveDiagnosticPredictivePrescriptiveSoftware
Technology
PythonLangGraphAzure OpenAI (structured outputs)Azure AI Search (hybrid + semantic ranker)MILP (Gurobi / HiGHS)Discrete-event simulationFastAPIReact + TypeScriptPostgreSQLBicep + GitHub Actions
ResultSystem design — architecture, tool contracts and a scenario-based evaluation plan. No plant results are claimed yet.
What this page is. A system design that joins the two programmes: AI-COMPETE’s coordinated agents and SMART’s energy-resilience strand, with the problem shaped by engine plants such as Volvo Penta’s and Scania’s. It is not a report of a partner deployment. Figures marked target are release gates. They are not measured results.
Stakeholder engagement · problem formulation

The optimiser exists. The planner cannot talk to it.

Energy-aware scheduling works on paper, but it rarely reaches the planner’s desk.

Energy-intensive steps such as heat treatment can be moved to cheaper, lower-carbon hours. The optimisation models to do this exist, including this group’s own work on energy-aware batch scheduling under spot prices (Applied Energy, 2026). The gap is access. Running a scenario takes a specialist, a data export and a day, so planners stay with the schedule they know and the savings never happen.

The design goal is to make a what-if question as cheap as asking a colleague, without letting a language model near the arithmetic.

Architecture · agent over solvers

The model orchestrates, the solvers compute

Every number in the answer comes from a tool output, and that is checked by code.
Question in, trade-off table out, planner decides Plannerwhat-if in plain words Orchestratorplans tool calls Plant documentsAzure AI Search, hybrid + semantic Prices & grid carbonday-ahead, SE3 bidding zone Scheduler (MILP)cost, carbon, due-date objectives Simulation twintests the plan under variability Number checkevery figure traced Trade-off tableapprove / reject decision, inputs, tool outputs and model version written to an audit log; nothing reaches the MES without a human
Four tools behind typed contracts. The model can call them but cannot change what they return.
  1. Read the constraints. Furnace capacity, shift rules, quality holds and customer commitments live in documents. Hybrid search in Azure AI Search, with its semantic ranker, returns the relevant clauses as citations and as typed constraints for the optimiser.
  2. Fetch the market. Day-ahead prices for the SE3 bidding zone and a grid carbon-intensity forecast, cached per delivery day.
  3. Optimise. The scheduler runs the baseline and the planner’s scenario and returns both plans with cost, emissions and lateness per order.
  4. Test on the twin. The simulation replays the proposed plan with breakdowns and processing-time variation, so a plan that only works on average gets flagged.
  5. Check every number. Before the answer is shown, code confirms that each figure in the text appears in a tool output. If one does not, the answer is regenerated with the numbers supplied as data.
Context engineering · tool design

Give the model the difference, not the schedule

A week’s schedule is thousands of rows. The decision depends on a few dozen.
Plan diffsTools return what changed between baseline and scenario: moved batches, affected orders and deltas. The full schedule stays in the database, one call away.
Typed contractsEvery tool has a Pydantic schema, and the model’s calls are validated before anything runs. A bad argument returns an error message the model can act on, not a crash.
Units in the dataMoney in SEK, energy in kWh, carbon in kg CO₂e, time in the plant’s local zone. Units are written into every field name, so the model has nothing to convert.
Session stateThe scenarios a planner has already tried are kept in structured state, so “and what if we also delay order 4471?” builds on the last plan instead of starting over.
Evaluation · scenario suite

Graded against the solver, not against a judge’s opinion

Every test question has a right answer that the optimiser can compute on its own.

The suite pairs planner-style questions with scenarios whose correct outcome is computed by calling the optimiser directly, without the language model. That makes most of the grading exact.

MetricHow it is measuredRelease gate (target)
Numeric faithfulnessFigures in the answer that match a tool output, checked by code1.00 (hard gate)
Scenario fidelityThe scenario the agent sent to the solver matches the one the question asked for≥ 0.95
Constraint citationsConstraints used by the solver traced to a cited document clause≥ 0.95
Infeasible plans shownPlans that break a hard constraint and reach the planner0
Time to answerp95, question to trade-off table, typical weekly horizon< 60 s
Full stack · production

A web app a planner opens, not a notebook a researcher runs

Infrastructure as code, with the evaluation suite as the deploy gate.
Front endReact + TypeScript: a chat panel beside a Gantt view where the scenario appears as a diff over the current plan, with an approve button that requires a named user.
Back endFastAPI with streamed progress (“fetching prices… solving… simulating…”), long solves run as background jobs, and PostgreSQL keeps the audit log and scenario history.
DeliveryDocker images and Azure resources defined in Bicep, with Entra ID role-based access. GitHub Actions runs unit tests and the scenario suite, and a regression blocks the deploy.

This is where the other two designs meet. The plant knowledge assistant supplies the cited constraints, and the fault history behind the robot-cell copilot gives the simulation twin realistic breakdown scenarios.