DNA//evolutions
JOpt.TourOptimizer · Feature Spotlight

Overnight Stay.
Multi-day tours with
real-world policies.

Stay-out decisions are part of the optimization, not a post-processing step.

Field service across large regions, long-haul deliveries, multi-day campaigns. These problems cannot be solved with day trips. A resource needs to stay overnight at a hotel, depot, or partner hub and continue the next morning from that position.

Most optimizers treat this as an afterthought: run the optimizer, then manually split the result into days. JOpt.TourOptimizer handles overnight stays as a first-class planning decision. The optimizer decides where to stay, when to return home, and how to sequence multi-day tours. All within the same optimization that handles routing, time windows, and capacity.

Per-day control. Distance and time thresholds. Consecutive-night limits. Mandatory recovery periods. Deeply productized, not bolted on.

Per-shift
Stay allowed/forbidden per day
Policy-driven
Distance + time thresholds
Compliant
Consecutive nights + recovery
Day trips do not cover
the real world.

A technician servicing customers across a 500 km region cannot return home every evening. A delivery driver on a multi-day tour across Europe needs to sleep somewhere between stops. A healthcare worker covering rural districts spends more time driving home than caring for patients if forced into single-day routes.

Without native overnight support, the optimizer either produces infeasible plans (working hours exceeded), drops distant nodes (never visited), or forces artificially short routes that waste capacity. The workaround is manual: run the optimizer for single days, then stitch the results together by hand. This loses the joint optimization benefit and ignores the cost trade-off between returning home and staying out.

JOpt integrates the stay decision into the optimization. The optimizer weighs the cost of a hotel night against the cost of deadhead travel home. It selects the best overnight position from designated stay nodes. And it enforces every policy rule automatically.

“Whether a resource is allowed to stay outside is a function of the day and the resource itself. The rule set can be adjusted meticulously. For example, the resource can be allowed to have a maximum of two overnight stays per week, whereas Mondays and Fridays are not allowed.”

JOpt.TourOptimizer Special Features Documentation
Three layers of control.
One integrated decision.

Overnight stays in JOpt are controlled through three complementary mechanisms. Per-day allowance on WorkingHours determines the calendar rules. A distance/time policy prevents unnecessary stays close to home. And consecutive-night limits with recovery periods enforce employee wellbeing and regulatory compliance.

Stay nodes are designated positions where the resource can end its day: hotels, depots, service bases, or safe parking areas. The optimizer selects the best stay node based on the multi-day plan. If staying out is not justified, the resource returns home.

The per-day control is at the WorkingHours level, not the resource level. Monday can allow stays, Friday can forbid them. A resource with six working days can have any combination of stay-enabled and stay-disabled days. Changing the rule is a data update, not a model change.

The distance/time policy adds operational realism. A threshold of 100 km or 2 hours driving time back to the home location means the optimizer will not book a hotel for a driver working 30 minutes from home. It will consider staying out only when the connection home genuinely justifies it.

What manual splitting misses

Splitting a multi-day result by hand loses the joint optimization. The optimizer cannot trade off "stay one more night to serve three additional nodes" against "return home and start fresh tomorrow." With native overnight support, this trade-off is evaluated automatically across every candidate solution.

Opt-in by design

Every WorkingHours entry is not available for stay by default. You must explicitly enable it. This prevents accidental overnight assignments and makes the configuration auditable. Overnight stays appear in the plan only when consciously enabled and justified by the policy.

Deeply productized

Overnight stay in JOpt is not a simple "open route" toggle. It is a policy-driven system with multiple control surfaces that cover the real operational requirements of field service, transport, and healthcare.

Basic multi-day supportJOpt overnight stay
× "Open route" flag, resource ends anywhere Designated stay nodes (hotels, depots)
× Stay always or never Per-day control via WorkingHours
× No distance/time threshold Policy: min distance + min driving time home
× No consecutive-night limit Max nights in a row + mandatory recovery
× Manual day splitting Jointly optimized with routing

Where this matters

Field service across large territories. Long-haul transport with EU driver rest regulations. Healthcare workers in rural districts. Seasonal campaign teams deployed for weeks. Any operation where the cost of returning home exceeds the cost of staying out.

Compliance built in

Consecutive-night limits and mandatory recovery periods model labor regulations natively. The optimizer enforces them as part of the search, not as a post-hoc check. If a plan violates the recovery rule, it is never produced. This is the same architectural approach JOpt uses for hard constraints throughout the engine.

See it in action.

Run OvernightStayExample.java. Watch the optimizer split a Europe-wide tour across multiple days, select hotel positions, and enforce consecutive-night recovery rules.

Documentation  ·  Contact  ·  GitHub