<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Datalaria</title>
    <description>The latest articles on DEV Community by Datalaria (@datalaria).</description>
    <link>https://dev.to/datalaria</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F12018%2Fc60f0d32-39e9-4c8d-aa46-a1a9497fbfcd.png</url>
      <title>DEV Community: Datalaria</title>
      <link>https://dev.to/datalaria</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/datalaria"/>
    <language>en</language>
    <item>
      <title>Clarity AI: How Rebeca Minguela and AI Are Redefining and Quantifying Financial Sustainability</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 03 Apr 2026 08:11:46 +0000</pubDate>
      <link>https://dev.to/datalaria/clarity-ai-how-rebeca-minguela-and-ai-are-redefining-and-quantifying-financial-sustainability-2na7</link>
      <guid>https://dev.to/datalaria/clarity-ai-how-rebeca-minguela-and-ai-are-redefining-and-quantifying-financial-sustainability-2na7</guid>
      <description>&lt;p&gt;In the intersection between cutting-edge technological innovation and global regulatory pressure, the efficient allocation of capital towards sustainable goals has become the most complex macroeconomic challenge of the 21st century. For decades, this effort has been burdened by analog methodologies: traditional rating agencies that relied on the subjective judgments of human analysts to issue opaque assessments on corporate performance. This "black box" created a profound disconnect with reality and left the doors wide open for the dreaded &lt;em&gt;greenwashing&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In this landscape of informational chaos, &lt;strong&gt;Clarity AI&lt;/strong&gt; was born in 2017—a technology platform with a disruptive foundational premise: to leverage Artificial Intelligence (AI), Machine Learning, and Big Data to transform sustainability into a quantifiable, auditable, and globally scalable science. Behind this massive architectural milestone is the Spanish engineer and entrepreneur, &lt;strong&gt;Rebeca Minguela&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25zet95fx7bu27hibz0b.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25zet95fx7bu27hibz0b.PNG" alt="Image of Logo of Clarity" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Founder’s Profile: Technical Rigor and Global Vision
&lt;/h3&gt;

&lt;p&gt;The unprecedented success of Clarity AI is inseparable from Minguela’s trajectory. Born in Cuéllar (Spain), she forged a mindset geared toward absolute precision through her honors degrees in &lt;strong&gt;Telecommunications Engineering&lt;/strong&gt; from the Universidad Politécnica de Madrid (UPM) and the University of Stuttgart. Her early professional years in high-demand environments, such as the German Space Agency and Siemens, cemented her zero-tolerance for systemic failures.&lt;/p&gt;

&lt;p&gt;She subsequently rounded out her analytical profile with an MBA from Harvard Business School, venturing into the insular ecosystem of private equity with firms like Bain Capital. It was there that she identified the systemic flaw: capital flowed based on corporate narratives because there were no tools to objectively measure the true impact of investment portfolios.&lt;/p&gt;

&lt;p&gt;Backed by her proven entrepreneurial capacity (she founded the successful startup Blink Booking, which was acquired by Groupon within 18 months) and her experience leading the digital transformation at Banco Santander, Minguela conceived Clarity AI to solve this massive bottleneck.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Technological Solution: From Opinion to Computational Evidence
&lt;/h3&gt;

&lt;p&gt;Clarity AI shatters the analog paradigm by pioneering an &lt;em&gt;API-first&lt;/em&gt; and &lt;em&gt;AI-native&lt;/em&gt; approach. Instead of armies of people filling out annual spreadsheets, Clarity AI’s platform deploys complex &lt;strong&gt;Natural Language Processing (NLP)&lt;/strong&gt; and &lt;strong&gt;Machine Learning&lt;/strong&gt; algorithms that ingest and process tens of millions of data points bi-weekly.&lt;/p&gt;

&lt;p&gt;These engines consume regulatory reports, financial news, NGO databases, and even data from satellite remote sensing, substituting subjective "Ratings" with hyper-granular "Scores". Within the platform, 100% of the information—from a company's gender pay gap to its carbon-equivalent emissions—is mathematically traceable back to its original primary source, providing the investor with the highly sought-after "Explainable AI" (XAI).&lt;/p&gt;

&lt;p&gt;Furthermore, to mitigate the chronic lack of information in private or emerging markets, Clarity AI's data scientists employ &lt;strong&gt;parametric inference models&lt;/strong&gt;. Through complex predictive proxy triangulations, they successfully estimate hidden impacts (such as elusive Scope 3 emissions), effectively tripling the coverage of the financial universe and warding off enormous legal risks for asset managers.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/01XEVhtRV9Q"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Institutional Backing and Retail Reach
&lt;/h3&gt;

