Skip to main content
function parseSolverResponse(response): SolverResult;
Extracts shift assignments from solver response. Parses variable names matching the pattern assign:${employeeId}:${patternId}:${day} and returns assignments where the variable value is 1 (true).

Parameters

response
required
The solver response containing variable values

Returns

SolverResult Parsed schedule result with assignments IDs are validated by ModelBuilder to not contain colons, ensuring unambiguous parsing.

Example

const response = await client.solve(request);
const result = parseSolverResponse(response);

if (result.status === "OPTIMAL" || result.status === "FEASIBLE") {
  for (const assignment of result.assignments) {
    console.log(`${assignment.employeeId} works ${assignment.shiftPatternId} on ${assignment.day}`);
  }
}