Skip to content

JobSolution

The JobSolution class represents the result of how a specific job was handled in the final optimized route plan. It links the job to its assigned agent and shows the actions required to complete it.

This class is useful for querying job-level execution details after optimization — such as which agent performed the job, when, and through which actions.


Purpose

Use JobSolution to:

  • Inspect how and when a job was executed
  • Determine which agent handled the job
  • Access detailed route actions and assignment results
  • Analyze job assignment distribution in a multi-agent scenario

Constructor

new JobSolution(raw: JobSolutionData)

Creates a new JobSolution instance from raw result data. Throws an error if no data is provided.


Methods

Method Description
getRaw() Returns the internal JobSolutionData object
getAgentId() Returns the id of the agent that handled the job
getAgent() Returns the full AgentSolution instance for the assigned agent
getJob() Returns the original Job definition that was assigned
getActions() Returns an array of RouteAction objects showing what steps were taken to complete the job

Example

const jobPlan = new JobSolution(data);

console.log("Handled by agent:", jobPlan.getAgentId());

const job = jobPlan.getJob();
const actions = jobPlan.getActions();

You can use this to group or filter completed jobs by agent, analyze performance, or visualize job execution across a timeline.