https://opt-models.org/ |Skip to main content opt-models opt-models Compendium Chapters Welcome! RELEASING NOW: Building the LEGO(r) Opt App [COMING SOON] Magical Opt Programming [COMING SOON] Optimization Toolchain [COMING SOON] Five Parts of an Opt Model [COMING SOON] Dev Creature Comforts [COMING SOON] Practical Optimization Theory [COMING SOON] Speeding Opt Apps [COMING SOON] Optimization Market Predictions [COMING SOON] Optimization [?] AI [COMING SOON] Thank you to … [COMING SOON] Hey, Community! code about [ ] * * Compendium Chapters * Welcome! * RELEASING NOW: Building the LEGO(r) Opt App * [COMING SOON] Magical Opt Programming * [COMING SOON] Optimization Toolchain * [COMING SOON] Five Parts of an Opt Model * [COMING SOON] Dev Creature Comforts * [COMING SOON] Practical Optimization Theory * [COMING SOON] Speeding Opt Apps * [COMING SOON] Optimization Market Predictions * [COMING SOON] Optimization [?] AI * [COMING SOON] Thank you to … * [COMING SOON] Hey, Community! * * code * about Welcome to opt-models! # Conversations about building large-scale optimization models with a focus on speed and modern deployment. 1. Introduction ... Intro to a video series on building mathematical optimization models in the AMPL modeling language, solving these in Gurobi, CPLEX, HiGHS and other linear and nonlinear solvers, deploying models as containerized applications, and more. Discuss on Maven 2. We converse on Maven ... We discuss opt-models topics on the Maven platform, where an AI extracts tags from conversations that help you discover related conversations. I think this is an interesting proposition for the optimization tribe, because we use related but often differently named concepts a good deal. Join me on Maven, you might like it. [maven_bann] "In Maven, there is a chance for AI to play a role in fixing much that is broken in our online discourse." - Sam Altman # Visit the 'Operations Research' topic on Maven 3. Code (so far) ... opt-models/opt-lego null 0 0 All Compendium Chapters: # New chapter videos and are released about every two days and their related code pushed to the relevant repos above. Recent The Problem Description Updated: 28 March 2024 Problem Description Use Case Objectives AMPL HiGHS SERIES INTRO! # This is the first of eighteen videos over which we build an app for the awesome Rebrickable(r) community, which finds multiple LEGO(r) sets buildable concurrently from a user's part inventory. Plan the Buildout Updated: 28 March 2024 App Build Plan Python UI We sketch a plan for building our optimization application, starting with a bare-bones optimization model and then adding a data connection and simple text-based UI. Later we swap out the AMPL scripting language for Python and the text-based UI for Streamlit, and then containerize the app. Unbox the Data! Updated: 28 March 2024 GraphXR EDA Schema A methodical walk through our domain data about all LEGO(r) parts, sets and minifigs, as supplied by Rebrickable.com. We use GraphXR for Exploratory Data Analysis (EDA), Whimsical for annotating our database schema and for redrawing the data structure in the form that we will use in our optimization app. Sketch the Model Updated: 28 March 2024 Variables Objectives Constraints Step-by-step we ideate model variables and constraints, jotting these down initially as natural language comments in our new AMPL model.mod file. Connect Model to Data Updated: 28 March 2024 Data Sources Speed Flat Files AMPL We establish a connection via an import script (written in the AMPL scripting syntax, later to be replaced by a Python script) to a collection of CSV and flat text data files. Group SETS Updated: 28 March 2024 SETS Tuples Speed AMPL We discuss why grouping sets of single entities into aggregate sets of tuples (aka 'cartesian products', 'cross-joins') dramatically increases the performance of our optimization app. Also, we discuss the accompanying increase in data memory footprint. Add a Text-based User Interface Updated: 28 March 2024 Flat Files UI AMPL We add a simple but functional, attractive text-based user interface by way of a flat data file formatted for good readability and manual data input. The Magical Nature of Optimization Programming Updated: 23 March 2024 Declarative Programming Simplex Problem Object Optimization programming is an extremely declarative paradigm which is beyond fantastic and also exactly why many newcomers get into trouble. Write the Model Updated: 28 March 2024 AMPL Constraints Memory Efficiency One-by-one we convert our natural language comments representing model vars and constraints into actual model entities. In the process, we add display statements for health-checking the memory size and cardinality of our new model element. Major Component Overview Updated: 23 March 2024 Modeling Tools Solvers Data Sources An overview of the modern optimization toolchain typically deployed in commercial applications: data sources, glue languages, modeling langs/tools, solvers and optional user interfaces. Shrink the Problem Updated: 28 March 2024 Speed Set Work Memory Efficiency AMPL With constraints in place which ensure that selected LEGO(r) sets are complete, we now implement constraints limiting the search space to sets that the user desires. We then observe that, while functional, a faster-computing way to implement such 'problem shrinking' is via set manipulation rather than constraint imposition. Make on-the-fly model mods Updated: 28 March 2024 Constraints App Logic Model Assembly at Runtime AMPL We add functionality to our script that drops unneeded constraints per user-specified options, effectively changing the form of our optimization model on-the-fly. We also discuss extreme approaches to such run-time model construction, in light of the modular nature of optimization model components. Model + Solver Updated: 23 March 2024 Algebraic Modeling Languages Solvers Speed AMPL PYOMO GAMS CPLEX Gurobi HiGHS A close look at large-scale optimization modeling tools and languages, and linear and nonlinear solvers. Data Sources Updated: 23 March 2024 Data Sources DataFrames Flat Files Discussing common data sources for optimization models and their various means of connection to the model. Tune the Solver!!! Updated: 28 March 2024 Solver Tuning Speed HiGHS We explore the solving-time impact of our linear solver's (HiGHS) various params/options, and use these to tune the solver for significantly faster performance on our optimization problem. Switch our glue land to Python Updated: 28 March 2024 Python App Logic AMPL Having worked thus far in only the AMPL modeling and scripting languages respectively, we jettison the AMPL scripting language and replace it with Python. This transforms our model into a component callable from within Python via the AMPL-Python API. User Interfaces Updated: 23 March 2024 UI Flat Files Streamlit A look at practical as well as fancy means by which humans can interact with optimization models during development and in production. 'Glue' Languages Updated: 23 March 2024 General Languages Python App Logic Discussing the use and interchangeability of general languages which 'glue' optimization application components together and implement out-of-model app logic. Add a Streamlit User Interface Updated: 28 March 2024 Streamlit UI AI-Assisted Coding Now that our optimization app's non-model logic script (aka 'the main script') is in Python, we add a lovely Streamlit UI to replace our text-based UI, created with help from our cheerful AI coding assistant. Go Dynamic! ...with iterative solving Updated: 28 March 2024 Dynamic Optimization UI Streamlit AMPL Our new Streamlit interface makes it easy to imagine and implement an important new feature: the ability to 'pin' one or more suggested LEGO(r) sets, discarding the others, and resolving, so that the user can iteratively arrive at an attractive collection of buildable sets. The Five Parts of an Optimization Model Updated: 23 March 2024 Model-Data Separation Constraints Objectives An unpacking of the five major components of an optimization model: SETS, parameters, Variables, Objective and Constraints. Dev Creature Comforts Updated: 23 March 2024 Code & Text Editors Git GraphXR Extolling the value of tools like Git, fast code/text editors, exploratory data analysis (EDA) tools like GraphXR, whiteboarding tools like Whimsical, containerization, model/data separation and friendly syntax and naming conventions. Let's Containerize! Updated: 28 March 2024 Containerization Docker Docker Compose Hardware We are almost done with our Multi-Build optimization app! Now is a good time to containerize our app so that it can easily be deployed to various environments and even scaled across multiple heterogeneous environments at once. Spec (rock!) the Hardware ;) Updated: 28 March 2024 Hardware Speed Now, let's dream out loud about some fast hardware platforms to run our app. Physical memory allotment, CPU thread speed, hard disk speed, non-optimization process load, networking and remote database access bandwidth requirements … all impact our hardware specifications. Mistakes, lies & abandoned features Updated: 28 March 2024 Problem Description Use Case Mistakes Speed App Build Plan I reveal some undisclosed turns taken during my initial development of this app. Notably: an abandoned attempt to implement a recursive search for nested sets within sets that would potentially have enabled some cool additional features, and which I might return to later. RECAP! ...and what happens next Updated: 28 March 2024 Speed Summary App Handover A recap of the main points of optimization craft covered in this series, including every major speed-enhancing manuever. I also ponder out loud what interactions with the Rebrickable team might hold for the apps real-world deployment and how to approach this interaction as good citizens. Descriptive, Predictive, Prescriptive ... analytics Updated: 23 March 2024 Descriptive Analytics Predictive Analytics Prescriptive Analytics My perspective on where and why mathematical optimization methods are commonly implemented in the commercial wild, sometimes as the Prescriptive component following earlier Predictive and/or Descriptive components in a modern Data Science pipeline. Optimization Problem Types Updated: 23 March 2024 Combinatorial Optimization Summary A whirlwind tour through the main problem types in the field of Combinatorial Optimization with an emphasis on their various real-world commercial implementations. Optimization Problem Hardness Updated: 23 March 2024 Problem Hardness Combinatorial Explosions Discussing the attributes of an optimization problem which make it harder to solve: combinatorial explosions, a lack of exploitable graph or other structure, etc. Also, a look at the usefulness of concepts like NP-hardness and Big O in addressing optimization problem hardness. Optimization Methods Updated: 23 March 2024 Dynamic Optimization Pattern Generation Stochastic Optimization Multi-Objective Optimization Heuristics A look at various optimization methods such as Stochastic data perturbation, dynamic solving, multi-objective optimization, pattern generation, heuristic and Metaheuristic solvers, and more. The Myth of the Objective Updated: 23 March 2024 Serendipity Objectives Use Case An invitation to consider the application of mathematical optimization in light of the view expressed by Kenneth O. Stanley and Joel Lehman in their book 'Why Greatness Cannot Be Planned' (2015). I posit that a richness of possible solutions can in many use cases be more valuable than a closer-to-optimum objective value. Speeding Opt Apps Updated: 23 March 2024 Speed Summary Memory Efficiency A methodical walk across the optimization toolchain and down through the underlying stack/OS in search of performance bottlenecks and their remedies. Predictions: Opt Tools, Skills and Apps beyond 2024 Updated: 23 March 2024 Predictions Solvers Modeling Tools My perspective on the markets for optimization products, services and skills in 2024 and beyond. I address developers, students, tool buyers and vendors in light of the current AI explosion. Optimization [?] AI Updated: 23 March 2024 AI-Assisted Coding Predictions Problem Hardness A show-and-tell discussion of generative AI's current value in writing optimization models, data integrations, tests, UIs. Also some discussion about readability of natural vs AML language for humans. Thank you to... Updated: 23 March 2024 Gratitude Community Love Thanks to the folks without whom this would not happen: Seth Godin, Steve Walters, The Black Crowes, Martha Wells and Murderbot, Techno Tim, Christian Lempa, Veronica Explains, Lawrence Systems, Jeff Delaney and Fireship.io, Nuno Coracao and Blowfish, the Rebrickable Team, Rebecca and you. Hey, Community! Updated: 23 March 2024 Community Love A call to the optimization community to build valuable resources together: models and integrations, open source solvers, a pro-bono project marketplace, tool-agnostic discussion forum(s). | (c) 2024 opt-models.org | MIT License unless otherwise noted | Privacy Powered by Hugo & Blowfish [ ]