&lt;p&gt;The architectural superiority of this &lt;strong&gt;Amazon Web Services (AWS)&lt;/strong&gt;-based ecosystem has dazzled global venture capital, attracting over &lt;strong&gt;$335 million in funding&lt;/strong&gt; from giants such as the SoftBank Vision Fund, Seaya Ventures, and, above all, &lt;strong&gt;BlackRock&lt;/strong&gt;. The deep and native integration of Clarity AI into Aladdin (BlackRock's omnipotent operating system) definitively established the Spanish firm as the inescapable backbone of global sustainable finance.&lt;/p&gt;

&lt;p&gt;However, Minguela's vision stretched far beyond Wall Street. In 2025, Clarity AI strategically acquired the Berlin-based fintech &lt;strong&gt;ecolytiq&lt;/strong&gt; in a key cross-border operation, simultaneously establishing a powerful synergy with the multinational payments giant &lt;strong&gt;Visa&lt;/strong&gt;. This move scaled the AI down to the citizen's pocket: inserting "Sustainability-as-a-Service" technology directly into retail banking applications (such as HSBC Kinetic). Now, advanced algorithms educate consumers in real time about the carbon footprint of their daily purchases, enabling automated micro-donations and channeling domestic capital toward the climate transition.&lt;/p&gt;

&lt;h3&gt;
  
  
  The 2026 Horizon: SFDR 2.0 and the "Verification Tax"
&lt;/h3&gt;

&lt;p&gt;Despite its dominant position—unanimously recognized by analysts like Forrester—the future poses colossal challenges for financial planning systems.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Global Regulatory Divergence&lt;/strong&gt;: While Europe prepares the draconian framework of SFDR 2.0 (which threatens to re-categorize 40% of current "green funds" if they fail to meet stricter metrics), the United States grapples with a tense socio-political "ESG Backlash". Clarity's algorithms will have to simultaneously navigate contradictory jurisdictions without service friction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The "Verification Tax"&lt;/strong&gt;: With the massive deployment of GenAI and LLMs, the risk of systematic "hallucinations" (the swift propagation of synthetic errors rooted in false data) threatens the global economy. Clarity AI's competitive advantage is no longer merely the raw capacity to process information, but an &lt;strong&gt;absolute algorithmic hygiene&lt;/strong&gt; that keeps its Scores unassailable against government fines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Thermodynamic Paradox&lt;/strong&gt;: A fascinating challenge. The immense neural networks required to monitor the climate consume vast amounts of electricity (often from non-renewable sources) and millions of liters of fresh water for cooling. Clarity AI has actively advocated for instituting transparent "Responsible AI" frameworks, ensuring that the technological cure does not end up devouring the very resources it aims to protect.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The global consolidation of Clarity AI—and the exemplary technical leadership career forged by Rebeca Minguela—proves an irrevocable phenomenon: transformational changes in our global survival ecosystem are not achieved through sheer commercial goodwill, but by building elastic, mathematically infallible codebase infrastructures.&lt;/p&gt;

&lt;p&gt;Clarity AI has not merely created outstanding software; it has grown to become the de facto tectonic plate upon which planetary sustainability orbits, is legislated, and is arbitrated. Faced with the inorganic chaos of Big Data and the incessant labyrinth of global regulations, Minguela's mathematics have, once again, conquered the fog.&lt;/p&gt;




&lt;h4&gt;
  
  
  Sources of Interest:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://clarity.ai/" rel="noopener noreferrer"&gt;&lt;strong&gt;Clarity AI&lt;/strong&gt;: Official Website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.weforum.org/people/rebeca-minguela/" rel="noopener noreferrer"&gt;&lt;strong&gt;World Economic Forum&lt;/strong&gt;: Rebeca Minguela's Profile&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.forrester.com/report/the-forrester-wave-tm-esg-data-and-analytics-providers-q3-2024/RES181056" rel="noopener noreferrer"&gt;&lt;strong&gt;The Forrester Wave™&lt;/strong&gt;: ESG Data And Analytics Providers, Q3 2024&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://clarity.ai/in-the-news/clarity-ai-named-a-leader-in-esg-data-and-analytics-for-investors-and-corporates/" rel="noopener noreferrer"&gt;&lt;strong&gt;Clarity AI In The News&lt;/strong&gt;: Clarity AI Named a Leader in ESG Data and Analytics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/startups/learn/how-clarity-ai-uses-ai-and-ml-on-aws-to-quantify-sustainability" rel="noopener noreferrer"&gt;&lt;strong&gt;AWS Startups&lt;/strong&gt;: How Clarity AI uses AI and ML on AWS to quantify sustainability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://finovate.com/clarity-ai-acquires-sustainability-fintech-ecolytiq/" rel="noopener noreferrer"&gt;&lt;strong&gt;Finovate&lt;/strong&gt;: Clarity AI Acquires Sustainability Fintech ecolytiq&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://startupsreal.com/softbank-and-fifth-wall-invest-in-sustainability-tech-firm-clarity-ai-a-seaya-ventures-company/" rel="noopener noreferrer"&gt;&lt;strong&gt;Startups Real&lt;/strong&gt;: SoftBank and Fifth Wall invest in sustainability Tech firm Clarity AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://clarity.ai/research-and-insights/ai/is-artificial-intelligence-in-investing-the-future-5-key-questions-answered-for-investors/" rel="noopener noreferrer"&gt;&lt;strong&gt;Clarity AI Research&lt;/strong&gt;: Is Artificial Intelligence in Investing the Future?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>analytics</category>
      <category>machinelearning</category>
      <category>startup</category>
    </item>
    <item>
      <title>Clarity AI: Cómo Rebeca Minguela y la IA Están Redefiniendo y Cuantificando la Sostenibilidad Financiera</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 03 Apr 2026 08:08:04 +0000</pubDate>
      <link>https://dev.to/datalaria/clarity-ai-como-rebeca-minguela-y-la-ia-estan-redefiniendo-y-cuantificando-la-sostenibilidad-3bdf</link>
      <guid>https://dev.to/datalaria/clarity-ai-como-rebeca-minguela-y-la-ia-estan-redefiniendo-y-cuantificando-la-sostenibilidad-3bdf</guid>
      <description>&lt;p&gt;En la intersección entre la innovación tecnológica puntera y la presión regulatoria global, la asignación eficiente del capital hacia fines sostenibles se ha convertido en el desafío macroeconómico más complejo del siglo XXI. Durante décadas, este esfuerzo ha estado lastrado por metodologías analógicas: agencias de calificación tradicionales que dependían de los juicios subjetivos de analistas humanos para emitir dictámenes opacos sobre el desempeño corporativo. Esta "caja negra" generaba una profunda desconexión con la realidad y abría las puertas de par en par al temido &lt;em&gt;greenwashing&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;En este escenario de caos informativo, nace en 2017 &lt;strong&gt;Clarity AI&lt;/strong&gt;, una plataforma tecnológica con una premisa fundacional disruptiva: utilizar la Inteligencia Artificial (IA), el Machine Learning y el Big Data para transformar la sostenibilidad en una ciencia cuantificable, auditable y escalable globalmente. Y detrás de este gigantesco hito arquitectónico se encuentra la ingeniera y emprendedora &lt;strong&gt;Rebeca Minguela&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25zet95fx7bu27hibz0b.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25zet95fx7bu27hibz0b.PNG" alt="Imagen del logo Clarity" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  El Perfil de la Fundadora: Rigor Técnico y Visión Global
&lt;/h3&gt;

&lt;p&gt;El éxito sin precedentes de Clarity AI es inseparable de la trayectoria de Minguela. Nacida en Cuéllar (España), forjó una mentalidad orientada a la precisión absoluta mediante sus estudios con matrícula de honor en &lt;strong&gt;Ingeniería de Telecomunicaciones&lt;/strong&gt; por la Universidad Politécnica de Madrid (UPM) y la Universidad de Stuttgart. Sus primeros años profesionales en entornos de alta exigencia, como la Agencia Espacial Alemana y Siemens, cimentaron su tolerancia cero a los fallos sistémicos.&lt;/p&gt;

&lt;p&gt;Posteriormente, completó su perfil analítico con un MBA en la Harvard Business School, adentrándose en el hermético ecosistema del capital inversión con firmas como Bain Capital. Fue allí donde identificó la falla sistémica: el capital fluía basándose en narrativas corporativas porque no existían herramientas para medir objetivamente el verdadero impacto de las carteras de inversión.&lt;/p&gt;

&lt;p&gt;Respaldada por su demostrada capacidad emprendedora (fundó la exitosa &lt;em&gt;startup&lt;/em&gt; Blink Booking, adquirida por Groupon en 18 meses) y su experiencia liderando la transformación digital en Banco Santander, Minguela concibió Clarity AI para solucionar este inmenso cuello de botella.&lt;/p&gt;

&lt;h3&gt;
  
  
  La Solución Tecnológica: De la Opinión a la Evidencia Computacional
&lt;/h3&gt;

&lt;p&gt;Clarity AI rompe el paradigma analógico siendo pionera en un enfoque &lt;em&gt;API-first&lt;/em&gt; y &lt;em&gt;AI-native&lt;/em&gt;. En lugar de ejércitos de personas rellenando hojas de cálculo anuales, la plataforma de Clarity AI despliega complejos algoritmos de &lt;strong&gt;Procesamiento de Lenguaje Natural (NLP)&lt;/strong&gt; y &lt;strong&gt;Machine Learning&lt;/strong&gt; que ingieren y procesan quincenalmente decenas de millones de puntos de datos. &lt;/p&gt;

&lt;p&gt;Estos motores consumen informes regulatorios, noticias financieras, bases de datos de ONGs e incluso datos procedentes de teledetección satelital, sustituyendo las subjetivas "calificaciones" (Ratings) por "puntuaciones" (Scores) hiper-granulares. En la plataforma, el 100% de la información —desde la brecha salarial de género de una empresa hasta sus emisiones de carbono equivalentes— es matemáticamente rastreable hasta su fuente primaria original, dotando al inversor de la tan ansiada "explicabilidad predictiva" (XAI).&lt;/p&gt;

&lt;p&gt;Además, para paliar la crónica falta de información en mercados privados o emergentes, los científicos de datos de Clarity AI emplean &lt;strong&gt;modelos paramétricos de inferencia&lt;/strong&gt; que logran estimar, mediante complejas triangulaciones proxy, el impacto oculto (como las emisiones limitantes de Alcance 3), triplicando la cobertura efectiva del universo financiero y conjurando enormes riesgos legales para las gestoras.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/01XEVhtRV9Q"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  El Respaldo Institucional y la Capilaridad Minorista
&lt;/h3&gt;

&lt;p&gt;La superioridad arquitectónica de este ecosistema basado en &lt;strong&gt;Amazon Web Services (AWS)&lt;/strong&gt; ha deslumbrado al capital riesgo mundial, atrayendo más de &lt;strong&gt;335 millones de dólares en financiación&lt;/strong&gt; de gigantes como el SoftBank Vision Fund, Seaya Ventures y, sobre todo, &lt;strong&gt;BlackRock&lt;/strong&gt;. La profunda y nativa integración de Clarity AI dentro de Aladdin (el omnipotente sistema operativo de BlackRock) consagró a la empresa española como la ineludible capa base (backbone) de las finanzas globales.&lt;/p&gt;

&lt;p&gt;Sin embargo, el objetivo de Minguela iba mucho más allá de Wall Street. En 2025, Clarity AI adquirió estratégicamente la &lt;em&gt;fintech&lt;/em&gt; berlinesa &lt;strong&gt;ecolytiq&lt;/strong&gt; en una operación transfronteriza clave, estableciendo a su vez una potente sinergia con la multinacional &lt;strong&gt;Visa&lt;/strong&gt;. Este movimiento permitió escalar la IA hasta el bolsillo del ciudadano: insertando tecnología de "Sustainability-as-a-Service" directamente en aplicaciones de banca minorista (como HSBC Kinetic). Ahora, algoritmos avanzados educan en tiempo real al consumidor sobre la huella de carbono de sus compras diarias, permitiendo micro-donaciones automatizadas y canalizando el capital doméstico hacia la transición climática.&lt;/p&gt;

&lt;h3&gt;
  
  
  El Horizonte 2026: SFDR 2.0 y el "Impuesto de Verificación"
&lt;/h3&gt;

&lt;p&gt;A pesar de su posición dominante, reconocida unánimemente por analistas como Forrester, el futuro plantea colosales desafíos para los sistemas S&amp;amp;OP (Sales and Operations Planning) financieros.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;La Divergencia Regulatoria Mundial&lt;/strong&gt;: Mientras Europa prepara el draconiano marco de la SFDR 2.0 (que amenaza con re-categorizar al 40% de los actuales "fondos verdes" si no cumplen métricas más estrictas), Estados Unidos lidia con un tenso "ESG Backlash" socio-político. Los algoritmos de Clarity tendrán que navegar simultáneamente por jurisdicciones contradictorias sin fricciones de servicio.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;El "Impuesto de Verificación"&lt;/strong&gt;: Con el uso masivo de GenAI y LLMs, el riesgo de "alucinaciones" sistemáticas (la propagación veloz de errores sintéticos originados en datos falsos) amenaza a la economía global. La ventaja competitiva de Clarity AI ya no es la mera capacidad de procesar, sino la &lt;strong&gt;absoluta higiene algorítmica&lt;/strong&gt; que mantiene sus "Scores" inexpugnables frente a las multas gubernamentales.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;La Paradoja Termodinámica&lt;/strong&gt;: Un desafío fascinante. Las inmensas redes neuronales necesarias para monitorizar el clima consumen vastas cantidades de electricidad (a menudo no renovable) y millones de litros de agua dulce para su refrigeración. Clarity AI ha instado activamente a instaurar y transparentar normativas propias de Inteligencia Artificial Responsable (Responsible AI), asegurando que el remedio no acabe devorando los escasos recursos que trata de proteger.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Conclusión
&lt;/h3&gt;

&lt;p&gt;La consolidación mundial de Clarity AI —y la ejemplar carrera de liderazgo técnico forjada por Rebeca Minguela— demuestra un fenómeno irrevocable: los cambios transformacionales en el ecosistema global de supervivencia no se acometen mediante buena voluntad comercial, sino construyendo infraestructuras de código elásticas y matemáticas infalibles. &lt;/p&gt;

&lt;p&gt;Clarity AI no se ha limitado a crear un software sobresaliente; se ha convertido de facto en la placa tectónica sobre la que orbita, se legisla y se arbitra la sostenibilidad planetaria. Ante el caos inorgánico del Big Data y el incesante laberinto regulatorio mundial, las matemáticas de Minguela han vuelto a dominar la niebla.&lt;/p&gt;




&lt;h4&gt;
  
  
  Fuentes de Interés:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://clarity.ai/" rel="noopener noreferrer"&gt;&lt;strong&gt;Clarity AI&lt;/strong&gt;: Sitio Oficial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.weforum.org/people/rebeca-minguela/" rel="noopener noreferrer"&gt;&lt;strong&gt;World Economic Forum&lt;/strong&gt;: Perfil de Rebeca Minguela&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.forrester.com/report/the-forrester-wave-tm-esg-data-and-analytics-providers-q3-2024/RES181056" rel="noopener noreferrer"&gt;&lt;strong&gt;The Forrester Wave™&lt;/strong&gt;: ESG Data And Analytics Providers, Q3 2024&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://clarity.ai/in-the-news/clarity-ai-named-a-leader-in-esg-data-and-analytics-for-investors-and-corporates/" rel="noopener noreferrer"&gt;&lt;strong&gt;Clarity AI In The News&lt;/strong&gt;: Clarity AI Named a Leader in ESG Data and Analytics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/startups/learn/how-clarity-ai-uses-ai-and-ml-on-aws-to-quantify-sustainability" rel="noopener noreferrer"&gt;&lt;strong&gt;AWS Startups&lt;/strong&gt;: How Clarity AI uses AI and ML on AWS to quantify sustainability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://finovate.com/clarity-ai-acquires-sustainability-fintech-ecolytiq/" rel="noopener noreferrer"&gt;&lt;strong&gt;Finovate&lt;/strong&gt;: Clarity AI Acquires Sustainability Fintech ecolytiq&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://startupsreal.com/softbank-and-fifth-wall-invest-in-sustainability-tech-firm-clarity-ai-a-seaya-ventures-company/" rel="noopener noreferrer"&gt;&lt;strong&gt;Startups Real&lt;/strong&gt;: SoftBank and Fifth Wall invest in sustainability Tech firm Clarity AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://clarity.ai/research-and-insights/ai/is-artificial-intelligence-in-investing-the-future-5-key-questions-answered-for-investors/" rel="noopener noreferrer"&gt;&lt;strong&gt;Clarity AI Research&lt;/strong&gt;: Is Artificial Intelligence in Investing the Future?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>datascience</category>
      <category>news</category>
      <category>startup</category>
    </item>
    <item>
      <title>Nextail: Cómo la IA Prescriptiva de una Startup Española Está Derrotando a Excel en el Retail de Moda</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Tue, 31 Mar 2026 06:12:06 +0000</pubDate>
      <link>https://dev.to/datalaria/nextail-como-la-ia-prescriptiva-de-una-startup-espanola-esta-derrotando-a-excel-en-el-retail-de-59ck</link>
      <guid>https://dev.to/datalaria/nextail-como-la-ia-prescriptiva-de-una-startup-espanola-esta-derrotando-a-excel-en-el-retail-de-59ck</guid>
      <description>&lt;p&gt;En el competitivo universo del fast fashion, donde las tendencias nacen y mueren en semanas y una talla equivocada en la tienda equivocada puede significar la diferencia entre vender a precio completo o malvender en rebajas, hay una verdad incómoda que la industria ha tardado décadas en aceptar: &lt;strong&gt;las decisiones más críticas del negocio—qué enviar, a dónde y cuándo—se siguen tomando con hojas de cálculo, intuición y mapas mentales&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Esta es la historia de &lt;strong&gt;&lt;a href="https://nextail.co/" rel="noopener noreferrer"&gt;Nextail&lt;/a&gt;&lt;/strong&gt;, una startup madrileña fundada en 2014 por un equipo que conocía esa realidad desde dentro y decidió destruirla con matemáticas. Es el caso de estudio de cómo la analítica prescriptiva y la optimización estocástica están sustituyendo al Excel en una industria que mueve miles de millones.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjha3lctybzhnv85o88hr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjha3lctybzhnv85o88hr.png" alt="Nextail imagen" width="800" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  El Origen: Cuando Zara No Era Suficiente
&lt;/h3&gt;

&lt;p&gt;La génesis de Nextail está ligada directamente al epicentro del fast fashion global. &lt;strong&gt;Joaquín Villalba&lt;/strong&gt;, ingeniero industrial por la Universidad Politécnica de Valencia con un MBA por INSEAD, ejerció como Director de Logística Europea en &lt;strong&gt;Zara-Inditex&lt;/strong&gt;, donde supervisó operaciones para más de mil tiendas con un volumen de ventas superior a los 10.000 millones de dólares. Desde esa atalaya privilegiada, &lt;a href="https://medium.com/authority-magazine/the-future-of-retail-over-the-next-five-years-with-joaquin-villalba-ceo-of-nextail-713703af4310" rel="noopener noreferrer"&gt;Villalba analizó los cimientos del imperio de Amancio Ortega&lt;/a&gt; y llegó a una conclusión que definiría su carrera: el modelo logístico de Zara era revolucionario en su estructura, pero las decisiones diarias sobre qué enviar a cada tienda seguían dependiendo de la intuición humana.&lt;/p&gt;

&lt;p&gt;Los clientes se marchaban frustrados sin encontrar su talla. La causa no era falta de stock global, sino una distribución demasiado estática para reaccionar a las fluctuaciones micro-locales de la demanda. Villalba vio una oportunidad inmensa para llevar la agilidad del retail al siguiente nivel inyectando ciencia de datos e investigación operativa directamente en el núcleo del merchandising.&lt;/p&gt;

&lt;p&gt;Para materializar esta visión se asoció con &lt;strong&gt;Carlos Miragall&lt;/strong&gt;, un experto en finanzas corporativas con experiencia escalando startups desde cero hasta más de 150 empleados y levantando más de 60 millones de dólares en financiación, y con &lt;strong&gt;Javier Lafuente García&lt;/strong&gt; como CTO. &lt;a href="https://nextail.co/company" rel="noopener noreferrer"&gt;Juntos fundaron Nextail&lt;/a&gt; con una misión diáfana: &lt;strong&gt;democratizar la excelencia operativa del fast fashion mediante la precisión matemática&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  El Problema: La Explosión Combinatoria que Destruye a Excel
&lt;/h3&gt;

&lt;p&gt;Para entender por qué Nextail existe, hay que comprender un fenómeno matemático que los equipos de merchandising sufren cada día: la &lt;strong&gt;explosión combinatoria&lt;/strong&gt;. Un retailer de moda no toma decisiones agregadas. Cruza miles de productos (SKUs), multiplicados por varias tallas, distribuidos en cientos de tiendas, con actualizaciones necesarias varias veces por semana. El resultado: &lt;strong&gt;millones de puntos de decisión diarios&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Las hojas de cálculo colapsan. Literalmente. &lt;a href="https://nextail.co/resource/implementing-ai-driven-merchandising-tech-mark-scoullers-experience" rel="noopener noreferrer"&gt;Como señala Mark Scouller&lt;/a&gt;, veterano del merchandising en firmas como Next, New Look y Mountain Warehouse, los equipos lidian con archivos que se bloquean al superar el medio millón de filas, sostenidos por miles de macros que se rompen con cualquier cambio.&lt;/p&gt;

&lt;p&gt;Pero el colapso técnico es solo la superficie. Las consecuencias de negocio son devastadoras:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Agrupamiento forzado de tiendas (Store Clustering)&lt;/strong&gt;: Incapaces de calcular la demanda por tienda individual, los equipos &lt;a href="https://nextail.co/resource/assortment-planning-evolution-fashion-retail-spreadsheets-ai" rel="noopener noreferrer"&gt;agrupan establecimientos en categorías amplias&lt;/a&gt; y aplican distribuciones homogéneas. El resultado: sobrestock en unas tiendas y roturas en otras del mismo clúster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dependencia del "mapa mental"&lt;/strong&gt;: Las decisiones terminan basándose en la intuición subjetiva del buyer, un enfoque ciego ante cambios de tendencia intersemanales.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;El abandono de la "clase media"&lt;/strong&gt;: Los equipos dedican todo su tiempo a reponer los best-sellers agotados o liquidar los peores productos, abandonando completamente los mid-sellers y las tiendas de volumen medio. Como resume Scouller: son precisamente estos productos ignorados los que &lt;strong&gt;"drenan el margen de beneficio de forma silenciosa"&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rebajas destructivas&lt;/strong&gt;: La lentitud procedimental obliga a ejecutar campañas de markdowns masivas al final de temporada para liquidar inventario acumulado.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"El futuro del retail no cabe en Excel"&lt;/strong&gt; — Mark Scouller&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  La Solución: Un Cerebro Matemático que Piensa en Probabilidades
&lt;/h3&gt;

&lt;p&gt;La arquitectura de Nextail ataca el problema en tres capas perfectamente orquestadas dentro del proceso S&amp;amp;OP (Sales and Operations Planning):&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Datos "Listos para IA" (Data Ingestion &amp;amp; Optimization)
&lt;/h4&gt;

&lt;p&gt;La premisa fundacional es la pureza del dato. Los conjuntos de datos del retailer provienen de una miríada de sistemas inconexos (ERPs, WMS, POS). &lt;a href="https://help.nextail.co/en" rel="noopener noreferrer"&gt;La plataforma consolida y limpia toda esta información&lt;/a&gt; diariamente, corrigiendo fenómenos como el "stock fantasma" (donde el sistema indica existencias de prendas que han sido robadas o extraviadas), imputando valores nulos y generando una &lt;strong&gt;única fuente de verdad&lt;/strong&gt; que elimina la fricción entre departamentos.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Predicción Probabilística Hiperlocal
&lt;/h4&gt;

&lt;p&gt;A diferencia del forecasting tradicional que genera un único número de previsión, &lt;a href="https://nextail.co/solution/analytics" rel="noopener noreferrer"&gt;los algoritmos de Nextail construyen una distribución completa de probabilidad&lt;/a&gt; para cada combinación de SKU, tienda y día. No solo anticipan el volumen esperado; cuantifican la incertidumbre. Esa previsión se calibra con restricciones reales: capacidad de trastienda, logísticas de empaquetado, distribución de tallas por demografía del código postal, y mínimos de presentación visual.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Optimización Prescriptiva (El Motor MILP)
&lt;/h4&gt;

&lt;p&gt;Aquí reside la verdadera innovación. Cuando el modelo probabilístico dicta &lt;em&gt;cuánta&lt;/em&gt; demanda ocurrirá, &lt;em&gt;dónde&lt;/em&gt; y &lt;em&gt;cuándo&lt;/em&gt;, el sistema debe prescribir la acción operativa exacta. Para ello despliega algoritmos de &lt;strong&gt;Programación Lineal Entera Mixta (MILP)&lt;/strong&gt; combinados con optimización estocástica.&lt;/p&gt;

&lt;p&gt;En términos conceptuales, el motor resuelve una función objetivo que maximiza la probabilidad de venta a precio completo (full-price sell-through) de cada SKU en cada tienda, ponderada por el margen bruto, menos los costes logísticos de cada transferencia. Todo ello sujeto a restricciones infranqueables: conservación de inventario, espacio físico disponible, estándares estéticos de la marca, y coherencia en la distribución de curvas de tallas.&lt;/p&gt;

&lt;p&gt;El sistema evalúa miles de millones de permutaciones y decide: ¿es más rentable retener stock en el centro de distribución para proteger el e-commerce, o despacharlo de urgencia a una tienda con alta probabilidad inminente de rotura de stock?&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/xD5D943-888"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;El resultado no es un informe estático, sino una &lt;strong&gt;directiva de ejecución accionable&lt;/strong&gt; entregada a los sistemas ERP y WMS en minutos. La automatización libera &lt;a href="https://nextail.co/company/customer-impact" rel="noopener noreferrer"&gt;hasta el 75% del tiempo de los equipos de merchandising&lt;/a&gt; para reenfocarse en decisiones estratégicas.&lt;/p&gt;

&lt;h3&gt;
  
  
  Más Allá de la Asignación: El Rebalanceo Inteligente
&lt;/h3&gt;

&lt;p&gt;Una de las funcionalidades más disruptivas de Nextail es el &lt;strong&gt;&lt;a href="https://nextail.co/resource/5-benefits-ai-driven-inventory-rebalancing" rel="noopener noreferrer"&gt;rebalanceo de inventario entre tiendas&lt;/a&gt;&lt;/strong&gt; (Store Transfers). Cuando los productos se acercan al final de su ciclo de vida, la demanda se fragmenta: unas tiendas tienen exceso de tallas que nadie quiere, mientras otras necesitan exactamente esas tallas.&lt;/p&gt;

&lt;p&gt;Tradicionalmente, ese stock remanente iba directo a rebajas. Nextail hace lo contrario: el optimizador rastrea pares de tiendas origen-destino, calcula si el aumento de probabilidad de venta a precio completo justifica el coste logístico de la transferencia, y reagrupa activamente las tallas desparejadas en centros de demanda activa. Así, &lt;strong&gt;las rebajas dejan de ser un mal endémico&lt;/strong&gt; para convertirse en una herramienta de ultimísimo recurso.&lt;/p&gt;

&lt;h3&gt;
  
  
  El Impacto: ROI en 30 Días
&lt;/h3&gt;

&lt;p&gt;La analítica prescriptiva no sería relevante sin resultados. Los números de Nextail hablan con contundencia:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Métrica&lt;/th&gt;
&lt;th&gt;Impacto&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cobertura de inventario&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Reducción de hasta un &lt;strong&gt;30%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Roturas de stock&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Disminución de hasta un &lt;strong&gt;60%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ventas directas&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Incremento del &lt;strong&gt;5-10%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tiempo de merchandisers liberado&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hasta un &lt;strong&gt;75%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ROI demostrable&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;En los primeros &lt;strong&gt;30 días&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Marcas internacionales como &lt;strong&gt;Pepe Jeans&lt;/strong&gt;, &lt;strong&gt;River Island&lt;/strong&gt;, &lt;strong&gt;Guess&lt;/strong&gt;, &lt;strong&gt;&lt;a href="https://retailtechinnovationhub.com/home/2025/7/10/scotta-taps-nextail-ai-powered-technology-to-support-retailers-growth-across-stores-and-online" rel="noopener noreferrer"&gt;Scotta&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;Bimani&lt;/strong&gt;, &lt;strong&gt;Silbon&lt;/strong&gt; y &lt;strong&gt;Sports Emotion&lt;/strong&gt; han integrado la plataforma para superar los cuellos de botella de su escalado omnicanal. El caso de Pepe Jeans es particularmente ilustrativo: una marca con lead times de hasta seis meses que pasó de previsiones estáticas a una optimización dinámica capaz de adaptarse al consumidor en semanas.&lt;/p&gt;

&lt;h3&gt;
  
  
  La Trayectoria Financiera y la Transición de Liderazgo
&lt;/h3&gt;

&lt;p&gt;La cronología corporativa revela un patrón de crecimiento respaldado por la élite del capital riesgo europeo:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Ronda&lt;/th&gt;
&lt;th&gt;Fecha&lt;/th&gt;
&lt;th&gt;Cantidad (USD)&lt;/th&gt;
&lt;th&gt;Inversor(es) Principal(es)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Seed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2016&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.nautacapital.com/news-insights/nextail-raises-1-6m-investment-led-by-nauta-capital" rel="noopener noreferrer"&gt;$1.6M&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Nauta Capital&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Serie A&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Jun 2018&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.eu-startups.com/2018/06/madrid-based-nextail-raises-10-million-bring-artificial-intelligence-into-retailers-inventory-planning/" rel="noopener noreferrer"&gt;$10M&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Nauta Capital&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Inversión 2024&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Nov 2024&lt;/td&gt;
&lt;td&gt;&lt;a href="https://retailtechinnovationhub.com/home/2024/11/7/ai-powered-retail-technology-firm-nextail-announces-new-ceo-and-multi-million-euro-investment-from-current-investors" rel="noopener noreferrer"&gt;Multi-millonaria&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Inversores existentes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Tras una década liderando la visión del producto y posicionando la plataforma para automatizar más de &lt;strong&gt;mil millones de decisiones de inventario por temporada&lt;/strong&gt; en un parque de &lt;strong&gt;20.000 tiendas&lt;/strong&gt;, &lt;a href="https://retailtimes.co.uk/nextail-marks-a-decade-of-retail-transformation-with-new-ceo/" rel="noopener noreferrer"&gt;Joaquín Villalba orquestó una sucesión ejecutiva en 2024&lt;/a&gt;. Adoptó el rol de Embajador Corporativo—en línea con su reconocimiento como &lt;strong&gt;Pionero Tecnológico por el Foro Económico Mundial&lt;/strong&gt;—y cedió la dirección ejecutiva a &lt;strong&gt;Carlos Miragall&lt;/strong&gt;, cofundador y ex-CFO, para capitanear la compañía en la era de los LLMs y los sistemas agénticos.&lt;/p&gt;

&lt;p&gt;El reconocimiento institucional ha sido contundente: &lt;strong&gt;&lt;a href="https://nextail.co/press-release/best-fashion-retail-merchandising-platform-2025" rel="noopener noreferrer"&gt;Mejor Plataforma de Merchandising de Retail de Moda 2025&lt;/a&gt;&lt;/strong&gt; (EU Business News), &lt;strong&gt;triple victoria en los Just Style Excellence Awards 2025&lt;/strong&gt;, y reconocimiento reiterado como &lt;strong&gt;&lt;a href="https://nextail.co/press-release/retail-forecasting-allocation-replenishment-gartner-representative-vendor" rel="noopener noreferrer"&gt;Representative Vendor por Gartner&lt;/a&gt;&lt;/strong&gt; en sus guías de mercado de optimización retail.&lt;/p&gt;

&lt;h3&gt;
  
  
  La Montaña Sociológica: El Mayor Obstáculo No Es la Tecnología
&lt;/h3&gt;

&lt;p&gt;A pesar de la superioridad técnica, el mayor obstáculo para la adopción no es computacional—&lt;strong&gt;es humano&lt;/strong&gt;. &lt;a href="https://nextail.co/resource/dispellling-ai-magic-fashion-retail-mark-lewis" rel="noopener noreferrer"&gt;Como advierte Mark Lewis&lt;/a&gt;, estratega tecnológico del retail: &lt;em&gt;"La mayor barrera para el éxito de la IA en la moda es pura y exclusivamente una cuestión de mentalidad colectiva"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Existe una peligrosa falacia que percibe la IA como "magia oscura" incomprensible. Esto genera expectativas irreales en las directivas o un rechazo visceral por parte de los profesionales de merchandising que temen al dictamen de la "caja negra". Los retailers invierten millones en plataformas que terminan infrautilizadas porque no han reestructurado sus equipos ni invertido en formación.&lt;/p&gt;

&lt;p&gt;La clave, según Scouller, es entender que la IA &lt;em&gt;"no es magia oscura, sino lógica aplastante: procesamiento masivo de datos limpios y la aplicación iterativa de matemáticas a una escala y velocidad inhumanas"&lt;/em&gt;. Y el punto de inflexión corporativo se alcanza en un momento muy concreto: &lt;strong&gt;cuando el dolor de la ineficiencia supera a la inercia del confort operativo&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  El Futuro: IA Generativa, Agentes Autónomos y el Escudo Regulatorio ESPR
&lt;/h3&gt;

&lt;p&gt;La hoja de ruta de Nextail converge en tres fuerzas que definirán el retail de 2026:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Interfaz Conversacional con RAG&lt;/strong&gt;: La IA Generativa no reemplazará los motores de optimización MILP (los LLMs fallan en cálculo numérico masivo a coste eficiente). Su papel será actuar como &lt;strong&gt;capa de orquestación cognitiva&lt;/strong&gt;: un director comercial podrá interactuar con el cerebro matemático en lenguaje natural, pidiendo análisis de rentabilidad de un rebalanceo concreto y autorizando ejecuciones automáticas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Sistemas Multi-Agente de IA&lt;/strong&gt;: &lt;a href="https://www.deloitte.com/us/en/services/consulting/blogs/business-operations-room/llm-for-supply-chain-optimization.html" rel="noopener noreferrer"&gt;Gartner proyecta que para finales de 2026&lt;/a&gt;, más del 40% de las aplicaciones empresariales incorporarán agentes de IA. En el contexto del S&amp;amp;OP, un "enjambre" de agentes monitorizará autónomamente variables volátiles—clima, roturas en la cadena, viralidad de tendencias en redes sociales—y recalibrará el optimizador sin intervención humana.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. El Escudo ESPR&lt;/strong&gt;: El &lt;a href="https://nextail.co/resource/q2-2025-nextail-ai-fashion-retail-growth" rel="noopener noreferrer"&gt;marco regulatorio europeo ESPR 2026&lt;/a&gt; penalizará (incluso prohibirá) la destrucción de inventario textil no vendido. Los sobrantes ya no serán "costes hundidos" sino &lt;strong&gt;pasivos ambientales auditables&lt;/strong&gt;. En este contexto, la capacidad de Nextail para reducir la sobreproducción y minimizar leftovers deja de ser solo una ventaja financiera para convertirse en un requisito de supervivencia legal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusión: Las Matemáticas Ganan la Partida
&lt;/h3&gt;

&lt;p&gt;La historia de Nextail es la crónica de una industria que ha cruzado un punto de no retorno. La complejidad del retail omnicanal moderno ha superado definitivamente la capacidad humana de gestión manual. Las hojas de cálculo no son un inconveniente menor; son un &lt;strong&gt;riesgo sistémico&lt;/strong&gt; que drena silenciosamente los márgenes de beneficio.&lt;/p&gt;

&lt;p&gt;Nextail ha demostrado que la respuesta reside en la fusión de predicción probabilística, optimización estocástica y una cultura de datos limpia. Su viaje demuestra que, a veces, la revolución no llega con una idea completamente nueva, sino con la aplicación rigurosa de las matemáticas a un problema que todos daban por perdido.&lt;/p&gt;

&lt;p&gt;Como Villalba descubrió en los pasillos de Zare: la agilidad del futuro no se construye con intuición, sino con ecuaciones.&lt;/p&gt;




&lt;h4&gt;
  
  
  Fuentes de Interés:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nextail.co/" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: Plataforma de Ejecución de Merchandising para Moda&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.siliconrepublic.com/start-ups/nextail-retail-ai-analytics-platform-spain" rel="noopener noreferrer"&gt;&lt;strong&gt;Silicon Republic&lt;/strong&gt;: Nextail is bringing science to retail decision-making&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/authority-magazine/the-future-of-retail-over-the-next-five-years-with-joaquin-villalba-ceo-of-nextail-713703af4310" rel="noopener noreferrer"&gt;&lt;strong&gt;Authority Magazine (Medium)&lt;/strong&gt;: The Future of Retail, con Joaquín Villalba, CEO de Nextail&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/resource/implementing-ai-driven-merchandising-tech-mark-scoullers-experience" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: Implementando IA en el Merchandising - La experiencia de Mark Scouller&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/resource/assortment-planning-evolution-fashion-retail-spreadsheets-ai" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: De las hojas de cálculo a la IA en la planificación del surtido&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.eu-startups.com/2018/06/madrid-based-nextail-raises-10-million-bring-artificial-intelligence-into-retailers-inventory-planning/" rel="noopener noreferrer"&gt;&lt;strong&gt;EU-Startups&lt;/strong&gt;: Nextail raises $10M to bring AI into retailers' inventory planning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://retailtechinnovationhub.com/home/2024/11/7/ai-powered-retail-technology-firm-nextail-announces-new-ceo-and-multi-million-euro-investment-from-current-investors" rel="noopener noreferrer"&gt;&lt;strong&gt;Retail Tech Innovation Hub&lt;/strong&gt;: Nextail announces new CEO and multi-million euro investment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://retailtimes.co.uk/nextail-marks-a-decade-of-retail-transformation-with-new-ceo/" rel="noopener noreferrer"&gt;&lt;strong&gt;Retail Times&lt;/strong&gt;: Nextail marks a decade of retail transformation with new CEO&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mckinsey.com/capabilities/operations/our-insights/autonomous-supply-chain-planning-for-consumer-goods-companies" rel="noopener noreferrer"&gt;&lt;strong&gt;McKinsey&lt;/strong&gt;: Autonomous supply chain planning for consumer goods companies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/press-release/retail-forecasting-allocation-replenishment-gartner-representative-vendor" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: Reconocido como Representative Vendor por Gartner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/resource/q2-2025-nextail-ai-fashion-retail-growth" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: AI Drives Fashion Retail Growth – Q2 2025&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.deloitte.com/us/en/services/consulting/blogs/business-operations-room/llm-for-supply-chain-optimization.html" rel="noopener noreferrer"&gt;&lt;strong&gt;Deloitte&lt;/strong&gt;: AI - The Helping Hand in Sales and Operations Planning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/resource/dispellling-ai-magic-fashion-retail-mark-lewis" rel="noopener noreferrer"&gt;&lt;strong&gt;Mark Lewis en Nextail&lt;/strong&gt;: Dispelling the magic - 5 retail realities about AI in fashion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://retailtechinnovationhub.com/home/2025/7/10/scotta-taps-nextail-ai-powered-technology-to-support-retailers-growth-across-stores-and-online" rel="noopener noreferrer"&gt;&lt;strong&gt;Retail Tech Innovation Hub&lt;/strong&gt;: Scotta adopta la tecnología IA de Nextail&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>analytics</category>
      <category>machinelearning</category>
      <category>startup</category>
    </item>
    <item>
      <title>Nextail: How a Spanish Startup's Prescriptive AI Is Defeating Excel in Fashion Retail</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Tue, 31 Mar 2026 06:03:52 +0000</pubDate>
      <link>https://dev.to/datalaria/nextail-how-a-spanish-startups-prescriptive-ai-is-defeating-excel-in-fashion-retail-54pc</link>
      <guid>https://dev.to/datalaria/nextail-how-a-spanish-startups-prescriptive-ai-is-defeating-excel-in-fashion-retail-54pc</guid>
      <description>&lt;p&gt;In the cutthroat world of fast fashion, where trends are born and die in weeks and the wrong size in the wrong store can mean the difference between selling at full price or slashing margins in clearance sales, there's an uncomfortable truth the industry has taken decades to accept: &lt;strong&gt;the most critical business decisions—what to ship, where, and when—are still being made with spreadsheets, gut feeling, and mental maps&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is the story of &lt;strong&gt;&lt;a href="https://nextail.co/" rel="noopener noreferrer"&gt;Nextail&lt;/a&gt;&lt;/strong&gt;, a Madrid-based startup founded in 2014 by a team that knew that reality from the inside and decided to destroy it with mathematics. It is a case study of how prescriptive analytics and stochastic optimization are replacing Excel in an industry worth billions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi50pmr39coh6tuygnbuj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi50pmr39coh6tuygnbuj.png" alt="Nextail image" width="800" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Origin: When Zara Wasn't Enough
&lt;/h3&gt;

&lt;p&gt;Nextail's genesis is directly linked to the epicenter of global fast fashion. &lt;strong&gt;Joaquín Villalba&lt;/strong&gt;, an industrial engineer from the Universitat Politècnica de València with an MBA from INSEAD, served as European Logistics Director at &lt;strong&gt;Zara-Inditex&lt;/strong&gt;, where he oversaw operations for over a thousand stores with annual sales exceeding $10 billion. From that privileged vantage point, &lt;a href="https://medium.com/authority-magazine/the-future-of-retail-over-the-next-five-years-with-joaquin-villalba-ceo-of-nextail-713703af4310" rel="noopener noreferrer"&gt;Villalba analyzed the foundations of Amancio Ortega's empire&lt;/a&gt; and reached a conclusion that would define his career: Zara's logistics model was revolutionary in its structure, but daily decisions about what to send to each store still depended on human intuition.&lt;/p&gt;

&lt;p&gt;Customers left frustrated without finding their size. The cause wasn't a lack of global stock, but a distribution model too static to react to micro-local demand fluctuations. Villalba saw an immense opportunity to take retail agility to the next level by injecting data science and operations research directly into the core of merchandising.&lt;/p&gt;

&lt;p&gt;To bring this vision to life, he partnered with &lt;strong&gt;Carlos Miragall&lt;/strong&gt;, a corporate finance expert with experience scaling startups from scratch to over 150 employees and raising more than $60 million in funding, and &lt;strong&gt;Javier Lafuente García&lt;/strong&gt; as CTO. &lt;a href="https://nextail.co/company" rel="noopener noreferrer"&gt;Together they founded Nextail&lt;/a&gt; with a clear mission: &lt;strong&gt;democratize the operational excellence of fast fashion through mathematical precision&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: The Combinatorial Explosion That Breaks Excel
&lt;/h3&gt;

&lt;p&gt;To understand why Nextail exists, you need to grasp a mathematical phenomenon that merchandising teams endure daily: the &lt;strong&gt;combinatorial explosion&lt;/strong&gt;. A fashion retailer doesn't make aggregated decisions. It crosses thousands of products (SKUs), multiplied by several sizes, distributed across hundreds of stores, requiring updates several times a week. The result: &lt;strong&gt;millions of decision points every day&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Spreadsheets collapse. Literally. &lt;a href="https://nextail.co/resource/implementing-ai-driven-merchandising-tech-mark-scoullers-experience" rel="noopener noreferrer"&gt;As Mark Scouller notes&lt;/a&gt;, a merchandising veteran at firms like Next, New Look, and Mountain Warehouse, teams deal with files that freeze beyond half a million rows, held together by thousands of interdependent macros that break with any change.&lt;/p&gt;

&lt;p&gt;But the technical collapse is just the surface. The business consequences are devastating:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Forced Store Clustering&lt;/strong&gt;: Unable to calculate demand per individual store, teams &lt;a href="https://nextail.co/resource/assortment-planning-evolution-fashion-retail-spreadsheets-ai" rel="noopener noreferrer"&gt;group locations into broad categories&lt;/a&gt; and apply uniform distributions. The result: overstock in some stores and stockouts in others within the same cluster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;"Mental Map" Dependency&lt;/strong&gt;: Decisions end up relying on the buyer's subjective intuition, an approach blind to week-over-week trend shifts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Abandoned "Middle Class"&lt;/strong&gt;: Teams spend all their time replenishing sold-out best-sellers or liquidating worst-sellers, completely neglecting mid-sellers and mid-tier stores. As Scouller puts it: these ignored products are the ones that &lt;strong&gt;"silently drain profit margins."&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Destructive Markdowns&lt;/strong&gt;: Procedural slowness forces massive end-of-season clearance campaigns to liquidate accumulated inventory.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"The future of retail doesn't fit in Excel"&lt;/strong&gt; — Mark Scouller&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  The Solution: A Mathematical Brain That Thinks in Probabilities
&lt;/h3&gt;

&lt;p&gt;Nextail's architecture attacks the problem across three perfectly orchestrated layers within the S&amp;amp;OP (Sales and Operations Planning) process:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. "AI-Ready" Data (Data Ingestion &amp;amp; Optimization)
&lt;/h4&gt;

&lt;p&gt;The foundational premise is data purity. Retailer datasets come from a myriad of disconnected systems (ERPs, WMS, POS). &lt;a href="https://help.nextail.co/en" rel="noopener noreferrer"&gt;The platform consolidates and cleanses all this information&lt;/a&gt; daily, correcting phenomena like "phantom stock" (where the system reports inventory for garments that have been stolen or misplaced), imputing null values, and generating a &lt;strong&gt;single source of truth&lt;/strong&gt; that eliminates friction between departments.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Hyper-Local Probabilistic Forecasting
&lt;/h4&gt;

&lt;p&gt;Unlike traditional forecasting that produces a single prediction number, &lt;a href="https://nextail.co/solution/analytics" rel="noopener noreferrer"&gt;Nextail's algorithms build a complete probability distribution&lt;/a&gt; for each combination of SKU, store, and day. They don't just anticipate expected volume; they quantify uncertainty. That forecast is then calibrated against real constraints: backroom capacity, packing logistics, size distribution by ZIP code demographics, and minimum display requirements.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Prescriptive Optimization (The MILP Engine)
&lt;/h4&gt;

&lt;p&gt;This is where the real innovation lives. Once the probabilistic model dictates &lt;em&gt;how much&lt;/em&gt; demand will occur, &lt;em&gt;where&lt;/em&gt;, and &lt;em&gt;when&lt;/em&gt;, the system must prescribe the exact optimal operational action. To do this, it deploys &lt;strong&gt;Mixed-Integer Linear Programming (MILP)&lt;/strong&gt; algorithms combined with stochastic optimization.&lt;/p&gt;

&lt;p&gt;Conceptually, the engine solves an objective function that maximizes the probability of full-price sell-through for each SKU at each store, weighted by gross margin, minus the logistics costs of each transfer. All subject to hard constraints: inventory conservation, available physical space, brand aesthetic standards, and size curve coherence.&lt;/p&gt;

&lt;p&gt;The system evaluates billions of permutations and decides: is it more profitable to hold stock at the distribution center to protect e-commerce, or rush it to a store showing high imminent probability of a stockout?&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/xD5D943-888"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The output isn't a static report, but an &lt;strong&gt;actionable execution directive&lt;/strong&gt; delivered to ERP and WMS systems within minutes. This automation frees &lt;a href="https://nextail.co/company/customer-impact" rel="noopener noreferrer"&gt;up to 75% of merchandising teams' time&lt;/a&gt; to refocus on strategic decisions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Beyond Allocation: Intelligent Rebalancing
&lt;/h3&gt;

&lt;p&gt;One of Nextail's most disruptive features is &lt;strong&gt;&lt;a href="https://nextail.co/resource/5-benefits-ai-driven-inventory-rebalancing" rel="noopener noreferrer"&gt;inventory rebalancing between stores&lt;/a&gt;&lt;/strong&gt; (Store Transfers). As products approach end-of-life, demand fragments: some stores have excess sizes nobody wants, while others need exactly those sizes.&lt;/p&gt;

&lt;p&gt;Traditionally, that leftover stock went straight to markdowns. Nextail does the opposite: the optimizer scans store pairs, calculates whether the increase in full-price sale probability justifies the logistics cost of the transfer, and actively regroups broken size curves into active demand centers. This way, &lt;strong&gt;markdowns stop being an endemic evil&lt;/strong&gt; and become a tool of absolute last resort.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Impact: ROI in 30 Days
&lt;/h3&gt;

&lt;p&gt;Prescriptive analytics wouldn't matter without results. Nextail's numbers speak for themselves:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Impact&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Inventory coverage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Reduction of up to &lt;strong&gt;30%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stockouts&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Decrease of up to &lt;strong&gt;60%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Direct sales&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Increase of &lt;strong&gt;5-10%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Merchandiser time freed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Up to &lt;strong&gt;75%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Demonstrable ROI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Within the first &lt;strong&gt;30 days&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;International brands such as &lt;strong&gt;Pepe Jeans&lt;/strong&gt;, &lt;strong&gt;River Island&lt;/strong&gt;, &lt;strong&gt;Guess&lt;/strong&gt;, &lt;strong&gt;&lt;a href="https://retailtechinnovationhub.com/home/2025/7/10/scotta-taps-nextail-ai-powered-technology-to-support-retailers-growth-across-stores-and-online" rel="noopener noreferrer"&gt;Scotta&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;Bimani&lt;/strong&gt;, &lt;strong&gt;Silbon&lt;/strong&gt;, and &lt;strong&gt;Sports Emotion&lt;/strong&gt; have integrated the platform to overcome the bottlenecks of their omnichannel scaling. The Pepe Jeans case is particularly illustrative: a brand with lead times of up to six months that shifted from static forecasts to dynamic optimization capable of adapting to consumer behavior in weeks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Financial Trajectory and Leadership Transition
&lt;/h3&gt;

&lt;p&gt;The corporate timeline reveals a growth pattern backed by the European venture capital elite:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Round&lt;/th&gt;
&lt;th&gt;Date&lt;/th&gt;
&lt;th&gt;Amount (USD)&lt;/th&gt;
&lt;th&gt;Lead Investor(s)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Seed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2016&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.nautacapital.com/news-insights/nextail-raises-1-6m-investment-led-by-nauta-capital" rel="noopener noreferrer"&gt;$1.6M&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Nauta Capital&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Series A&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Jun 2018&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.eu-startups.com/2018/06/madrid-based-nextail-raises-10-million-bring-artificial-intelligence-into-retailers-inventory-planning/" rel="noopener noreferrer"&gt;$10M&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Nauta Capital&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;2024 Investment&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Nov 2024&lt;/td&gt;
&lt;td&gt;&lt;a href="https://retailtechinnovationhub.com/home/2024/11/7/ai-powered-retail-technology-firm-nextail-announces-new-ceo-and-multi-million-euro-investment-from-current-investors" rel="noopener noreferrer"&gt;Multi-million&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Existing investors&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;After a decade leading the product vision and positioning the platform to automate over &lt;strong&gt;one billion inventory decisions per season&lt;/strong&gt; across a park of &lt;strong&gt;20,000 stores&lt;/strong&gt;, &lt;a href="https://retailtimes.co.uk/nextail-marks-a-decade-of-retail-transformation-with-new-ceo/" rel="noopener noreferrer"&gt;Joaquín Villalba orchestrated an executive succession in 2024&lt;/a&gt;. He adopted the role of Corporate Ambassador—in line with his recognition as a &lt;strong&gt;World Economic Forum Tech Pioneer&lt;/strong&gt;—and handed the CEO position to &lt;strong&gt;Carlos Miragall&lt;/strong&gt;, co-founder and former CFO, to captain the company into the era of LLMs and agentic systems.&lt;/p&gt;

&lt;p&gt;Institutional recognition has been emphatic: &lt;strong&gt;&lt;a href="https://nextail.co/press-release/best-fashion-retail-merchandising-platform-2025" rel="noopener noreferrer"&gt;Best Fashion Retail Merchandising Platform 2025&lt;/a&gt;&lt;/strong&gt; (EU Business News), &lt;strong&gt;triple victory at the Just Style Excellence Awards 2025&lt;/strong&gt;, and repeated recognition as a &lt;strong&gt;&lt;a href="https://nextail.co/press-release/retail-forecasting-allocation-replenishment-gartner-representative-vendor" rel="noopener noreferrer"&gt;Representative Vendor by Gartner&lt;/a&gt;&lt;/strong&gt; in their retail optimization market guides.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Sociological Mountain: The Biggest Obstacle Isn't Technology
&lt;/h3&gt;

&lt;p&gt;Despite technical superiority, the biggest hurdle to adoption isn't computational—&lt;strong&gt;it's human&lt;/strong&gt;. &lt;a href="https://nextail.co/resource/dispellling-ai-magic-fashion-retail-mark-lewis" rel="noopener noreferrer"&gt;As Mark Lewis warns&lt;/a&gt;, a retail technology strategist: &lt;em&gt;"The biggest barrier to AI success in fashion is purely and exclusively a matter of collective mindset."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There's a dangerous fallacy that perceives AI as incomprehensible "dark magic." This generates unrealistic expectations in boardrooms or visceral rejection from merchandising professionals who fear the "black box" verdict. Retailers invest millions in platforms that end up underutilized because they haven't restructured their teams or invested in training.&lt;/p&gt;

&lt;p&gt;The key, according to Scouller, is understanding that AI &lt;em&gt;"isn't dark magic, but crushing logic: massive processing of clean data and the iterative application of mathematics at an inhuman scale and speed."&lt;/em&gt; And the corporate tipping point arrives at a very specific moment: &lt;strong&gt;when the pain of inefficiency exceeds the inertia of operational comfort&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Future: Generative AI, Autonomous Agents, and the ESPR Regulatory Shield
&lt;/h3&gt;

&lt;p&gt;Nextail's roadmap converges on three forces that will define retail in 2026:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Conversational Interface with RAG&lt;/strong&gt;: Generative AI won't replace the MILP optimization engines (LLMs fail at massive numerical computation at efficient cost). Its role will be to act as a &lt;strong&gt;cognitive orchestration layer&lt;/strong&gt;: a commercial director will be able to interact with the mathematical brain in natural language, requesting profitability analyses for a specific rebalancing and authorizing automatic executions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Multi-Agent AI Systems&lt;/strong&gt;: &lt;a href="https://www.deloitte.com/us/en/services/consulting/blogs/business-operations-room/llm-for-supply-chain-optimization.html" rel="noopener noreferrer"&gt;Gartner projects that by end of 2026&lt;/a&gt;, more than 40% of enterprise applications will incorporate AI agents. In the S&amp;amp;OP context, a "swarm" of agents will autonomously monitor volatile variables—weather, supply chain disruptions, trending virality on social media—and recalibrate the optimizer without human intervention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The ESPR Shield&lt;/strong&gt;: The &lt;a href="https://nextail.co/resource/q2-2025-nextail-ai-fashion-retail-growth" rel="noopener noreferrer"&gt;European ESPR 2026 regulatory framework&lt;/a&gt; will penalize (and even ban) the destruction of unsold textile inventory. Surpluses will no longer be "sunk costs" but &lt;strong&gt;auditable environmental liabilities&lt;/strong&gt;. In this context, Nextail's ability to reduce overproduction and minimize leftovers transforms from a financial advantage into a legal survival requirement.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion: Mathematics Wins the Game
&lt;/h3&gt;

&lt;p&gt;Nextail's story is the chronicle of an industry that has crossed a point of no return. The complexity of modern omnichannel retail has definitively exceeded human capacity for manual management. Spreadsheets are not a minor inconvenience; they are a &lt;strong&gt;systemic risk&lt;/strong&gt; that silently drains profit margins.&lt;/p&gt;

&lt;p&gt;Nextail has proven that the answer lies in the fusion of probabilistic forecasting, stochastic optimization, and a clean data culture. Its journey demonstrates that sometimes, revolution doesn't arrive with an entirely new idea, but with the rigorous application of mathematics to a problem everyone had given up on.&lt;/p&gt;

&lt;p&gt;As Villalba discovered in the corridors of Zara: the agility of the future isn't built on intuition—it's built on equations.&lt;/p&gt;




&lt;h4&gt;
  
  
  Sources of Interest:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nextail.co/" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: The Merchandise Execution Platform for Fashion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.siliconrepublic.com/start-ups/nextail-retail-ai-analytics-platform-spain" rel="noopener noreferrer"&gt;&lt;strong&gt;Silicon Republic&lt;/strong&gt;: Nextail is bringing science to retail decision-making&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/authority-magazine/the-future-of-retail-over-the-next-five-years-with-joaquin-villalba-ceo-of-nextail-713703af4310" rel="noopener noreferrer"&gt;&lt;strong&gt;Authority Magazine (Medium)&lt;/strong&gt;: The Future of Retail, with Joaquín Villalba, CEO of Nextail&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/resource/implementing-ai-driven-merchandising-tech-mark-scoullers-experience" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: Implementing AI-Driven Merchandising - Mark Scouller's Experience&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/resource/assortment-planning-evolution-fashion-retail-spreadsheets-ai" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: From Spreadsheets to AI in Assortment Planning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.eu-startups.com/2018/06/madrid-based-nextail-raises-10-million-bring-artificial-intelligence-into-retailers-inventory-planning/" rel="noopener noreferrer"&gt;&lt;strong&gt;EU-Startups&lt;/strong&gt;: Nextail raises $10M to bring AI into retailers' inventory planning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://retailtechinnovationhub.com/home/2024/11/7/ai-powered-retail-technology-firm-nextail-announces-new-ceo-and-multi-million-euro-investment-from-current-investors" rel="noopener noreferrer"&gt;&lt;strong&gt;Retail Tech Innovation Hub&lt;/strong&gt;: Nextail announces new CEO and multi-million euro investment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://retailtimes.co.uk/nextail-marks-a-decade-of-retail-transformation-with-new-ceo/" rel="noopener noreferrer"&gt;&lt;strong&gt;Retail Times&lt;/strong&gt;: Nextail marks a decade of retail transformation with new CEO&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mckinsey.com/capabilities/operations/our-insights/autonomous-supply-chain-planning-for-consumer-goods-companies" rel="noopener noreferrer"&gt;&lt;strong&gt;McKinsey&lt;/strong&gt;: Autonomous supply chain planning for consumer goods companies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/press-release/retail-forecasting-allocation-replenishment-gartner-representative-vendor" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: Recognized as Representative Vendor by Gartner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/resource/q2-2025-nextail-ai-fashion-retail-growth" rel="noopener noreferrer"&gt;&lt;strong&gt;Nextail&lt;/strong&gt;: AI Drives Fashion Retail Growth – Q2 2025&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.deloitte.com/us/en/services/consulting/blogs/business-operations-room/llm-for-supply-chain-optimization.html" rel="noopener noreferrer"&gt;&lt;strong&gt;Deloitte&lt;/strong&gt;: AI - The Helping Hand in Sales and Operations Planning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextail.co/resource/dispellling-ai-magic-fashion-retail-mark-lewis" rel="noopener noreferrer"&gt;&lt;strong&gt;Mark Lewis on Nextail&lt;/strong&gt;: Dispelling the magic - 5 retail realities about AI in fashion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://retailtechinnovationhub.com/home/2025/7/10/scotta-taps-nextail-ai-powered-technology-to-support-retailers-growth-across-stores-and-online" rel="noopener noreferrer"&gt;&lt;strong&gt;Retail Tech Innovation Hub&lt;/strong&gt;: Scotta taps Nextail AI technology&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>S&amp;OP Engineering V: The Autonomous Brain (Agentic AI)</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 27 Mar 2026 18:02:39 +0000</pubDate>
      <link>https://dev.to/datalaria/sop-engineering-v-the-autonomous-brain-agentic-ai-i0k</link>
      <guid>https://dev.to/datalaria/sop-engineering-v-the-autonomous-brain-agentic-ai-i0k</guid>
      <description>&lt;h1&gt;
  
  
  1. The Execution Chasm
&lt;/h1&gt;

&lt;p&gt;Companies invest millions in planning software and ERPs. They spend months integrating data, cleaning records, and tuning demand forecasts. Yet, at the end of the day, execution often relies on an analyst staring at a dashboard. A human reading charts, finally drafting an email to the plant director to request production adjustments.&lt;/p&gt;

&lt;p&gt;That human &lt;em&gt;delay&lt;/em&gt; is inefficient, error-prone, and, frankly, unnecessary in the modern era. Pure mathematics has no value if it isn't executed.&lt;/p&gt;

&lt;p&gt;The solution isn't a rigid automation script, nor is it a chatbot you ask questions to. True modernization requires &lt;strong&gt;Agentic AI&lt;/strong&gt;. We are not talking about ChatGPT. We are talking about Autonomous Agents: software entities with a specific role, a clear goal, and integrated with &lt;em&gt;Tools&lt;/em&gt; that allow them to interact with real-world databases and APIs.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. The Architecture: CrewAI + Supabase
&lt;/h1&gt;

&lt;p&gt;For this Autonomous Brain, we have implemented a multi-agent architecture using &lt;strong&gt;CrewAI&lt;/strong&gt;. Our digital team ("The Agency") is composed of two key agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Senior Supply Chain Analyst&lt;/strong&gt;: Its job is purely analytical. We don't give it a PDF to summarize; we equipped it with a Python &lt;code&gt;@tool&lt;/code&gt; that allows it to execute SQL queries against our Supabase database. It extracts the optimal production plan generated by PuLP in Chapter 4, identifies bottlenecks, and pinpoints the months where production stress is most critical.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Procurement &amp;amp; Plant Manager&lt;/strong&gt;: Acts as the executor. Based strictly on the mathematical conclusions drawn by the Analyst, it drafts the definitive executive orders.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Crucial fact: &lt;strong&gt;They do not hallucinate&lt;/strong&gt;. Their decisions are anchored in hard data mathematically retrieved from the central database.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. The Code: Tools over Prompts
&lt;/h1&gt;

&lt;p&gt;The true power of Agentic AI lies in providing LLMs with the ability to interact with external systems. The C-Suite must understand that we aren't handing an Excel sheet to a language model; we are embedding our code with the ability to "think" and execute actions using the &lt;strong&gt;ReAct&lt;/strong&gt; (Reasoning and Acting) pattern.&lt;/p&gt;

&lt;p&gt;Here is a snippet of how we connect our Agent to Supabase:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;crewai.tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;supabase&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_client&lt;/span&gt;

&lt;span class="nd"&gt;@tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fetch_latest_supply_plan&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fetch_latest_supply_plan&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Connects to the Supabase database, finds the most recent execution of the 
    optimized production plan, and extracts the strategic plan for the 
    next 3 months across all SKUs.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;supabase&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SUPABASE_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SUPABASE_KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 1. Find the most recent execution
&lt;/span&gt;    &lt;span class="n"&gt;latest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;supabase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;supply_plans&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;execution_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;execution_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;exec_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;latest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;execution_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="c1"&gt;# 2. Extract the optimal plan generated by PuLP
&lt;/span&gt;    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;supabase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;supply_plans&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;eq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;execution_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exec_date&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# ... Format into structured Markdown to prevent hallucinations ...
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;

&lt;span class="c1"&gt;# Instantiate the Analyst Agent by connecting it to the tool
&lt;/span&gt;&lt;span class="n"&gt;analyst_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Senior Supply Chain Analyst&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;goal&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Analyze the master production plan to detect bottlenecks and inventory risks.&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;backstory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;You are a relentless analyst seeking capital efficiency. You hate excess inventory but fear stockouts...&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;allow_delegation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;fetch_latest_supply_plan&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;-- We inject Database access here
&lt;/span&gt;    &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;gemini_llm&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By compiling the agents into a &lt;code&gt;Process.sequential&lt;/code&gt; pipeline, we orchestrate a workflow where the Analyst's output directly fuels the actions of the Plant Manager.&lt;/p&gt;

&lt;h1&gt;
  
  
  4. The Money Shot
&lt;/h1&gt;

&lt;p&gt;If we execute our &lt;em&gt;"Crew"&lt;/em&gt;, this is exactly what the model returns in the terminal after querying the database and reasoning around the factory's 12,000 monthly unit capacity limit:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[!NOTE]&lt;br&gt;
&lt;strong&gt;SUBJECT: URGENT - July-September Production Plan | Bottleneck Alert&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hi Carlos,&lt;/p&gt;

&lt;p&gt;After running the mathematical optimization model for the upcoming quarter, I confirm the Master Production Plan. We are facing a critical capacity bottleneck (12,000 units/month) during the summer that requires strict execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;July (100% Capacity - Critical Risk):&lt;/strong&gt;&lt;br&gt;
The entire plant capacity must be exclusively dedicated to SKU-001 (12,000 units). Halt the SKU-002 and SKU-003 lines this month. The model has pulled forward this production to prevent stockouts in the following months.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;August (100% Capacity - Production Mix):&lt;/strong&gt;&lt;br&gt;
The factory will remain at its limit. The distribution will be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SKU-001: 5,000 units&lt;/li&gt;
&lt;li&gt;SKU-002: 15 units&lt;/li&gt;
&lt;li&gt;SKU-003: 6,985 units (High priority for the seasonal campaign)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;September (83% Capacity - Stabilization):&lt;/strong&gt;&lt;br&gt;
The pressure will decrease. We will manufacture 8,000 units of SKU-001, 10 units of SKU-002, and 2,000 units of SKU-003, ensuring a buffer for line maintenance.&lt;/p&gt;

&lt;p&gt;Please coordinate with purchasing to secure the raw materials for SKU-001 immediately for the first week of July. The algorithm leaves no margin for error regarding the 12,000 units for that month.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br&gt;
Agentic S&amp;amp;OP Copilot (On behalf of Operations Management)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This email isn't a generic template. It is an operational, justified, and unbiased decision, generated autonomously from a linear programming model and delivered in seconds.&lt;/p&gt;

&lt;h1&gt;
  
  
  5. The Sandbox
&lt;/h1&gt;

&lt;p&gt;Want to see how they reason in real-time? I have prepared an interactive notebook so you can test the system yourself.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://colab.research.google.com/drive/1Yh1D6LiIOgPhpkJyHNnJ6rUZxHknC550?usp=sharing" rel="noopener noreferrer"&gt;&lt;strong&gt;Open the Agentic S&amp;amp;OP Google Colab&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For security reasons, we have simulated the database return in the public environment. But if you insert your own Gemini API Key (it's free), you will be able to watch the agents' step-by-step reasoning process in the logs before they issue the final order.&lt;/p&gt;

&lt;h1&gt;
  
  
  6. Series Conclusion: The CTO Pitch
&lt;/h1&gt;

&lt;p&gt;We have reached the end of our "S&amp;amp;OP Engineering" journey. Over the course of five chapters, we have evolved enterprise planning from its grimiest foundations to the technological bleeding edge:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Foundations&lt;/strong&gt;: We cleaned and normalized years of unstructured historical data.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Vision&lt;/strong&gt;: We implemented iterative Artificial Intelligence engines to forecast future demand with high precision (Prophet).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Logic&lt;/strong&gt;: We introduced Decision Sciences and Linear Programming to balance inventory constraints (PuLP).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Scale&lt;/strong&gt;: We elevated the mathematical model to the Enterprise level, dealing with shared capacity constraints and parallelized MLOps.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Execution&lt;/strong&gt;: We gave the system an Autonomous Brain to bridge the gap between the Dashboard and the real world.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The CTO Pitch: &lt;strong&gt;If your company is still planning demand with moving averages in Excel, you are bleeding money&lt;/strong&gt;. Capital efficiency, stockout reduction, and intelligent workflow automation are no longer the future; they are the operational standard demanded by today's margins.&lt;/p&gt;

&lt;p&gt;It's time to retire static models. Let's talk about how to modernize your Supply Chain from its roots all the way to autonomous execution.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Ingeniería S&amp;OP V: El Cerebro Autónomo (Agentic AI)</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 27 Mar 2026 17:56:38 +0000</pubDate>
      <link>https://dev.to/datalaria/ingenieria-sop-v-el-cerebro-autonomo-agentic-ai-408n</link>
      <guid>https://dev.to/datalaria/ingenieria-sop-v-el-cerebro-autonomo-agentic-ai-408n</guid>
      <description>&lt;h1&gt;
  
  
  1. El Abismo de la Ejecución
&lt;/h1&gt;

&lt;p&gt;Las empresas invierten millones en software de planificación y ERPs. Pasan meses integrando datos, limpiando registros y afinando previsiones de demanda. Y aun así, al final del día, la ejecución suele depender de un analista frente a un dashboard. Un humano leyendo gráficos para, finalmente, redactar un correo electrónico al director de la fábrica solicitando cambios en la producción.&lt;/p&gt;

&lt;p&gt;Ese &lt;em&gt;delay&lt;/em&gt; humano es ineficiente, propenso a errores y, francamente, innecesario en la era moderna. Las matemáticas puras no tienen valor si no se ejecutan.&lt;/p&gt;

&lt;p&gt;La solución no es un simple script de automatización rígido, ni tampoco un chatbot al que hacerle preguntas. La verdadera modernización requiere &lt;strong&gt;Agentic AI&lt;/strong&gt;. No estamos hablando de ChatGPT. Hablamos de Agentes Autónomos: piezas de software con un rol específico, un objetivo claro, e integrados con &lt;em&gt;herramientas&lt;/em&gt; (Tools) que les permiten interactuar con bases de datos y APIs del mundo real.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. La Arquitectura: CrewAI + Supabase
&lt;/h1&gt;

&lt;p&gt;Para este Cerebro Autónomo, hemos implementado una arquitectura multi-agente utilizando &lt;strong&gt;CrewAI&lt;/strong&gt;. Nuestro equipo digital ("La Agencia") está compuesto por dos agentes clave:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Senior Supply Chain Analyst&lt;/strong&gt;: Su trabajo es puramente analítico. No le damos un PDF para resumir; le hemos equipado con una herramienta de Python (&lt;code&gt;@tool&lt;/code&gt;) que le permite ejecutar consultas SQL contra nuestra base de datos en Supabase. Extrae el plan de producción óptimo que generó PuLP en el Capítulo 4, identifica los cuellos de botella y señala los meses donde el nivel de estrés productivo es más crítico.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Procurement &amp;amp; Plant Manager&lt;/strong&gt;: Actúa como el ejecutor. Basándose estrictamente en las conclusiones matemáticas del Analista, redacta las órdenes ejecutivas definitivas.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dato crucial: &lt;strong&gt;No alucinan&lt;/strong&gt;. Sus decisiones están ancladas en los datos duros recuperados matemáticamente desde la base de datos central.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. El Código: Tools over Prompts
&lt;/h1&gt;

&lt;p&gt;El verdadero poder del Agentic AI radica en proporcionar a los LLMs la capacidad de interactuar con sistemas externos. El C-Level debe entender que no le estamos dando un Excel a un modelo de lenguaje; le estamos dotando de la capacidad de "pensar" y ejecutar acciones utilizando el patrón &lt;strong&gt;ReAct&lt;/strong&gt; (Reasoning and Acting).&lt;/p&gt;

&lt;p&gt;Este es un fragmento de cómo conectamos nuestro Agente a Supabase:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;crewai.tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;supabase&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_client&lt;/span&gt;

&lt;span class="nd"&gt;@tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fetch_latest_supply_plan&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fetch_latest_supply_plan&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Se conecta a la base de datos Supabase, busca la ejecución más 
    reciente del plan de producción optimizado y extrae el plan estratégico 
    de los próximos 3 meses para todos los SKUs.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;supabase&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SUPABASE_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SUPABASE_KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 1. Buscar ejecución más reciente
&lt;/span&gt;    &lt;span class="n"&gt;latest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;supabase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;supply_plans&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;execution_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;execution_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;exec_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;latest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;execution_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="c1"&gt;# 2. Extraer el plan óptimo generado por PuLP
&lt;/span&gt;    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;supabase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;supply_plans&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;eq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;execution_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exec_date&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# ... Formateo en Markdown estructurado para evitar alucinaciones ...
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;

&lt;span class="c1"&gt;# Instanciamos el Agente Analista conectándolo a la herramienta
&lt;/span&gt;&lt;span class="n"&gt;analyst_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Senior Supply Chain Analyst&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;goal&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Analizar el plan maestro de producción y detectar cuellos de botella y riesgos de inventario.&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;backstory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Eres un analista implacable que busca la eficiencia del capital. Odias el exceso de inventario pero temes las roturas de stock...&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;allow_delegation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;fetch_latest_supply_plan&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;-- Aquí inyectamos el acceso a la Base de Datos
&lt;/span&gt;    &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;gemini_llm&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Al compilar a los agentes en un &lt;code&gt;Process.sequential&lt;/code&gt;, orquestamos un flujo de trabajo donde la salida del Analista alimenta directamente las acciones del Manager de Planta.&lt;/p&gt;

&lt;h1&gt;
  
  
  4. El Resultado Final
&lt;/h1&gt;

&lt;p&gt;Si ejecutamos nuestra &lt;em&gt;"Crew"&lt;/em&gt;, esto es exactamente lo que el modelo escupe en la terminal después de consultar la base de datos y razonar sobre los 12.000 límites de capacidad mensuales de la fábrica:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[!NOTE]&lt;br&gt;
&lt;strong&gt;ASUNTO: URGENTE - Plan de Producción Julio-Septiembre | Alerta de Cuello de Botella&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hola Carlos,&lt;/p&gt;

&lt;p&gt;Tras ejecutar el modelo de optimización matemática para el próximo trimestre, te confirmo el Plan Maestro de Producción. Nos enfrentamos a un cuello de botella crítico de capacidad (12.000 unidades/mes) durante el verano que requiere ejecución estricta.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Julio (Capacidad 100% - Riesgo Crítico):&lt;/strong&gt;&lt;br&gt;
Toda la capacidad de la planta debe dedicarse exclusivamente al SKU-001 (12.000 unidades). Paralizad las líneas del SKU-002 y SKU-003 este mes. El modelo ha adelantado esta producción para evitar roturas en los meses siguientes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agosto (Capacidad 100% - Mix de Producción):&lt;/strong&gt;&lt;br&gt;
La fábrica seguirá al límite. La distribución será:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SKU-001: 5.000 uds&lt;/li&gt;
&lt;li&gt;SKU-002: 15 uds&lt;/li&gt;
&lt;li&gt;SKU-003: 6.985 uds (Prioridad alta para la campaña estacional)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Septiembre (Capacidad 83% - Estabilización):&lt;/strong&gt;&lt;br&gt;
La presión bajará. Fabricaremos 8.000 uds del SKU-001, 10 uds del SKU-002 y 2.000 uds del SKU-003, lo que nos permitirá margen para mantenimiento de las líneas.&lt;/p&gt;

&lt;p&gt;Por favor, coordina con compras para asegurar la materia prima del SKU-001 de forma inmediata para la primera semana de Julio. El algoritmo no contempla margen de error en las 12.000 unidades de ese mes.&lt;/p&gt;

&lt;p&gt;Saludos,&lt;br&gt;
Agentic S&amp;amp;OP Copilot (En nombre de Dirección de Operaciones)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Este correo no es una plantilla genérica. Es una decisión operativa, justificada e imparcial, generada autónomamente a partir de un modelo de programación lineal y enviada en segundos.&lt;/p&gt;

&lt;h1&gt;
  
  
  5. The Sandbox
&lt;/h1&gt;

&lt;p&gt;¿Quieres ver cómo razonan en tiempo real? He preparado un cuaderno interactivo para que pruebes el sistema tú mismo.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://colab.research.google.com/drive/1Yh1D6LiIOgPhpkJyHNnJ6rUZxHknC550?usp=sharing" rel="noopener noreferrer"&gt;&lt;strong&gt;Abre el Google Colab de Agentic S&amp;amp;OP&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Por motivos de seguridad, en el entorno público hemos simulado el retorno de la base de datos, pero si insertas tu propia API Key de Gemini (es gratuita), podrás observar en los logs el proceso de razonamiento paso a paso de los agentes antes de emitir la orden final.&lt;/p&gt;

&lt;h1&gt;
  
  
  6. Conclusión de la Serie
&lt;/h1&gt;

&lt;p&gt;Hemos llegado al final de nuestro viaje "S&amp;amp;OP Engineering". A lo largo de cinco capítulos, hemos evolucionado la planificación empresarial desde sus cimientos más sucios hasta la vanguardia tecnológica:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Fundamentos&lt;/strong&gt;: Limpiamos y normalizamos años de datos históricos desestructurados.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Visión&lt;/strong&gt;: Implementamos motores de Inteligencia Artificial iterativos para prever la demanda futura con alta precisión (Prophet).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Lógica&lt;/strong&gt;: Introdujimos Ciencias de la Decisión y Programación Lineal para equilibrar el inventario (PuLP).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Escalabilidad&lt;/strong&gt;: Llevamos el modelo matemático a nivel Enterprise lidiando con restricciones de capacidad y MLOps paralelizado.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Ejecución&lt;/strong&gt;: Le dimos un Cerebro Autónomo al sistema para cerrar la brecha entre el Dashboard y el mundo real.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The CTO Pitch: &lt;strong&gt;Si tu empresa sigue planificando la demanda con promedios móviles en Excel, estás perdiendo dinero&lt;/strong&gt;. La eficiencia del capital, la reducción de roturas de stock y la automatización inteligente ya no son el futuro; son el estándar operativo que exigen los márgenes actuales.&lt;/p&gt;

&lt;p&gt;Es hora de jubilar los modelos estáticos. Hablemos de cómo modernizar tu Cadena de Suministro desde la raíz hasta la ejecución autónoma.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>S&amp;OP Engineering IV: Scaling to Enterprise (Multi-SKU &amp; Bottlenecks)</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 20 Mar 2026 06:57:16 +0000</pubDate>
      <link>https://dev.to/datalaria/sop-engineering-iv-scaling-to-enterprise-multi-sku-bottlenecks-2hm7</link>
      <guid>https://dev.to/datalaria/sop-engineering-iv-scaling-to-enterprise-multi-sku-bottlenecks-2hm7</guid>
      <description>&lt;p&gt;Your MVP works. One product, one model, one perfect plan. Congratulations: you just solved the easiest problem in Supply Chain.&lt;/p&gt;

&lt;p&gt;Now add 3 products sharing the same factory. Product A needs 14,000 units in July. Product C needs 13,000 that same month. Your factory produces 15,000. &lt;strong&gt;Who gets shorted?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your answer is "we'll figure it out in Thursday's meeting," your company has an engineering problem, not a management one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Executive Summary:&lt;/strong&gt; In chapters &lt;a href="https://dev.to/en/posts/sop_engineering-data-hygiene/"&gt;1&lt;/a&gt;, &lt;a href="https://dev.to/en/posts/sop-engineering-part2-forecasting/"&gt;2&lt;/a&gt; and &lt;a href="https://dev.to/en/posts/sop-engineering-part3-optimization/"&gt;3&lt;/a&gt; we built a working MVP for a single product. In this Chapter 4, we break it. We inject 3 years of history with 3 SKUs of radically different demand profiles (Core, Intermittent, and Seasonal), parallelize Prophet model training with MLOps, and build a unified Linear Programming model where products &lt;em&gt;compete mathematically&lt;/em&gt; for limited factory capacity. Welcome to Theory of Constraints executed in code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Fatal Error: Optimizing in Silos
&lt;/h2&gt;

&lt;p&gt;The biggest sin in Supply Chain Planning isn't using dirty data (we fixed that in &lt;a href="https://dev.to/en/posts/sop_engineering-data-hygiene/"&gt;Chapter 1&lt;/a&gt;). It's &lt;strong&gt;optimizing each product as if the factory were infinite&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Imagine three product managers, each with their optimized Excel:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SKU-001 Manager (Core): "I need to produce 6,000/month. Already calculated."&lt;/li&gt;
&lt;li&gt;SKU-002 Manager (Spare Part): "I only need 15/month. No big deal."&lt;/li&gt;
&lt;li&gt;SKU-003 Manager (Seasonal): "In July I need 14,000. Non-negotiable."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sum: 6,000 + 15 + 14,000 = &lt;strong&gt;20,015 units&lt;/strong&gt;. Your factory produces 15,000. Each manager is right individually. Collectively, it's a collapse.&lt;/p&gt;

&lt;p&gt;This is what Eli Goldratt described in &lt;em&gt;The Goal&lt;/em&gt; as &lt;strong&gt;Theory of Constraints&lt;/strong&gt;: the system is not optimized by summing local optima. It's optimized by identifying the bottleneck and letting mathematics allocate the resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stress-Test: The 3 Profiles That Break Your MVP
&lt;/h2&gt;

&lt;p&gt;To validate the Enterprise architecture, we generated a 3-year dataset (2023-2025) with three SKUs designed to break any naïve model:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;SKU&lt;/th&gt;
&lt;th&gt;Profile&lt;/th&gt;
&lt;th&gt;Average Demand&lt;/th&gt;
&lt;th&gt;Trap&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SKU-001&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Core Product&lt;/td&gt;
&lt;td&gt;~200/day&lt;/td&gt;
&lt;td&gt;High variance + 3x Black Friday&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SKU-002&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Intermittent Spare&lt;/td&gt;
&lt;td&gt;~0.6/day&lt;/td&gt;
&lt;td&gt;70% zero-demand days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SKU-003&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Seasonal Summer&lt;/td&gt;
&lt;td&gt;~250/day&lt;/td&gt;
&lt;td&gt;500+ peaks in July, zero in winter&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We injected real ERP noise: outliers (x50), corrupted dates, nulls, negatives. This isn't a toy tutorial. It's what comes out of a production SAP on any given Tuesday.&lt;/p&gt;

&lt;h2&gt;
  
  
  MLOps: Parallelizing the Forecasting
&lt;/h2&gt;

&lt;p&gt;With a single product, training Prophet takes 2 seconds. With 50 SKUs in a &lt;code&gt;for&lt;/code&gt; loop, you wait 100 seconds. With 500, you go home.&lt;/p&gt;

&lt;p&gt;The solution is the same one production pipelines use: &lt;strong&gt;parallelization&lt;/strong&gt;. Each SKU is statistically independent, so each model can train on its own thread:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;concurrent.futures&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ThreadPoolExecutor&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_sku&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df_sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;months&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Worker: trains Prophet for one SKU.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;predictor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ProphetPredictor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df_sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sku_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;predictor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preprocess_daily_aggregation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;predictor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;train_model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;predictor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate_forecast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;months&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;months&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;ThreadPoolExecutor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_workers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;futures&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;process_sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ES&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;sku_dataframes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3 Prophet models, 3 seconds. Not 6. Three. If you add 50 SKUs like any mid-sized company has, the difference between sequential and parallel is the difference between an operational pipeline and a script nobody wants to run.&lt;/p&gt;

&lt;h3&gt;
  
  
  Negative Clipping: The Business Rule Prophet Ignores
&lt;/h3&gt;

&lt;p&gt;Prophet can generate negative predictions. Mathematically it makes sense (the regression doesn't know demand can't be -12 units). Operationally it's a disaster.&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;forecasting_engine_v2.py&lt;/code&gt; applies a &lt;strong&gt;Negative Clipping&lt;/strong&gt; post-prediction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Business Rule: Demand cannot be negative
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yhat&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yhat_lower&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yhat_upper&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;forecast&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;forecast&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;clip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lower&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One line. One fewer production bug. This is what separates MLOps from "Machine Learning in a Jupyter Notebook."&lt;/p&gt;

&lt;h3&gt;
  
  
  Fault Tolerance: One SKU Doesn't Kill the Pipeline
&lt;/h3&gt;

&lt;p&gt;What happens if SKU-002 has only 10 records and Prophet fails? In an amateur script, the entire pipeline dies. In an Enterprise system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sku_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;forecast_df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;future&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;result&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[!!] &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sku_name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: FAILED - &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;skus_failed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;forecasts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;forecast_df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;skus_success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 2 healthy SKUs finish their work. The failed one gets logged. This is the difference between a script and a &lt;strong&gt;system&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Mathematics of Bottlenecks: Unified PuLP Model
&lt;/h2&gt;

&lt;p&gt;Here's the intellectual core of the entire chapter. In &lt;a href="https://dev.to/en/posts/sop-engineering-part3-optimization/"&gt;Chapter 3&lt;/a&gt; we optimized one product. Now we create a &lt;strong&gt;single LP model&lt;/strong&gt; where all SKUs coexist:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ── MULTI-DIMENSIONAL decision variables ──
&lt;/span&gt;&lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="c1"&gt;# How much to produce of SKU s in period t
&lt;/span&gt;&lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# Inventory of SKU s at end of period t
&lt;/span&gt;
&lt;span class="c1"&gt;# ── Objective Function: TOTAL system cost ──
&lt;/span&gt;&lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;lpSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;prod_cost&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;hold_cost&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;skus&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Total_System_Cost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# ── THE KEY CONSTRAINT: Shared Capacity ──
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;lpSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;skus&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;SHARED_MAX_CAPACITY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SharedCapacity_t&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read that last constraint. It's a single line of code, but it contains &lt;strong&gt;Goldratt's entire Theory of Constraints encoded&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lpSum(production[sku][t] for sku in skus) &amp;lt;= 15,000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You're telling the machine: "The factory produces at most 15,000 units per month. I don't care if it's 15,000 of SKU-001 or 7,500 of each. You decide the allocation that minimizes total system cost."&lt;/p&gt;

&lt;p&gt;And the solver decides. No meetings. No politics. No "we always prioritize the big client." Mathematics.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Result: Intelligent Capacity Allocation
&lt;/h2&gt;

&lt;p&gt;Our solver with real Supabase data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  SKU-001: demand=70,879 | prod=70,579 | avg_inv=5,754 | cost=855,394 EUR
  SKU-002: demand=143   | prod=128   | avg_inv=6     | cost=6,775 EUR
  SKU-003: demand=84,298 | prod=84,098 | avg_inv=115   | cost=1,265,970 EUR

  Total production cost:       1,973,660 EUR
  Total holding cost:            154,479 EUR
  ** TOTAL SYSTEM COST:        2,128,139 EUR **
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Observe the decisions the algorithm made:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SKU-001&lt;/strong&gt; (prod_cost=€10, hold_cost=€2): Cheap to store. The solver produces ahead during cheap months and stockpiles inventory (avg 5,754 units). Intelligent pre-build.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SKU-002&lt;/strong&gt; (prod_cost=€50, hold_cost=€5): Expensive part. Strict just-in-time production (avg_inv=6 units). Doesn't stockpile a single extra piece.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SKU-003&lt;/strong&gt; (seasonal): Minimum inventory at safety stock. Produces exactly what it needs each month, following the seasonal wave.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No human with Excel can calculate this with 3 products and 13 months. And they definitely can't recalculate it every week when the forecast changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Ah-Ha Moment: The Bottleneck Visualized
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejhi06mkgyim7edsj3x3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejhi06mkgyim7edsj3x3.png" alt="Multi-SKU shared production capacity: the red line marks the factory limit" width="800" height="381"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Look at the summer months. Combined demand from the 3 SKUs exceeds factory capacity (red line). What does the algorithm do? Instead of breaking stock, it decides to advance production of the cheapest-to-store SKU (SKU-001) to spring, freeing factory space for the critical seasonal product (SKU-003) in summer. This is Theory of Constraints executed by a machine.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you look at the chart, it seems like SKU-002 (spare parts) doesn't exist. But it's there. It represents 0.1% of the factory's volume, but in manual management, it usually consumes 20% of the planner's mental time due to its high volatility. By delegating this to a Linear Programming model, the system manages large volumes and the long tail simultaneously without stress.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Kitchen: Break the System
&lt;/h2&gt;

&lt;p&gt;I distrust theories that can't be put into practice. I've prepared a new Enterprise Google Colab where you can run the most revealing experiment of the entire series:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lower the &lt;code&gt;SHARED_MAX_CAPACITY&lt;/code&gt; variable to 12,000.&lt;/strong&gt; Watch the solver start juggling: it sacrifices SKU-001 inventory to prioritize SKU-003 in July. Lower it to 10,000 and you'll see the model declare &lt;code&gt;INFEASIBLE&lt;/code&gt; — the factory literally cannot meet demand even with the best possible planning. That's your inflection point for investing in capacity expansion.&lt;/p&gt;

&lt;p&gt;📎 &lt;strong&gt;&lt;a href="https://colab.research.google.com/drive/1fBun7rDVGWN7XQGeSUbffm9VuhtTN9Bo?usp=sharing" rel="noopener noreferrer"&gt;Open the Multi-SKU Enterprise Google Colab&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Change the maximum factory capacity, modify holding costs, add a fourth SKU. Do engineering, not faith.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Full Chain: From MVP to Enterprise
&lt;/h2&gt;

&lt;p&gt;With this fourth chapter, we've scaled a single-product prototype to a Multi-SKU Enterprise architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flk4laltppyf60u6lf5zk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flk4laltppyf60u6lf5zk.png" alt="Architecture" width="800" height="748"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Step: The Autonomous Brain
&lt;/h2&gt;

&lt;p&gt;Our Supabase database now has the perfect master plan. Three products, thirteen months, every unit assigned to the optimal month considering costs, seasonality, and physical capacity.&lt;/p&gt;

&lt;p&gt;But databases don't send emails to suppliers. They don't negotiate with plant directors. They don't generate purchase orders at 6am on Monday.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Chapter 5 (Grand Finale)&lt;/strong&gt;, we'll connect this plan to &lt;strong&gt;AI Agents&lt;/strong&gt; (CrewAI) to execute operations autonomously. The algorithm decides how much to buy. The agent executes the purchase. The human... supervises.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The difference between a company that plans and one that optimizes is a mathematical model between its data and its decisions. And between its decisions and its actions, an autonomous agent.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>algorithms</category>
      <category>softwareengineering</category>
      <category>systemdesign</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Ingeniería S&amp;OP IV: Escalando a Enterprise (Multi-SKU y Cuellos de Botella)</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 20 Mar 2026 06:50:04 +0000</pubDate>
      <link>https://dev.to/datalaria/ingenieria-sop-iv-escalando-a-enterprise-multi-sku-y-cuellos-de-botella-35d4</link>
      <guid>https://dev.to/datalaria/ingenieria-sop-iv-escalando-a-enterprise-multi-sku-y-cuellos-de-botella-35d4</guid>
      <description>&lt;p&gt;Tu MVP funciona. Un producto, un modelo, un plan perfecto. Enhorabuena: acabas de resolver el problema más fácil del universo de Supply Chain.&lt;/p&gt;

&lt;p&gt;Ahora mete 3 productos que comparten la misma fábrica. El Producto A necesita 14.000 unidades en julio. El Producto C necesita 13.000 ese mismo mes. Tu fábrica produce 15.000. &lt;strong&gt;¿A quién dejas sin stock?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Si tu respuesta es "lo vemos en la reunión del jueves", tu empresa tiene un problema de ingeniería, no de gestión.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Executive Summary:&lt;/strong&gt; En los capítulos &lt;a href="https://dev.to/es/posts/sop_ingenieria-higiene-datos/"&gt;1&lt;/a&gt;, &lt;a href="https://dev.to/es/posts/sop-ingenieria-parte2-prediccion/"&gt;2&lt;/a&gt; y &lt;a href="https://dev.to/es/posts/sop-ingenieria-parte3-optimizacion/"&gt;3&lt;/a&gt; construimos un MVP funcional para un solo producto. En este Capítulo 4, lo destruimos. Inyectamos 3 años de histórico con 3 SKUs de perfiles radicalmente distintos, paralelizamos el entrenamiento de modelos Prophet con MLOps, y construimos un modelo unificado de Programación Lineal donde los productos &lt;em&gt;compiten matemáticamente&lt;/em&gt; por una capacidad de fábrica limitada. Bienvenido a la Theory of Constraints ejecutada en código.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  El Error Fatal: Optimizar en Silos
&lt;/h2&gt;

&lt;p&gt;El mayor pecado en Supply Chain Planning no es usar datos sucios (eso lo resolvimos en el &lt;a href="https://dev.to/es/posts/sop_ingenieria-higiene-datos/"&gt;Capítulo 1&lt;/a&gt;). Es &lt;strong&gt;optimizar cada producto como si la fábrica fuera infinita&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Imagina tres directores de producto, cada uno con su Excel optimizado:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Director del SKU-001 (Core): "Necesito producir 6.000/mes. Ya está calculado."&lt;/li&gt;
&lt;li&gt;Director del SKU-002 (Spare Part): "Solo necesito 15/mes. Sin problema."&lt;/li&gt;
&lt;li&gt;Director del SKU-003 (Seasonal): "En julio necesito 14.000. No negociable."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Suma: 6.000 + 15 + 14.000 = &lt;strong&gt;20.015 unidades&lt;/strong&gt;. Tu fábrica produce 15.000. Cada director tiene razón individualmente. Colectivamente, es un colapso.&lt;/p&gt;

&lt;p&gt;Esto es lo que Eli Goldratt describió en &lt;em&gt;The Goal&lt;/em&gt; como &lt;strong&gt;Theory of Constraints&lt;/strong&gt;: el sistema no se optimiza sumando óptimos locales. Se optimiza identificando el cuello de botella y dejando que las matemáticas repartan los recursos.&lt;/p&gt;

&lt;h2&gt;
  
  
  Estrés-Test: Los 3 Perfiles que Rompen tu MVP
&lt;/h2&gt;

&lt;p&gt;Para validar la arquitectura Enterprise, generamos un dataset de 3 años (2023-2025) con tres SKUs diseñados para romper cualquier modelo naïve:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;SKU&lt;/th&gt;
&lt;th&gt;Perfil&lt;/th&gt;
&lt;th&gt;Demanda Media&lt;/th&gt;
&lt;th&gt;Trampa&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SKU-001&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Core Product&lt;/td&gt;
&lt;td&gt;~200/día&lt;/td&gt;
&lt;td&gt;Alta varianza + Black Friday 3x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SKU-002&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Intermittent Spare&lt;/td&gt;
&lt;td&gt;~0.6/día&lt;/td&gt;
&lt;td&gt;70% días con demanda cero&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SKU-003&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Seasonal Summer&lt;/td&gt;
&lt;td&gt;~250/día&lt;/td&gt;
&lt;td&gt;Picos de 500+ en julio, cero en invierno&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Le inyectamos ruido ERP real: outliers (x50), fechas corruptas, nulos, negativos. Esto no es un tutorial de juguete. Es lo que sale de un SAP en producción un martes cualquiera.&lt;/p&gt;

&lt;h2&gt;
  
  
  MLOps: Paralelizando el Forecasting
&lt;/h2&gt;

&lt;p&gt;Con un solo producto, entrenar Prophet toma 2 segundos. Con 50 SKUs en un bucle &lt;code&gt;for&lt;/code&gt;, esperas 100 segundos. Con 500, te vas a casa.&lt;/p&gt;

&lt;p&gt;La solución es la misma que usan los pipelines de producción: &lt;strong&gt;paralelización&lt;/strong&gt;. Cada SKU es independiente estadísticamente, así que cada modelo puede entrenarse en su propio thread:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;concurrent.futures&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ThreadPoolExecutor&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_sku&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df_sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;months&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Worker: entrena Prophet para un SKU.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;predictor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ProphetPredictor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df_sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sku_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;predictor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preprocess_daily_aggregation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;predictor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;train_model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;predictor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate_forecast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;months&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;months&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;ThreadPoolExecutor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_workers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;futures&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;process_sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ES&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;sku_dataframes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3 modelos Prophet, 3 segundos. No 6. Tres. Si agregas 50 SKUs como tiene cualquier PYME mediana, la diferencia entre secuencial y paralelo es la diferencia entre un pipeline operativo y un script que nadie quiere ejecutar.&lt;/p&gt;

&lt;h3&gt;
  
  
  Negative Clipping: La Regla de Negocio que Prophet Ignora
&lt;/h3&gt;

&lt;p&gt;Prophet puede generar predicciones negativas. Matemáticamente tiene sentido (la regresión no sabe que la demanda no puede ser -12 unidades). Operativamente es un desastre.&lt;/p&gt;

&lt;p&gt;Nuestro &lt;code&gt;forecasting_engine_v2.py&lt;/code&gt; aplica un &lt;strong&gt;Negative Clipping&lt;/strong&gt; post-predicción:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Business Rule: La demanda no puede ser negativa
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yhat&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yhat_lower&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yhat_upper&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;forecast&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;forecast&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;clip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lower&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Una línea. Un error en producción menos. Esto es lo que separa MLOps de "Machine Learning en un Jupyter Notebook".&lt;/p&gt;

&lt;h3&gt;
  
  
  Fault Tolerance: Un SKU No Mata al Pipeline
&lt;/h3&gt;

&lt;p&gt;¿Qué pasa si el SKU-002 tiene solo 10 registros y Prophet falla? En un script amateur, el pipeline entero muere. En un sistema Enterprise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sku_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;forecast_df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;future&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;result&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[!!] &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sku_name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: FAILED - &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;skus_failed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;forecasts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;forecast_df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;skus_success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Los 2 SKUs sanos terminan su trabajo. El que falló queda en el log. Esto es la diferencia entre un script y un &lt;strong&gt;sistema&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  La Matemática del Bottleneck: PuLP Unificado
&lt;/h2&gt;

&lt;p&gt;Aquí está el núcleo intelectual de todo el capítulo. En el &lt;a href="https://dev.to/es/posts/sop-ingenieria-parte3-optimizacion/"&gt;Capítulo 3&lt;/a&gt; optimizamos un producto. Ahora creamos un &lt;strong&gt;único modelo LP&lt;/strong&gt; donde todos los SKUs coexisten:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ── Variables de decisión MULTI-DIMENSIONALES ──
&lt;/span&gt;&lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="c1"&gt;# Cuánto fabricar del SKU s en el periodo t
&lt;/span&gt;&lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# Inventario del SKU s al final del periodo t
&lt;/span&gt;
&lt;span class="c1"&gt;# ── Función Objetivo: Coste TOTAL del sistema ──
&lt;/span&gt;&lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;lpSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;prod_cost&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;hold_cost&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;skus&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Total_System_Cost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# ── LA RESTRICCIÓN CLAVE: Capacidad Compartida ──
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;lpSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sku&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;skus&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;SHARED_MAX_CAPACITY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SharedCapacity_t&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lee esa última restricción. Es una sola línea de código, pero contiene &lt;strong&gt;toda la teoría de restricciones de Goldratt codificada&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lpSum(production[sku][t] for sku in skus) &amp;lt;= 15,000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Le estás diciendo a la máquina: "La fábrica produce máximo 15.000 unidades al mes. Me da igual si es 15.000 de SKU-001 o 7.500 de cada uno. Tú decides el reparto que minimice el coste total del sistema."&lt;/p&gt;

&lt;p&gt;Y el solver decide. Sin reuniones. Sin política. Sin "siempre le damos prioridad al cliente grande". Matemáticas.&lt;/p&gt;

&lt;h2&gt;
  
  
  El Resultado: Asignación Inteligente de Capacidad
&lt;/h2&gt;

&lt;p&gt;Nuestro solver con datos reales de Supabase:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  SKU-001: demand=70,879 | prod=70,579 | avg_inv=5,754 | cost=855,394 EUR
  SKU-002: demand=143   | prod=128   | avg_inv=6     | cost=6,775 EUR
  SKU-003: demand=84,298 | prod=84,098 | avg_inv=115   | cost=1,265,970 EUR

  Coste producción total:     1,973,660 EUR
  Coste almacenamiento total:   154,479 EUR
  ** COSTE TOTAL SISTEMA:     2,128,139 EUR **
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Observa las decisiones que tomó el algoritmo:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SKU-001&lt;/strong&gt; (prod_cost=10€, hold_cost=2€): Es barato de almacenar. El solver produce por adelantado en meses baratos y acumula inventario (avg 5.754 uds). Pre-build inteligente.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SKU-002&lt;/strong&gt; (prod_cost=50€, hold_cost=5€): Pieza cara. Producción just-in-time estricta (avg_inv=6 uds). No stockea ni una pieza de más.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SKU-003&lt;/strong&gt; (estacional): Inventario mínimo en safety stock. Produce exactamente lo que necesita cada mes siguiendo la ola estacional.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ningún humano con Excel puede calcular esto con 3 productos y 13 meses. Y definitivamente no puede recalcularlo cada semana cuando cambia el forecast.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Ah-Ha Moment: El Cuello de Botella Visual
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftytx3vs4bflvg67v8jw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftytx3vs4bflvg67v8jw2.png" alt="Capacidad de producción compartida Multi-SKU: la línea roja marca el límite de fábrica" width="800" height="381"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Observa los meses de verano. La demanda combinada de los 3 SKUs supera la capacidad de la fábrica (línea roja). ¿Qué hace el algoritmo? En lugar de romper stock, decide adelantar la producción del SKU más barato de almacenar (SKU-001) a primavera, dejando hueco en la fábrica para el producto estacional crítico (SKU-003) en verano. Esto es Theory of Constraints ejecutada por una máquina.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Si miras la gráfica, parece que el SKU-002 (repuestos) no existe. Pero está ahí. Representa el 0,1% del volumen de la fábrica, pero en la gestión manual suele consumir el 20% del tiempo mental del planificador por su alta volatilidad. Al delegar esto a un modelo de Programación Lineal, el sistema gestiona los grandes volúmenes y la larga cola simultáneamente sin estrés.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Kitchen: Rompe el Sistema
&lt;/h2&gt;

&lt;p&gt;Desconfío de las teorías que no se pueden poner en práctica. He preparado un nuevo Google Colab Enterprise donde puedes hacer el experimento más revelador de toda la serie:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Baja la variable &lt;code&gt;SHARED_MAX_CAPACITY&lt;/code&gt; a 12.000.&lt;/strong&gt; Observa cómo el solver empieza a hacer malabares extremos: sacrifica inventario de SKU-001 para dar prioridad a SKU-003 en julio. Bájala a 10.000 y verás el modelo declarar &lt;code&gt;INFEASIBLE&lt;/code&gt; — la fábrica literalmente no puede satisfacer la demanda ni con la mejor planificación posible. Ese es tu punto de inflexión para invertir en ampliar capacidad.&lt;/p&gt;

&lt;p&gt;📎 &lt;strong&gt;&lt;a href="https://colab.research.google.com/drive/1fBun7rDVGWN7XQGeSUbffm9VuhtTN9Bo?usp=sharing" rel="noopener noreferrer"&gt;Abrir el Google Colab Multi-SKU Enterprise&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cambia la capacidad máxima de la fábrica, modifica los costes de almacenamiento, añade un cuarto SKU. Haz ingeniería, no fe.&lt;/p&gt;

&lt;h2&gt;
  
  
  La Cadena Completa: De MVP a Enterprise
&lt;/h2&gt;

&lt;p&gt;Con este cuarto capítulo, hemos escalado un prototipo de un solo producto a una arquitectura Enterprise Multi-SKU:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8jotm51p4co6qa9t6ul.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8jotm51p4co6qa9t6ul.png" alt="Arquitectura" width="800" height="739"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Siguiente Paso: El Cerebro Autónomo
&lt;/h2&gt;

&lt;p&gt;Nuestra base de datos Supabase ya tiene el plan maestro perfecto. Tres productos, trece meses, cada unidad asignada al mes óptimo considerando costes, estacionalidad y capacidad física.&lt;/p&gt;

&lt;p&gt;Pero las bases de datos no envían emails a proveedores. No negocian con los directores de planta. No generan las órdenes de compra a las 6am del lunes.&lt;/p&gt;

&lt;p&gt;En el &lt;strong&gt;Capítulo 5 (Gran Final)&lt;/strong&gt;, conectaremos este plan a &lt;strong&gt;Agentes de Inteligencia Artificial&lt;/strong&gt; (CrewAI) para que ejecuten las operaciones de forma autónoma. El algoritmo decide cuánto comprar. El agente ejecuta la compra. El humano... supervisa.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;La diferencia entre una empresa que planifica y una que se optimiza es un modelo matemático entre sus datos y sus decisiones. Y entre sus decisiones y sus acciones, un agente autónomo.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>algorithms</category>
      <category>datascience</category>
      <category>softwareengineering</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Ingeniería S&amp;OP III: El Fin de Excel (Programación Lineal para Supply Planning)</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 13 Mar 2026 07:25:29 +0000</pubDate>
      <link>https://dev.to/datalaria/ingenieria-sop-iii-el-fin-de-excel-programacion-lineal-para-supply-planning-6j7</link>
      <guid>https://dev.to/datalaria/ingenieria-sop-iii-el-fin-de-excel-programacion-lineal-para-supply-planning-6j7</guid>
      <description>&lt;p&gt;"Siempre queremos X semanas de cobertura." Esta frase, repetida como mantra en todas las reuniones de S&amp;amp;OP del planeta, es financieramente tóxica.&lt;/p&gt;

&lt;p&gt;¿Por qué? Porque es una &lt;strong&gt;regla fija aplicada a un sistema dinámico&lt;/strong&gt;. Si tu demanda en enero es 200 unidades y en julio es 20, te estás obligando a mantener 800 y 80 unidades respectivamente "por si acaso". En enero te queda corto. En julio inmovilizas capital sin motivo.&lt;/p&gt;

&lt;p&gt;La alternativa no es intuición más sofisticada. Es &lt;strong&gt;matemáticas&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Resumen Ejecutivo:&lt;/strong&gt; En este capítulo, conectamos el forecast probabilístico del &lt;a href="https://dev.to/es/posts/sop-ingenieria-parte2-prediccion/"&gt;Capítulo 2&lt;/a&gt; con un motor de Programación Lineal (PuLP) que calcula el plan de producción exacto que minimiza el coste total (producción + almacenamiento) respetando la restricción de Safety Stock. Pasamos de la predicción pasiva a la prescripción activa.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Del Forecast a la Decisión: Arquitectura
&lt;/h2&gt;

&lt;p&gt;En el &lt;a href="https://dev.to/es/posts/sop_ingenieria-higiene-datos/"&gt;Capítulo 1&lt;/a&gt; limpiamos la señal. En el &lt;a href="https://dev.to/es/posts/sop-ingenieria-parte2-prediccion/"&gt;Capítulo 2&lt;/a&gt; predijimos la demanda. Ahora damos el paso que Excel no puede dar: &lt;strong&gt;optimizar&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Nuestro pipeline en GitHub se conecta a Supabase, lee la tabla &lt;code&gt;demand_forecasts&lt;/code&gt; (el futuro que predijimos), y genera una nueva tabla &lt;code&gt;supply_plans&lt;/code&gt;. El sistema ha pasado de &lt;strong&gt;descriptivo&lt;/strong&gt; (¿qué pasó?) a &lt;strong&gt;predictivo&lt;/strong&gt; (¿qué pasará?) y ahora a &lt;strong&gt;prescriptivo&lt;/strong&gt; (¿qué debo hacer?).&lt;/p&gt;

&lt;p&gt;Esto es Investigación Operativa. La misma disciplina que optimiza rutas aéreas, logística militar y cadenas de suministro globales. Y la ejecutamos con 50 líneas de Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  Las Matemáticas del Negocio
&lt;/h2&gt;

&lt;p&gt;No vamos a esconder las ecuaciones. Son el corazón de la decisión. Aquí está el fragmento central de nuestra clase &lt;code&gt;SupplyOptimizer&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Función Objetivo: Minimizar coste total
&lt;/span&gt;&lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;pulp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lpSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;production_cost&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;holding_cost&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Total_Cost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# Restricción: Balance de Inventario (Ley de Conservación de Masas)
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;prev_inv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;initial_inventory&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;prev_inv&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;demand&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Balance_t&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Restricción: Safety Stock (Política de Riesgo)
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;safety_stock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SafetyStock_t&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tres decisiones de ingeniería que merecen explicación:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;La Función Objetivo&lt;/strong&gt; no busca "tener mucho stock" ni "producir mucho". Busca el &lt;strong&gt;mínimo coste financiero&lt;/strong&gt;: el equilibrio entre fabricar (caro) y almacenar (caro también). El solver encuentra automáticamente el punto exacto donde el coste combinado es mínimo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;El Balance de Masas&lt;/strong&gt; es una restricción física: no puedes vender lo que no tienes. El inventario de hoy es el de ayer, más lo que fabricas hoy, menos lo que vendes. No hay magia. Las ecuaciones prohíben las trampas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;El Safety Stock&lt;/strong&gt; es la política de riesgo: nunca permitas que el inventario baje por debajo de un mínimo de seguridad. En nuestro caso, 1,5 meses de demanda media. Esto lo calcula el sistema, no una hoja de cálculo con un número puesto a dedo.&lt;/p&gt;

&lt;h2&gt;
  
  
  El Plan Maestro: De Algoritmo a Decisión de Negocio
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ok0n4rvkhdsv6kouhk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ok0n4rvkhdsv6kouhk2.png" alt="Plan Maestro de Producción optimizado con PuLP: producción, inventario y Safety Stock por mes" width="800" height="381"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Esto es lo que el Director de Operaciones necesita ver. El algoritmo no fabrica uniformemente: si detecta un pico enorme de demanda en un periodo, decide "pre-construir" (pre-build) inventario en los meses anteriores para aplanar la carga de producción. Si el Holding Cost es alto, mantiene el almacén vacío y fabrica Just-in-Time. Excel no hace esto solo; las matemáticas sí.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;El resultado de nuestro solver con los datos de prueba:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Coste de producción:&lt;/strong&gt; 1.680 EUR&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coste de almacenamiento:&lt;/strong&gt; 540 EUR&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coste total optimizado:&lt;/strong&gt; 2.220 EUR&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Este número no es una estimación. Es el &lt;strong&gt;mínimo global demostrable&lt;/strong&gt; dadas las restricciones. Si alguien propone un plan más barato con los mismos parámetros, está violando alguna restricción.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Kitchen: Juega con el Solver
&lt;/h2&gt;

&lt;p&gt;Desconfío de las teorías que no se pueden poner en práctica. Por eso, he preparado un Google Colab donde puedes ejecutar el optimizador sobre un snapshot de nuestros datos reales.&lt;/p&gt;

&lt;p&gt;El experimento más revelador: &lt;strong&gt;cambia el &lt;code&gt;holding_cost&lt;/code&gt; a un valor altísimo&lt;/strong&gt; (por ejemplo, 50 EUR/unidad). Observa cómo el algoritmo, automáticamente, decide fabricar Just-in-Time y mantener el almacén prácticamente vacío. Luego baja el coste de producción y mira cómo prefiere fabricar de golpe y almacenar. Las matemáticas se adaptan. Las reglas fijas de Excel, no.&lt;/p&gt;

&lt;p&gt;📎 &lt;strong&gt;&lt;a href="https://colab.research.google.com/drive/1fF9DY-eHL13G0AFg_geNxQ6duEMOWy4N?usp=sharing" rel="noopener noreferrer"&gt;Abrir el Google Colab Interactivo&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Modifica los costes, las restricciones de capacidad, el Safety Stock. Haz ingeniería, no fe.&lt;/p&gt;

&lt;h2&gt;
  
  
  La cadena completa: De Datos a Decisiones
&lt;/h2&gt;

&lt;p&gt;Con este tercer capítulo, hemos construido un sistema S&amp;amp;OP end-to-end que va desde el CSV sucio del ERP hasta un plan de producción óptimo:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faq4ox49h4krzu7gtn9en.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faq4ox49h4krzu7gtn9en.png" alt="arquitectura" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Siguiente Paso: Escalando a Enterprise
&lt;/h2&gt;

&lt;p&gt;Ya tenemos el plan perfecto en nuestra base de datos. Pero solo para un producto. ¿Qué pasa cuando metes 3 SKUs que comparten la misma fábrica?&lt;/p&gt;

&lt;p&gt;En el &lt;a href="https://dev.to/es/posts/sop-ingenieria-parte4-enterprise/"&gt;Capítulo 4&lt;/a&gt; rompemos el MVP: inyectamos datos multi-producto con perfiles radicalmente distintos, paralelizamos el forecasting con &lt;strong&gt;MLOps&lt;/strong&gt;, y construimos un modelo unificado de Programación Lineal donde los productos &lt;em&gt;compiten matemáticamente&lt;/em&gt; por la capacidad de producción compartida.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;La diferencia entre un Director de Operaciones que planifica y uno que optimiza es una función objetivo entre su intuición y la realidad.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>algorithms</category>
      <category>datascience</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>S&amp;OP Engineering III: The End of Excel (Linear Programming for Supply Planning)</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Fri, 13 Mar 2026 07:16:12 +0000</pubDate>
      <link>https://dev.to/datalaria/sop-engineering-iii-the-end-of-excel-linear-programming-for-supply-planning-20do</link>
      <guid>https://dev.to/datalaria/sop-engineering-iii-the-end-of-excel-linear-programming-for-supply-planning-20do</guid>
      <description>&lt;p&gt;"We always want 4 weeks of coverage." This phrase, repeated like a mantra in every S&amp;amp;OP meeting on the planet, is financially toxic.&lt;/p&gt;

&lt;p&gt;Why? Because it's a &lt;strong&gt;fixed rule applied to a dynamic system&lt;/strong&gt;. If your demand in January is 200 units and in July is 20, you're forcing yourself to maintain 800 and 80 units respectively "just in case." January falls short. July immobilizes capital for no reason.&lt;/p&gt;

&lt;p&gt;The alternative isn't more sophisticated intuition. It's &lt;strong&gt;mathematics&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Executive Summary:&lt;/strong&gt; In this chapter, we connect the probabilistic forecast from &lt;a href="https://dev.to/en/posts/sop-engineering-part2-forecasting/"&gt;Chapter 2&lt;/a&gt; with a Linear Programming engine (PuLP) that calculates the exact production plan minimizing total cost (production + storage) while respecting Safety Stock constraints. We move from passive prediction to active prescription.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  From Forecast to Decision: Architecture
&lt;/h2&gt;

&lt;p&gt;In &lt;a href="https://dev.to/en/posts/sop_engineering-data-hygiene/"&gt;Chapter 1&lt;/a&gt; we cleaned the signal. In &lt;a href="https://dev.to/en/posts/sop-engineering-part2-forecasting/"&gt;Chapter 2&lt;/a&gt; we predicted demand. Now we take the step Excel can't: &lt;strong&gt;optimize&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Our pipeline on GitHub connects to Supabase, reads the &lt;code&gt;demand_forecasts&lt;/code&gt; table (the future we predicted), and generates a new &lt;code&gt;supply_plans&lt;/code&gt; table. The system has evolved from &lt;strong&gt;descriptive&lt;/strong&gt; (what happened?) to &lt;strong&gt;predictive&lt;/strong&gt; (what will happen?) and now to &lt;strong&gt;prescriptive&lt;/strong&gt; (what should I do?).&lt;/p&gt;

&lt;p&gt;This is Operations Research. The same discipline that optimizes airline routes, military logistics, and global supply chains. And we run it with 50 lines of Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Mathematics of Business
&lt;/h2&gt;

&lt;p&gt;We're not going to hide the equations. They're the heart of the decision. Here's the core fragment from our &lt;code&gt;SupplyOptimizer&lt;/code&gt; class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Objective Function: Minimize total cost
&lt;/span&gt;&lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;pulp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lpSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;production_cost&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;holding_cost&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Total_Cost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# Constraint: Inventory Balance (Conservation of Mass)
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;prev_inv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;initial_inventory&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;prev_inv&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;production&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;demand&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Balance_t&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Constraint: Safety Stock (Risk Policy)
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;problem&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;safety_stock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SafetyStock_t&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three engineering decisions worth explaining:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Objective Function&lt;/strong&gt; doesn't seek "lots of stock" or "high production." It seeks the &lt;strong&gt;minimum financial cost&lt;/strong&gt;: the equilibrium between manufacturing (expensive) and storing (also expensive). The solver automatically finds the exact point where the combined cost is minimal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Mass Balance&lt;/strong&gt; is a physical constraint: you can't sell what you don't have. Today's inventory equals yesterday's, plus what you produce today, minus what you sell. No magic. The equations forbid cheating.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Safety Stock&lt;/strong&gt; is the risk policy: never let inventory drop below a safety minimum. In our case, 1.5 months of average demand. The system calculates this, not a spreadsheet with a number pulled from thin air.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Master Plan: From Algorithm to Business Decision
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93llj7uugc7m6rhpx0jt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93llj7uugc7m6rhpx0jt.png" alt="Master Production Schedule optimized with PuLP: production, inventory, and Safety Stock by month" width="800" height="381"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;This is what the Operations Director needs to see. The algorithm doesn't produce uniformly: if it detects a massive demand spike in one period, it decides to "pre-build" inventory in preceding months to flatten the production load. If Holding Cost is high, it keeps the warehouse empty and manufactures Just-in-Time. Excel doesn't do this on its own; mathematics does.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The result from our solver with test data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Production cost:&lt;/strong&gt; €1,680&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage cost:&lt;/strong&gt; €540&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Total optimized cost:&lt;/strong&gt; €2,220&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This number is not an estimate. It's the &lt;strong&gt;provable global minimum&lt;/strong&gt; given the constraints. If someone proposes a cheaper plan with the same parameters, they're violating a constraint.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Kitchen: Play with the Solver
&lt;/h2&gt;

&lt;p&gt;I distrust theories that can't be put into practice. That's why I've prepared a Google Colab where you can run the optimizer on a snapshot of our real data.&lt;/p&gt;

&lt;p&gt;The most revealing experiment: &lt;strong&gt;change &lt;code&gt;holding_cost&lt;/code&gt; to an extremely high value&lt;/strong&gt; (e.g., €50/unit). Watch how the algorithm automatically decides to manufacture Just-in-Time and keep the warehouse practically empty. Then lower the production cost and watch it prefer to produce in bulk and store. Mathematics adapts. Excel's fixed rules don't.&lt;/p&gt;

&lt;p&gt;📎 &lt;strong&gt;&lt;a href="https://colab.research.google.com/drive/1fF9DY-eHL13G0AFg_geNxQ6duEMOWy4N?usp=sharing" rel="noopener noreferrer"&gt;Open the Interactive Google Colab&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Modify the costs, capacity constraints, Safety Stock. Do engineering, not faith.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Complete Chain: From Data to Decisions
&lt;/h2&gt;

&lt;p&gt;With this third chapter, we've built an end-to-end S&amp;amp;OP system that goes from a dirty ERP CSV to an optimal production plan:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0m8h1nfmbgusp0vxnl4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0m8h1nfmbgusp0vxnl4.png" alt="architecture" width="800" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Step: Scaling to Enterprise
&lt;/h2&gt;

&lt;p&gt;We now have the perfect plan in our database. But only for one product. What happens when you add 3 SKUs sharing the same factory?&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://dev.to/en/posts/sop-engineering-part4-enterprise/"&gt;Chapter 4&lt;/a&gt; we break the MVP: we inject multi-product data with radically different profiles, parallelize the forecasting with &lt;strong&gt;MLOps&lt;/strong&gt;, and build a unified Linear Programming model where products &lt;em&gt;compete mathematically&lt;/em&gt; for shared production capacity.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The difference between an Operations Director who plans and one who optimizes is an objective function between their intuition and reality.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>algorithms</category>
      <category>datascience</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Ingeniería S&amp;OP II: Demand Planning, de la Adivinación a la Probabilidad</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Sat, 07 Mar 2026 08:36:47 +0000</pubDate>
      <link>https://dev.to/datalaria/ingenieria-sop-ii-demand-planning-de-la-adivinacion-a-la-probabilidad-15m2</link>
      <guid>https://dev.to/datalaria/ingenieria-sop-ii-demand-planning-de-la-adivinacion-a-la-probabilidad-15m2</guid>
      <description>&lt;p&gt;Tu Excel dice "venderemos 100 unidades". Es un número redondo, bonito, determinista. ¿Y si vendes 120? Rotura de stock, cliente insatisfecho, penalización contractual. ¿Y si vendes 50? 50 unidades ocupando almacén, inmovilizando capital que podría estar generando rendimiento.&lt;/p&gt;

&lt;p&gt;El problema no es la predicción en sí. Es la &lt;strong&gt;arrogancia del número único&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;En el &lt;a href="https://dev.to/es/posts/sop_ingenieria-higiene-datos/"&gt;Capítulo 1&lt;/a&gt; construimos una "Válvula de Calidad" que elimina el ruido de los datos del ERP. Ahora que tenemos una señal pura, vamos a hacer algo que Excel no puede: &lt;strong&gt;medir la incertidumbre&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Resumen Ejecutivo:&lt;/strong&gt; Un forecast probabilístico no te dice "venderás 100". Te dice "con un 95% de probabilidad, venderás entre 35 y 157". Esa banda de incertidumbre es la base matemática para calcular tu Safety Stock sin recurrir a reglas de dedo.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  La Arquitectura: MLOps, no Scripts
&lt;/h2&gt;

&lt;p&gt;No hemos escrito un script de usar y tirar. Hemos conectado nuestro cerebro matemático (Python/Prophet) directamente a nuestra Single Source of Truth (Supabase/PostgreSQL).&lt;/p&gt;

&lt;p&gt;El diseño clave es la tabla &lt;code&gt;demand_forecasts&lt;/code&gt;. Observa una columna que la diferencia de un tutorial básico:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;demand_forecasts&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt;              &lt;span class="n"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;uuid_generate_v4&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="n"&gt;execution_date&lt;/span&gt;  &lt;span class="nb"&gt;DATE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;-- ← Cuándo corrimos el modelo&lt;/span&gt;
    &lt;span class="n"&gt;ds&lt;/span&gt;              &lt;span class="nb"&gt;DATE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;-- Fecha futura predicha&lt;/span&gt;
    &lt;span class="n"&gt;yhat&lt;/span&gt;            &lt;span class="nb"&gt;NUMERIC&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- Predicción central&lt;/span&gt;
    &lt;span class="n"&gt;yhat_lower&lt;/span&gt;      &lt;span class="nb"&gt;NUMERIC&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- Límite inferior (Safety Stock)&lt;/span&gt;
    &lt;span class="n"&gt;yhat_upper&lt;/span&gt;      &lt;span class="nb"&gt;NUMERIC&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- Límite superior (Riesgo)&lt;/span&gt;
    &lt;span class="n"&gt;model_version&lt;/span&gt;   &lt;span class="nb"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;-- Trazabilidad&lt;/span&gt;
    &lt;span class="k"&gt;UNIQUE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;execution_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="c1"&gt;-- Un forecast por ejecución y fecha&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;¿Por qué &lt;code&gt;execution_date&lt;/code&gt;?&lt;/strong&gt; Porque dentro de 6 meses, cuando quieras auditar si tu modelo era preciso, necesitas saber &lt;em&gt;cuándo&lt;/em&gt; hiciste la predicción frente a &lt;em&gt;qué ocurrió realmente&lt;/em&gt;. Esto es lo que en MLOps se llama &lt;strong&gt;Snapshotting&lt;/strong&gt;: registrar el contexto de cada ejecución para poder evaluar el drift del modelo a lo largo del tiempo.&lt;/p&gt;

&lt;p&gt;Sin esta columna, tienes un modelo. Con ella, tienes un &lt;strong&gt;sistema auditable&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  La Ingeniería: Por qué Prophet (y no un ARIMA de manual)
&lt;/h2&gt;

&lt;p&gt;Prophet es un motor de series temporales desarrollado por Meta que fue diseñado para datos de negocio irregulares: gaps, festivos, cambios de tendencia. Exactamente lo que tiene una cadena de suministro real.&lt;/p&gt;

&lt;p&gt;Aquí está el fragmento central de nuestra clase &lt;code&gt;ProphetPredictor&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;train_model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ES&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Entrena Prophet con dos configuraciones clave para S&amp;amp;OP:
    - interval_width: Ancho del intervalo de confianza
    - country_holidays: Contexto operativo del país
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Prophet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;interval_width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;# ← Intervalo de confianza del 95%
&lt;/span&gt;        &lt;span class="n"&gt;weekly_seasonality&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;yearly_seasonality&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Festivos que alteran patrones de carga/descarga
&lt;/span&gt;    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_country_holidays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;country_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ts_df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dos decisiones de ingeniería que nos separan de un tutorial de YouTube:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;interval_width=0.95&lt;/code&gt;&lt;/strong&gt;: No es un parámetro decorativo. El límite superior (&lt;code&gt;yhat_upper&lt;/code&gt;) representa la demanda máxima probable con un 95% de confianza. Esto es literalmente tu base de cálculo para el &lt;strong&gt;Safety Stock&lt;/strong&gt;: &lt;code&gt;Safety Stock = yhat_upper - yhat&lt;/code&gt;. Sin este intervalo, tu stock de seguridad es una corazonada; con él, es matemática.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;add_country_holidays('ES')&lt;/code&gt;&lt;/strong&gt;: En S&amp;amp;OP, los festivos no son "días libres". Son anomalías operativas: la fábrica cierra, el almacén no despacha, el transporte para. Si el modelo no sabe que el 15 de agosto España está de vacaciones, interpretará la caída de pedidos como una tendencia a la baja. Esto corrompe la predicción de septiembre.&lt;/p&gt;

&lt;h2&gt;
  
  
  Traduciendo Matemáticas a Decisiones de Negocio
&lt;/h2&gt;

&lt;p&gt;La teoría es bonita. Pero un Director General no aprueba presupuestos basándose en código Python. Necesita ver evidencia visual.&lt;/p&gt;

&lt;h3&gt;
  
  
  El Forecast Probabilístico
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhrw0y02xniq787d5pmvk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhrw0y02xniq787d5pmvk.png" alt="Forecast probabilístico de demanda con intervalos de confianza al 95%" width="800" height="412"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Los puntos negros son tu demanda histórica real. La línea azul central es la predicción (yhat). La banda sombreada es el intervalo de confianza al 95%. A mayor volatilidad histórica, más ancha es la banda → más Safety Stock necesitas → más caja inmovilizas. Esta banda es la conversación que deberías tener con tu CFO.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Explicabilidad: Separar Tendencia de Ruido Estacional
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzq4p8b3lmzeb349enfmj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzq4p8b3lmzeb349enfmj.png" alt="Descomposición de componentes del modelo: tendencia, estacionalidad semanal y anual" width="800" height="638"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Esto es XAI (Explainable AI) aplicado al negocio. El modelo separa la Tendencia (¿el negocio crece o decrece?) de la Estacionalidad (¿hay picos por época del año?) y del efecto de los festivos. Esto es lo que el Director General necesita ver para aprobar el plan de operaciones: saber si el crecimiento es real o si es solo un efecto del calendario.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Kitchen: Pruébalo tú mismo
&lt;/h2&gt;

&lt;p&gt;Desconfío de las teorías que no se pueden poner en práctica. Por eso, he preparado un entorno aislado donde puedes entrenar el modelo sobre un snapshot anonimizado de los datos que acabamos de limpiar en el Capítulo 1.&lt;/p&gt;

&lt;p&gt;No necesitas instalar Python, ni Prophet, ni configurar Supabase. Solo necesitas un navegador:&lt;/p&gt;

&lt;p&gt;📎 &lt;strong&gt;&lt;a href="https://colab.research.google.com/drive/1q_iZ3rPmcoXXJ3qXQzSrlxMYCSstyP12?usp=sharing" rel="noopener noreferrer"&gt;Abrir el Notebook interactivo en Google Colab&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dale a "Play" en las celdas y observa cómo se genera un forecast probabilístico con bandas de incertidumbre. Modifica el horizonte, el país, el intervalo de confianza. Haz ingeniería, no fe.&lt;/p&gt;

&lt;h2&gt;
  
  
  Siguiente Paso: De la Predicción a la Decisión
&lt;/h2&gt;

&lt;p&gt;Ahora sabemos la probabilidad de lo que vamos a vender. La pregunta deja de ser &lt;em&gt;"¿cuánto venderemos?"&lt;/em&gt; y pasa a ser &lt;strong&gt;"¿qué debemos fabricar o comprar para maximizar margen y minimizar riesgo?"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;En el Capítulo 3, introduciremos &lt;strong&gt;Optimización Matemática&lt;/strong&gt; (PuLP) y &lt;strong&gt;Teoría de Restricciones&lt;/strong&gt; para transformar las predicciones en decisiones de suministro: cuánto comprar, cuándo producir y cómo distribuir recursos finitos minimizando costes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;La diferencia entre un Director de Operaciones que reacciona y uno que decide es un modelo matemático entre los datos y la acción.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>analytics</category>
      <category>data</category>
      <category>datascience</category>
      <category>spanish</category>
    </item>
    <item>
      <title>S&amp;OP Engineering II: Demand Planning from Guessing to Probability</title>
      <dc:creator>Daniel</dc:creator>
      <pubDate>Sat, 07 Mar 2026 08:30:46 +0000</pubDate>
      <link>https://dev.to/datalaria/sop-engineering-ii-demand-planning-from-guessing-to-probability-d2e</link>
      <guid>https://dev.to/datalaria/sop-engineering-ii-demand-planning-from-guessing-to-probability-d2e</guid>
      <description>&lt;p&gt;Your Excel says "we'll sell 100 units." A round, clean, deterministic number. What if you sell 120? Stockout, unhappy customer, contractual penalty. What if you sell 50? 50 units sitting in your warehouse, immobilizing capital that could be generating returns.&lt;/p&gt;

&lt;p&gt;The problem isn't the forecast itself. It's the &lt;strong&gt;arrogance of the single number&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://dev.to/en/posts/sop_engineering-data-hygiene/"&gt;Chapter 1&lt;/a&gt; we built a "Quality Valve" that filters ERP noise. Now that we have a pure signal, we're going to do something Excel can't: &lt;strong&gt;measure uncertainty&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Executive Summary:&lt;/strong&gt; A probabilistic forecast doesn't tell you "you'll sell 100." It tells you "with 95% probability, you'll sell between 35 and 157." That uncertainty band is the mathematical foundation for calculating your Safety Stock without resorting to rules of thumb.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Architecture: MLOps, Not Scripts
&lt;/h2&gt;

&lt;p&gt;We haven't written a throwaway script. We've connected our mathematical brain (Python/Prophet) directly to our Single Source of Truth (Supabase/PostgreSQL).&lt;/p&gt;

&lt;p&gt;The key design is the &lt;code&gt;demand_forecasts&lt;/code&gt; table. Notice one column that separates this from a basic tutorial:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;demand_forecasts&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt;              &lt;span class="n"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;uuid_generate_v4&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="n"&gt;execution_date&lt;/span&gt;  &lt;span class="nb"&gt;DATE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;-- ← When we ran the model&lt;/span&gt;
    &lt;span class="n"&gt;ds&lt;/span&gt;              &lt;span class="nb"&gt;DATE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;-- Predicted future date&lt;/span&gt;
    &lt;span class="n"&gt;yhat&lt;/span&gt;            &lt;span class="nb"&gt;NUMERIC&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- Central prediction&lt;/span&gt;
    &lt;span class="n"&gt;yhat_lower&lt;/span&gt;      &lt;span class="nb"&gt;NUMERIC&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- Lower bound (Safety Stock)&lt;/span&gt;
    &lt;span class="n"&gt;yhat_upper&lt;/span&gt;      &lt;span class="nb"&gt;NUMERIC&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- Upper bound (Risk)&lt;/span&gt;
    &lt;span class="n"&gt;model_version&lt;/span&gt;   &lt;span class="nb"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;-- Traceability&lt;/span&gt;
    &lt;span class="k"&gt;UNIQUE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;execution_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="c1"&gt;-- One forecast per execution and date&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why &lt;code&gt;execution_date&lt;/code&gt;?&lt;/strong&gt; Because in 6 months, when you want to audit whether your model was accurate, you need to know &lt;em&gt;when&lt;/em&gt; you made the prediction versus &lt;em&gt;what actually happened&lt;/em&gt;. This is what MLOps calls &lt;strong&gt;Snapshotting&lt;/strong&gt;: recording the context of each execution to evaluate model drift over time.&lt;/p&gt;

&lt;p&gt;Without this column, you have a model. With it, you have an &lt;strong&gt;auditable system&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Engineering: Why Prophet (and Not a Textbook ARIMA)
&lt;/h2&gt;

&lt;p&gt;Prophet is a time series engine developed by Meta, designed for irregular business data: gaps, holidays, trend changes. Exactly what a real supply chain has.&lt;/p&gt;

&lt;p&gt;Here's the core fragment from our &lt;code&gt;ProphetPredictor&lt;/code&gt; class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;train_model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ES&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Trains Prophet with two key S&amp;amp;OP configurations:
    - interval_width: Confidence interval width
    - country_holidays: Country operational context
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Prophet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;interval_width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;# ← 95% confidence interval
&lt;/span&gt;        &lt;span class="n"&gt;weekly_seasonality&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;yearly_seasonality&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Holidays that alter loading/unloading patterns
&lt;/span&gt;    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_country_holidays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;country_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;country_code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ts_df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two engineering decisions that separate us from a YouTube tutorial:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;interval_width=0.95&lt;/code&gt;&lt;/strong&gt;: This is not a decorative parameter. The upper bound (&lt;code&gt;yhat_upper&lt;/code&gt;) represents the maximum probable demand with 95% confidence. This is literally your calculation basis for &lt;strong&gt;Safety Stock&lt;/strong&gt;: &lt;code&gt;Safety Stock = yhat_upper - yhat&lt;/code&gt;. Without this interval, your safety stock is a gut feeling; with it, it's mathematics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;add_country_holidays('ES')&lt;/code&gt;&lt;/strong&gt;: In S&amp;amp;OP, holidays aren't "days off." They're operational anomalies: the factory closes, the warehouse doesn't dispatch, transportation stops. If the model doesn't know that August 15th is a national holiday in Spain, it will interpret the drop in orders as a downward trend. This corrupts the September prediction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Translating Math into Business Decisions
&lt;/h2&gt;

&lt;p&gt;Theory is nice. But a CEO doesn't approve budgets based on Python code. They need visual evidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Probabilistic Forecast
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xbkjbkx2kn821qg4d6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xbkjbkx2kn821qg4d6h.png" alt="Probabilistic demand forecast with 95% confidence intervals" width="800" height="412"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The black dots are your actual historical demand. The central blue line is the prediction (yhat). The shaded band is the 95% confidence interval. The greater the historical volatility, the wider the band → the more Safety Stock you need → the more cash you immobilize. This band is the conversation you should be having with your CFO.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Explainability: Separating Trend from Seasonal Noise
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsa3uuq5zm5gu7thld490.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsa3uuq5zm5gu7thld490.png" alt="Model component decomposition: trend, weekly and yearly seasonality" width="800" height="638"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;This is XAI (Explainable AI) applied to business. The model separates Trend (is the business growing or shrinking?) from Seasonality (are there spikes by time of year?) and holiday effects. This is what the CEO needs to see to approve the operations plan: knowing whether growth is real or just a calendar effect.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Kitchen: Try It Yourself
&lt;/h2&gt;

&lt;p&gt;I distrust articles I can't execute. That's why I've prepared an isolated environment where you can train the model on an anonymized snapshot of the data we just cleaned in Chapter 1.&lt;/p&gt;

&lt;p&gt;You don't need to install Python, Prophet, or configure Supabase. You just need a browser:&lt;/p&gt;

&lt;p&gt;📎 &lt;strong&gt;&lt;a href="https://colab.research.google.com/drive/1q_iZ3rPmcoXXJ3qXQzSrlxMYCSstyP12?usp=sharing" rel="noopener noreferrer"&gt;Open the interactive Notebook on Google Colab&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hit "Play" on the cells and watch a probabilistic forecast with uncertainty bands being generated. Modify the horizon, the country, the confidence interval. Do engineering, not faith.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Step: From Prediction to Decision
&lt;/h2&gt;

&lt;p&gt;Now we know the probability of what we're going to sell. The question shifts from &lt;em&gt;"how much will we sell?"&lt;/em&gt; to &lt;strong&gt;"what should we manufacture or purchase to maximize margin and minimize risk?"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In Chapter 3, we'll introduce &lt;strong&gt;Mathematical Optimization&lt;/strong&gt; (PuLP) and &lt;strong&gt;Theory of Constraints&lt;/strong&gt; to transform predictions into supply decisions: how much to buy, when to produce, and how to distribute finite resources while minimizing costs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The difference between an Operations Director who reacts and one who decides is a mathematical model between the data and the action.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>analytics</category>
      <category>dataengineering</category>
      <category>datascience</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
