Merconiq provides native on-device demand forecasting built into the platform. This document specifies the runtime architecture, algorithm implementations, configuration limits, and chronological evaluation methods.
The production Docker image targets both linux/amd64 and linux/arm64. Merconiq supports two forecasting engines:
managed-moving-average (Default):
ssa (Singular Spectrum Analysis via ML.NET):
Microsoft.ML.TimeSeries.Forecasting is enabled by default. To disable it, set Forecasting:Enabled=false (or Forecasting__Enabled=false in environment variables). When disabled:
Forecast requests are strictly bounded by configuration to prevent resource exhaustion and unbounded queries:
| Configuration Setting | Default | Supported Range | Description and Invariants |
|---|---|---|---|
Forecasting:Enabled |
true |
true / false |
Master toggle. When false, endpoints return HTTP 503 and background work is halted. |
Forecasting:Implementation |
managed-moving-average |
managed-moving-average, ssa |
Engine selection. Validated on startup. |
Forecasting:MaxForecastHorizonDays |
90 days | 1–365 days | Maximum forecast horizon. Requests requesting beyond this limit return an HTTP 400 validation error (never silently clamped). |
Forecasting:MaxHistoricalDays |
365 days | 5–3,650 days | Inclusive historical calendar window ending at UTC today. |
Forecasting:MaxHistoricalTransactionsPerForecast |
50,000 | 1–250,000 | Maximum matching sell transactions read per forecast. If the limit is exceeded, the request is rejected with HTTP 400 rather than truncated. |
Forecasting:MaxItemsPerAllItemsForecast |
250 | 1–2,500 | Tenant-filtered item catalog cap for bulk all-item forecast queries. Rejects requests exceeding the limit with HTTP 400. |
Every forecast response explicitly returns audit metadata:
ForecastingImplementation: (managed-moving-average or ssa).ForecastingImplementationVersion: 1.0.0 for managed, or the loaded assembly version for SSA.DataWindowStartDate / DataWindowEndDate: The exact historical observation window used.ConfiguredLimits: The active configuration thresholds.KnownLimitations: Algorithmic caveats (e.g. absence of lost-sales tracking, zero-sale gap handling).StockTransactionType.Sell). Receipts, purchase orders, reservations, and internal warehouse transfers do not constitute demand.The fixture ForecastingEvaluation_UsesChronologicalHoldoutAndReportsBaseline in tests/Merconiq.Tests/Core/Services/DemandForecastServiceTests.cs validates forecasting behavior using an 8-day chronological dataset:
| Split | Values | Count | Role |
|---|---|---|---|
| Training Set | 4, 6, 8, 10, 12 | 5 | Observed historical inputs |
| Holdout Set | 14, 16, 18 | 3 | Future observations evaluated strictly after prediction |
8.12.To execute the forecasting test suite:
dotnet test tests/Merconiq.Tests/Merconiq.Tests.csproj \
--configuration Release \
--filter "FullyQualifiedName~DemandForecastServiceTests"