Prelim 2 Review and Simulation-Optimization


Lecture 23

November 25, 2024

Review and Questions

Mathematical Programming and Systems Analysis

Pros:

  • Can guarantee analytic solutions (or close)
  • Often computationally scalable (especially for LPs)
  • Transparent

Cons:

  • Often quite stylized
  • Limited ability to treat uncertainty

Mathematical Programming and Systems Analysis

Challenges include:

  • Complex and non-linear systems dynamics;
  • Uncertainties;
  • Multiple objectives.

Multiple Objectives

  • A priori vs a posteriori treatment.
  • We say that a decision \(\mathbf{x}\) is dominated if there exists another solution \(\mathbf{y}\) such that for every objective metric \(Z_i(\cdot)\), \[Z_i(\mathbf{x}) > Z_i(\mathbf{y}).\]
  • \(\mathbf{x}\) is non-dominated if it is not dominated by any \(\mathbf{y} \neq \mathbf{x}\).
  • Pareto front: set of non-dominated solutions, each of which involves a tradeoff relative to the others.

Prelim 2 Review

Overall Statistics

  • Mean: 42/50 (84%)
  • Median: 44/50 (88%)
  • Standard Deviation: 6.5/50 (13%)

Other Approaches to Optimization

Generalized Search Algorithms

Function with Multiple Minima

Most search algorithms look for critical points to find candidate optima. Then the “best” of the critical points is the global optimum.

Generalized Search Algorithms

Function with Multiple Minima

Two common approaches:

  • Gradient-based methods
  • Evolutionary algorithms

Gradient Descent

Find estimate of gradient near current point and step in positive/negative direction (depending on max/min).

\[x_{n+1} = x_n \pm \alpha_n \nabla f(x_n)\]

Gradient Descent: Challenges

  1. Need to tune stepsize for convergence; some use adaptive methods;
  2. May not have information about the gradient.

The second is more problematic: in some cases, methods like stochastic gradient approximation or automatic differentiation can be used.

Random Search with Constraints

Can also incorporate constraints into search.

Random Search in Julia

Two main packages:

Quick Example

Random.seed!(1)
# define function to optimize
function f(x)
    lnorm = LogNormal(0.25, 1) 
    y = rand(lnorm)
    return sum(x .- y)^2
end
fobj(x) = mean([f(x) for i in 1:1000])
bounds = [0.0 1000.0]'
# optimize
results = Metaheuristics.optimize(fobj, bounds, DE())
results.best_sol
(f = 3.7256e+00, x = [1.57087])

Metaheuristics.jl Algorithms

Metaheuristics.jl contains a number of algorithms, covering a variety of single-objective and multi-objective algorithms.

We won’t go into details here, and will just stick with DE() (differential evolution) in our examples.

Drawbacks of Search Algorithms

These methods work pretty well, but can:

  • require a lot of evaluations;
  • may get stuck at local optima;
  • may not converge if step sizes aren’t set correctly

waiting model evaluation meme

Generalized Search Algorithms

These methods work pretty well, but can:

  • require a lot of evaluations;
  • may get stuck at local optima;
  • may not converge if step sizes aren’t set correctly

waiting model evaluation meme

Generalized Search Algorithms

These methods work pretty well, but can:

  • require a lot of evaluations;
  • may get stuck at local optima;
  • may not converge if not tuned well.

waiting model evaluation meme

Simulation-Optimization

Simulation-Optimization

Simulation-Optimization involves the use of a simulation model to map decision variables and other inputs to system outputs.

Mathematical Model

Methods for Simulation-Optimization

What kinds of methods can use for simulation-optimization?

Mathematical Model

Simulation-Optimization: Methods

Challenge: Underlying structure of the simulation model \(f(x)\) is unknown and can be complex.

We can use a search algorithm to navigate the response surface of the model and find an “optimum”.

Mathematical Model

Why “Optimum” in Quotes?

We usually can’t guarantee that we can find an optimum (or even quantify an optimality gap) because:

  • Simulation-optimization is applied in very general settings;
  • May not have much a priori information about the response surface;
  • The response surface can be highly nonlinear.

Why “Optimum” in Quotes?

But:

The optimal solution of a model is not an optimal solution of a problem unless the model is a perfect representation of the problem, which it never is.

— Ackoff, R. L. (1979). “The Future of Operational Research is Past.” The Journal of the Operational Research Society, 30(2), 93–104. https://doi.org/10.1057/jors.1979.22

Simulation-Optimization and Heuristics

Simulation-optimization methods typically rely on heuristics to decide that a solution is good enough. These can include

  • number of evaluations/iterations; or
  • lack of improvement of solution with increased evaluations.

Lake Problem Revisited

Lake Model

\[\begin{align*} X_{t+1} &= X_t + a_t + y_t \\ &\quad + \frac{X_t^q}{1 + X_t^q} - bX_t,\\[0.5em] y_t &\sim \text{LogNormal}(\mu, \sigma^2) \end{align*}\]

Parameter Definition
\(X_t\) P concentration in lake
\(a_t\) point source P input
\(y_t\) non-point source P input
\(q\) P recycling rate
\(b\) rate at which P is lost

Lake Problem: Simulation-Optimization Setup

  • Time period: \(T=100\)
  • Non-point source P inflows: \(y_t \sim \text{LogNormal}(0.03, 0.25).\)
  • \(b = 2.5\) (P recycling rate), \(q=0.4\) (P outflow rate)
  • Constraint: \(\mathbb{P}[\text{Eutrophication}] \leq 0.1\)
  • Objective: Maximize average point source P releases \(\sum_t a_t / T\).

Lake Problem: Exogenous P Input Distribution

Lake Problem: Optimization Setup

  1. Set parameters and number of samples for exogenous inflows (we’ll use 1,000);
  2. Define model function and bounds (we’ll assume \(0 \leq a_t \leq 0.1\));
  3. Simulate objective and whether constraint is violated;
  4. Return objective and constraint status.
  5. Call optimizer (we’ll use DE() with a maximum of 5,000 function evaluations).

Lake Problem: Optimization Result

What do you observe?

End-Of-Time P Concentrations

Now we can simulate to learn about how the solution performs.

Lake P Concentration Trajectories

  • Trajectories start jumping over the critical threshold later in the horizon.
  • This finite horizon problem is very common for optimization problems with reliability constraints over fixed temporal windows.

Heuristic Algorithms Involve Lots of Choices!

Many choices were made in this optimization problem:

  • Number of samples from the inflow distribution;
  • Number of function evaluations;
  • Strength of reliability constraint.

All of these affect the tradeoff between solution quality and computational expense.

Key Takeaways

General Takeaways

  • Many challenges to using mathematical programming for general systems analysis.
  • Can use simulation-optimization approaches.
  • Tradeoff between lack of analytic solution and broader flexibility
  • But be careful of computational expense and convergence!

Challenges to Simulation-Optimization in General

  • Monte Carlo Error: If constraints or objective is probabilistic, how many Monte Carlo runs are needed to ensure difference in function values is “real” and not stochastic noise.
  • Computational: Can be expensive depending on the simulation model.
  • Local vs. Global Optima: Depending on type of search algorithm, may not be able to guarantee more than a local optimum.
  • Transparency: LP models are written down relatively clearly. Simulation models may have many important but hidden assumptions.

Upcoming Schedule

Happy Thanksgiving!

After Break: No class, class time will be office hours for check-ins.

Assessments

HW5: Due 12/5

Project: Presentation due 12/9 (cannot be late)