---
title: 'SmartAPS: Conversational APS Integration'
url: https://www.emergentmind.com/topics/smartaps
type: topic
---

# SmartAPS: Conversational APS Integration

SmartAPS is a conversational system that integrates advanced planning system (APS) solvers with tool-augmented large language models (LLMs) to facilitate natural language operations management. It provides planners with an intuitive chat-based interface to query information, perform counterfactual reasoning, receive operational recommendations, and execute scenario analyses without the ongoing need for consultant-driven customization. By combining modular tool abstraction, embedding-based retrieval, and LLM-driven dialogue, SmartAPS enables direct, flexible, and accessible interaction with sophisticated optimization models and analytics [2507.17927].

## 1. System Architecture

The SmartAPS framework encapsulates an APS solver using a three-module, tool-augmented LLM pipeline. The data path can be depicted as:

User (Planner)  
↔ Chat UI (Chainlit)  
↔ Conversation Manager  
↔ Tool Retriever  
↔ Tool Manager  
↔ APS & Data/Models  
↔ OptVerse AI Solver

**Conversation Manager:**  
Built on a decoder-only LLM (Mistral-7B-Instruct), this component parses user intent classifying utterances as either “casual” or “operations planning” and refines raw tool outputs into human-readable text.

**Tool Retriever:**  
Utilizes the BGE-LARGE-EN-V1.5 embedding model to encode natural-language "contracts" (tool descriptions and example queries) and user inputs, performing a nearest-neighbor search (squared L₂ distance) in ChromaDB to select the most relevant tool API.

**Tool Manager:**  
Given the selected tool’s JSON contract (name, signature, I/O schema), the tool manager:
- Prompts the LLM to identify the relevant APS model (e.g., a production planning LP/MIP)
- Extracts or infers required input parameters, issuing clarifying prompts if necessary
- Executes programmatic tool API calls (often backed by the OptVerse AI Solver)
- Returns raw output for post-processing

**Answer Composition:**  
The conversation manager combines the original user query, the tool’s natural-language output template, and the accumulated chat history into a final, human-readable answer that may include textual, tabular, or graphical information rendered by Chainlit.

## 2. Optimization Model Formulations and Algorithms

SmartAPS exposes typical production-planning models via mathematical optimization, most commonly as linear or mixed-integer programs (LP/MIP). The canonical model solves for:

**Decision Variables:**  
- $x_{p,t}\geq 0$: production quantity of product $p$ in period $t$  
- $I_{p,t}\geq 0$: end-of-period inventory of product $p$

**Objective:**  
Minimize total production and inventory cost:
\[
\min_{x,I} \sum_{t,p} \left( c_p\,x_{p,t} + h_p\,I_{p,t} \right)
\]

**Constraints:**  
1. Capacity:  
   $\sum_{p} a_{r,p}\,x_{p,t} \leq \mathrm{Cap}_{r,t} \quad \forall r,t$  
2. Inventory balance and demand satisfaction:  
   \[
   I_{p,t-1} + x_{p,t} - D_{p,t} = I_{p,t} \quad \forall p,t
   \]
3. Nonnegativity (and integrality as required)

**Optimization Solver:**  
All problems are solved by Huawei Cloud’s OptVerse AI Solver, a parallel MIP engine using branch-and-bound and learning-based primal heuristics.

**Counterfactual ("Why-not") Formulation:**  
For infeasible or restricted queries, the APS solves a feasibility-relaxation model introducing slack variables $s_i$:
\[
\min_{x,s} \sum_i w_i s_i \quad \text{s.t.} \quad A x \geq b - s,\quad x \in \mathcal{X},\; s \geq 0
\]
The minimal slack vector identifies bottlenecks, which the LLM verbalizes in diagnostic form.

## 3. Natural Language and Optimization Task Translation

**Intent Detection:**  
Each user utterance is categorized as either "CASUAL_CONVERSATION" or "OPERATIONS_PLANNING" through a targeted LLM prompt.

**Tool Selection and Parameter Extraction:**  
The tool retriever locates the most relevant API/tool by embedding-based similarity search. The tool manager prompt instructs the LLM to fill in all required input fields (model ID, date, quantity, location) as JSON, inferring missing parameters where possible.

**Response Refinement:**  
Upon receiving raw output (e.g., JSON tables or scalars), a post-processing LLM prompt merges tool results with context, providing planner-centric summaries and recommendations such as:
>If Plant B receives 100 kg of rubber on 2024-04-17, your total daily tire output increases by 15% (from 2500 to 2875 units).

## 4. Feature Set and Operational Capabilities

SmartAPS supports a range of operations management tasks through natural language:

- **Counterfactual Reasoning (“Why-not”):**  
  Explains infeasibilities, identifies bottlenecks, and offers actionable mitigations (e.g., “add an overtime shift on Apr 9 or source raw material earlier” for deadline failures).
- **Scenario Analysis (“What-if”):**  
  Simulates alternative scenarios by modifying input data and re-computing operational outcomes, returning changes in production, inventory, or late orders.
- **Plan Comparison:**  
  Generates side-by-side tabular or graphical comparisons of different planning outcomes, emphasizing deltas in production, costs, and bottleneck utilization.
- **Recommendation Generation:**  
  Moves beyond numerical output to generate operationally actionable guidance (e.g., shifting production or delaying non-critical items).

## 5. Performance and Practical Impact

**Tool Retrieval Accuracy:**  
- Top-1: ≈94%  
- Top-3: ≈99%  
  (on a held-out set of 150 annotated queries)

**Case Study (Huawei Production Planners):**
- Deployment in real-world environments demonstrated that planners accomplished root-cause analysis and scenario testing in hours rather than the previous 1–2 days required with traditional consultant-driven workflows.
- “Why-not” and “What-if” analyses contributed the most to time-savings.

**Adoption:**  
Positive feedback was reported from both end planners and operations research consultants, with ongoing integration into daily operations management tools.

## 6. Tool Abstraction, Customization, and Maintenance

All APS-specific logic is encapsulated as “tools” with machine-readable contracts specifying description, examples, function signature, and input/output schema:

| Customization Step          | Description                                                                          | Significance                                       |
|----------------------------|--------------------------------------------------------------------------------------|----------------------------------------------------|
| Write new API/microservice | Implement endpoint for new or modified APS logic                                     | Decouples operational models from LLM prompts      |
| Define NL contract         | Express tool description/examples in ChromaDB                                        | Enables retrieval by embedding-based similarity     |
| Re-embedding at startup    | Automatically encodes new/updated contracts                                          | Simplifies onboarding and maintenance              |

No LLM prompt re-engineering is required when tools are added or updated. An “unsupported-query” sub-agent flags unmatched queries, drafting API contracts for human-in-the-loop review, thereby reducing repetitive customization overhead and lowering long-term maintenance costs.

## 7. Significance and Outlook

SmartAPS demonstrates a modular, code-free approach to blending conversational AI and traditional APS solvers, dramatically reducing the effort required for operations planners to access, configure, and leverage optimization analytics. This design lowers entry barriers and consulting dependence while supporting advanced planning, counterfactual analysis, and scenario-driven recommendation, supporting ongoing customization with minimal engineering intervention [2507.17927].

Source: https://www.emergentmind.com/topics/smartaps