Nexma

Run an optimization

Solve with MathEngine

This guide shows you how to pose an optimization to Jax, let Nexma MathEngine solve it, and read the result — including the optimality gap and how it compares to a baseline. You need a project with the relevant data in the Nexma DataStore and an ontology whose constraints define what "valid" means. You do not need to know which solver to use; Jax chooses.

MathEngine is what Jax invokes when a question crosses from "look it up" into "compute the best answer." It covers five solver families — graph, mixed-integer programming, constraint programming, vehicle routing, and simulation — and dispatches automatically based on the shape of your problem.

Steps

  1. State the objective and the decision. An optimization has something to minimize or maximize and something to decide. Say both plainly; Jax maps them to the right formulation.
Choose cabinet locations to minimize total trench length while covering every parcel in the polygon.
  1. Let Jax pick the solver family. You can name a family if you know it, but you rarely need to — Jax reads the problem and routes it. Facility placement becomes MIP, route ordering becomes VRP, scheduling becomes CP, and so on.
Solve this however fits best and tell me which family you used and why.
  1. Add the constraints that bound a valid answer. The ontology's constraints apply automatically; add anything extra specific to this run.
Cap each cabinet at 300 parcels and keep every cabinet within 250 m of a road.
  1. Read the result and the optimality gap. When MathEngine returns, Jax reports the solution and how close it is to provably optimal. A small gap (or zero) means you can trust the number; a large gap means the solver ran out of time before closing it.
What is the optimality gap on this solution, and would more solve time meaningfully improve it?
  1. Compare against a baseline. A number means little without a reference. Ask Jax to solve a naive or current-state version and show the delta.
Compare this against placing one cabinet per existing handhole. How much trench length did we save?
  1. Trust the self-correction loop. If a solution violates a domain constraint, Jax detects it, reformulates, and re-runs — bounded to a few attempts. If it still cannot satisfy everything, it tells you in plain language which constraint is the problem.

Tips

  • Make the objective singular. "Minimize cost and maximize coverage" is two objectives; tell Jax how to weigh them or pick one and constrain the other.
  • A wide optimality gap is often a sign the problem is under-constrained or the time budget is too short — ask Jax which.
  • Quote capacities, ratios, and distances exactly; the solver treats them as hard numbers.
  • For repeated runs (a nightly replan), wrap the optimization in an automation.

Where to go next

Run an optimization