liveBook · Manning

Multimodal problem

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

An objective-function landscape containing multiple local optima.

A multimodal problem has an objective-function landscape with more than one optimum. Unlike a unimodal landscape, it contains multiple valleys or peaks, so a search may find a local optimum rather than the global optimum. section 2.1.2

Use these distinctions when describing an optimization landscape:

  • Unimodal problems have one clear global optimum. section 2.1.2
  • Multimodal problems contain multiple optima and may challenge local search. section 2.1.2
  • Deceptive functions contain a narrow global minimum and a broad, competitive local minimum that can attract algorithms. section 2.1.2

A plotted multimodal function

The function sin(x) × cos(y) produces a three-dimensional landscape with repeated peaks and valleys. Plotting it alongside unimodal and deceptive functions makes the landscape differences visible. section 2.1.2

Listing 2.1 Examples of objective functions
import numpy as np
import math
import matplotlib.pyplot as plt
  
def objective_unimodal(x, y):           #1
    return x**2.0 + y**2.0
  
def objective_multimodal(x, y):         #2
    return np.sin(x) * np.cos(y)
  
def objective_deceptive(x, y):          #3
    return (1-(abs((np.sin(math.pi*(x-2))*np.sin(math.pi*(y-2)))/
  (math.pi*math.pi*(x-2)*(y-2))))**5)*(2+(x-7)**2+2*(y-7)**2)
  
fig = plt.figure(figsize = (25,25))
ax = fig.add_subplot(1,3,1, projection='3d')
  
x = np.arange(-3, 3, 0.01)
y = np.arange(-3, 3, 0.01)
  
X, Y = np.meshgrid(x, y)
Z = objective_unimodal(X, Y)
surf = ax.plot_surface(X, Y, Z, cmap=plt.cm.cividis)
ax.set_xlabel('x', fontsize=15)
ax.set_ylabel('y', fontsize=15)
ax.set_zlabel('Z', fontsize=15)
ax.set_title("Unimodal/Convex function", fontsize=18)
  
ax = fig.add_subplot(1,3,2, projection='3d')
Z = objective_multimodal(X, Y)
surf = ax.plot_surface(X, Y, Z, cmap=plt.cm.cividis)
ax.set_xlabel('x', fontsize=15)
ax.set_ylabel('y', fontsize=15)
ax.set_zlabel('Z', fontsize=15)
ax.set_title("Multimodal function", fontsize=18)
  
X, Y = np.meshgrid(x, y)
Z = objective_unimodal(X, Y)
ax = fig.add_subplot(1,3,3, projection='3d')
Z = objective_deceptive(X, Y)
surf = ax.plot_surface(X, Y, Z, cmap=plt.cm.cividis, antialiased=False)
ax.set_xlabel('x', fontsize=15)
ax.set_ylabel('y', fontsize=15)
ax.set_zlabel('Z', fontsize=15)
ax.set_title("Deceptive function", fontsize=18)
  
plt.show()
#1 Unimodal function
#2 Multimodal function
#3 Deceptive function

Inspect the Python listing to compare objective-function definitions and generate three-dimensional landscape plots. section 2.1.2

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines multiple optima and contrasts them with unimodal and deceptive landscapes, but stops short of prescribing a dedicated solving algorithm.
Examples
Uses sin(x)cos(y) and three-dimensional plots to illustrate repeated peaks and valleys.
What you can do after
Evaluate/understand whether an objective landscape is unimodal, multimodal, or deceptive.
How it connects
Connects objective functions with global optima, local minima, deceptive functions, and search and optimization algorithms.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.