This book provides a complete and comprehensive guide to Pyomo (Python Optimization Modeling Objects) for beginning and advanced modelers, including students at the undergraduate and graduate levels, academic researchers, and practitioners. Using many examples to illustrate the different techniques useful for formulating models, this text beautifully elucidates the breadth of modeling capabilities that are supported by Pyomo and its handling of complex real-world applications. In the third edition, much of the material has been reorganized, new examples have been added, and a new chapter has been added describing how modelers can improve the performance of their models. The authors have also modified their recommended method for importing Pyomo. A big change in this edition is the emphasis of concrete models, which provide fewer restrictions on the specification and use of Pyomo models.
Pyomo is an open source software package for formulating and solving large-scale optimization problems. The software extends the modeling approach supported by modern AML (Algebraic Modeling Language) tools. Pyomo is a flexible, extensible, and portable AML that is embedded in Python, a full-featured scripting language. Python is a powerful and dynamic programming language that has a very clear, readable syntax and intuitive object orientation. Pyomo includes Python classes for defining sparse sets, parameters, and variables, which can be used to formulate algebraic expressions that define objectives and constraints. Moreover, Pyomo can be used from a command-line interface and within Python's interactive command environment, which makes it easy to create Pyomo models, apply a variety of optimizers, and examine solutions.
Author(s): M. L. Bynum., G.A. Hackebeil., W.E. Hart., C.D. Laird, B. Nicholson, J.D. Siirola, J.P. Watson, D.L. Woodruff
Series: Springer Optimization and Its Applications 67
Edition: 3
Publisher: Springer Nature Switzerland
Year: 2021
Language: English
Pages: 225
City: Cham
Tags: Optimization, Pyomo, Python
Preface
Goals of the Book
Who Should Read This Book
Revisions for the Third Edition
Acknowledgments
Disclaimers
Comments and Questions
Contents
Chapter 1 Introduction
1.1 Modeling Languages for Optimization
1.2 Modeling with Pyomo
1.2.1 Simple Examples
1.2.2 Graph Coloring Example
1.2.3 Key Pyomo Features
Python
Customizable Capability
Command-Line Tools and Scripting
Concrete and Abstract Model Definitions
Object-Oriented Design
Expressive Modeling Capability
Solver Integration
Open Source
1.3 Getting Started
1.4 Book Summary
1.5 Discussion
Part I An Introduction to Pyomo
Chapter 2 Mathematical Modeling and Optimization
2.1 Mathematical Modeling
2.1.1 Overview
2.1.2 A Modeling Example
2.2 Optimization
2.3 Modeling with Pyomo
2.3.1 A Concrete Formulation
2.4 Linear and Nonlinear Optimization Models
2.4.1 Definition
2.4.2 Linear Version
2.5 Solving the Pyomo Model
2.5.1 Solvers
2.5.2 Python Scripts
Chapter 3 Pyomo Overview
3.1 Introduction
3.2 The Warehouse Location Problem
3.3 Pyomo Models
3.3.1 Components for Variables, Objectives, and Constraints
3.3.2 Indexed Components
3.3.3 Construction Rules
3.3.4 A Concrete Model for the Warehouse Location Problem
3.3.5 Modeling Components for Sets and Parameters
Chapter 4 Pyomo Models and Components: An Introduction
4.1 An Object-Oriented AML
4.2 Common Component Paradigms
4.2.1 Indexed Components
4.3 Variables
4.3.1 Var Declarations
4.3.2 Working with Var Objects
4.4 Objectives
4.4.1 Objective Declarations
4.4.2 Working with Objective Objects
4.5 Constraints
4.5.1 Constraint Declarations
4.5.2 Working with Constraint Objects
4.6 Set Data
4.6.1 Set Declarations
4.6.2 Working with Set Objects
4.7 Parameter Data
4.7.1 Param Declarations
4.7.2 Working with Param Objects
4.8 Named Expressions
4.8.1 Expression Declarations
4.8.2 Working with Expression Objects
4.9 Suffix Components
4.9.1 Suffix Declarations
4.9.2 Working with Suffixes
4.10 Other Modeling Components
Chapter 5 Scripting Custom Workflows
5.1 Introduction
5.2 Interrogating the Model
5.2.1 The The value Function
5.2.2 Accessing Attributes of Indexed Components
5.2.2.1 Slicing Over Indices of Components
5.2.2.2 Iterating Over All Var Objects on a Model
5.3 Modifying Pyomo Model Structure
5.4 Examples of Common Scripting Tasks
5.4.1 Warehouse Location Loop and Plotting
5.4.2 A Sudoku Solver
Chapter 6 Interacting with Solvers
6.1 Introduction
6.2 Using Solvers
6.3 Investigating the Solution
6.3.1 Solver Results
Part II Advanced Topics
Chapter 7 Nonlinear Programming with Pyomo
7.1 Introduction
7.2 Nonlinear Progamming Problems in Pyomo
7.2.1 Nonlinear Expressions
7.2.2 The Rosenbrock Problem
7.3 Solving Nonlinear Programming Formulations
7.3.1 Nonlinear Solvers
7.3.2 Additional Tips for Nonlinear Programming
Variable Initialization
Undefined Evaluations
Model Singularities and Problem Scaling
7.4 Nonlinear Programming Examples
7.4.1 Variable Initialization for a Multimodal Function
7.4.2 Optimal Quotas for Sustainable Harvesting of Deer
7.4.3 Estimation of Infectious Disease Models
7.4.4 Reactor Design
Chapter 8 Structured Modeling with Blocks
8.1 Introduction
8.2 Block structures
8.3 Blocks as Indexed Components
8.4 Construction Rules within Blocks
8.5 Extracting values from hierarchical models
8.6 Blocks Example: Optimal Multi-Period Lot-Sizing
8.6.1 A Formulation Without Blocks
8.6.2 A Formulation With Blocks
Chapter 9 Performance: Model Construction and Solver Interfaces
9.1 Profiling to Identify Performance Bottlenecks
9.1.1 Report Timing
9.1.2 TicTocTimer
9.1.3 Profilers
9.2 Improving Model Construction Performance with LinearExpression
9.3 Repeated Solves with Persistent Solvers
9.3.1 When to Use a Persistent Solver
9.3.2 Basic Usage
9.3.3 Working with Indexed Variables and Constraints
9.3.4 Additional Performance
9.3.5 Example
9.4 Sparse Index Sets
Chapter 10 Abstract Models and Their Solution
10.1 Overview
10.1.1 Abstract and Concrete Models
10.1.2 An Abstract Formulation of Model (H)
10.1.3 An Abstract Model for the Warehouse Location Problem
10.2 The pyomo Command
10.2.1 The help Subcommand
10.2.2 The solve Subcommand
10.2.2.1 Specifying the Model Object
10.2.2.2 Selecting Data with Namespaces
10.2.2.3 Customizing Pyomo’s Workflow
10.2.2.4 Customizing Solver Behavior
10.2.2.5 Analyze Solver Results
10.2.2.6 Managing Diagnostic Output
10.2.3 The convert Subcommand
10.3 Data Commands for Abstract Model
10.3.1 The set Command
10.3.1.1 Simple Sets
10.3.1.2 Sets of Tuple Data
10.3.1.3 Set Arrays
10.3.2 The param Command
10.3.2.1 One-dimensional Parameter Data
10.3.2.2 Multi-Dimensional Parameter Data
10.3.3 The include Command
10.3.4 Data Namespaces
10.4 Build Components
Part III Modeling Extensions
Chapter 11 Generalized Disjunctive Programming
11.1 Introduction
11.2 Modeling GDP in Pyomo
11.3 Expressing logical constraints
11.4 Solving GDP models
11.4.1 Big-M transformation
11.4.2 Hull transformation
11.5 A mixing problem with semi-continuous variables
Chapter 12 Differential Algebraic Equations
12.1 Introduction
12.2 Pyomo DAE Modeling Components
12.3 Solving Pyomo Models with DAEs
12.3.1 Finite Difference Transformation
12.3.2 Collocation Transformation
12.4 Additional Features
12.4.1 Applying Multiple Discretizations
12.4.2 Restricting Control Input Profiles
12.4.3 Plotting
Chapter 13 Mathematical Programs with Equilibrium Constraints
13.1 Introduction
13.2 Modeling Equilibrium Conditions
13.2.1 Complementarity Conditions
13.2.2 Complementarity Expressions
13.2.3 Modeling Mixed-Complementarity Conditions
13.3 MPEC Transformations
13.3.1 Standard Form
13.3.2 Simple Nonlinear
13.3.3 Simple Disjunction
13.3.4 AMPL Solver Interface
13.4 Solver Interfaces and Meta-Solvers
13.4.1 Nonlinear Reformulations
13.4.2 Disjunctive Reformulations
13.4.3 PATH and the ASL Solver Interface
13.5 Discussion
Appendix A A Brief Python Tutorial
A.1 Overview
A.2 Installing and Running Python
A.3 Python Line Format
A.4 Variables and Data Types
A.5 Data Structures
A.5.1 Strings
A.5.2 Lists
A.5.3 Tuples
A.5.4 Sets
A.5.5 Dictionaries
A.6 Conditionals
A.7 Iterations and Looping
A.8 Generators and List Comprehensions
A.9 Functions
A.10 Objects and Classes
A.11 Assignment, copy and deepcopy
A.11.1 References
A.11.2 Copying
A.12 Modules
A.13 Python Resources
Bibliography
Index