liveBook · Manning

Unimodal problem

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

An objective-function landscape with a single dominant optimum or basin of attraction.

A unimodal problem has an objective-function landscape with one clear global optimum: one lowest valley for minimization or highest peak for maximization. Convex and concave functions are examples. section 2.1.2

Classify the landscape separately from the number of objectives:

  • Multimodal problems contain multiple optima, so local search can encounter competing basins. section 2.1.2
  • Deceptive functions combine a narrow global optimum with a strong, wide local basin that can mislead search. section 2.1.2
  • Mono-objective optimization specifies one objective; unimodality instead describes the shape of that objective’s landscape. section 2.1.2

A bowl-shaped objective

The function x² + y² produces a simple unimodal surface: values rise away from the single optimum at the center. Plotting it beside multimodal 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 unimodal, multimodal, and deceptive objective-function surfaces. section 2.1.2

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

How deep it goes
Defines unimodality, contrasts multimodal and deceptive landscapes, and stops short of developing a dedicated optimization algorithm.
Examples
Illustrates the concept with x² + y², three-dimensional Python plots, and contrasting multimodal and deceptive functions.
What you can do after
Evaluate optimization landscapes and visualize unimodal behavior using a Python objective-function example.
How it connects
Connects objective functions with global optima, multimodal problems, deceptive functions, mono-objective optimization, and constraint-satisfaction problems.

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.