🌐 EN | 🇯🇵 JP

Chapter 3: AI Optimization Algorithms

Deep Dive into NIMO's Methods

📖 Reading Time: 25-30 minutes 📊 Difficulty: Beginner-Intermediate 💻 Code Examples: 6 📝 Exercises: 2

Learning Objectives

3.1 The Exploration-Exploitation Trade-off

Before diving into specific algorithms, let's understand the fundamental challenge in optimization:

graph LR subgraph Exploration[Exploration] E1[Try new regions] E2[Discover unknowns] E3[Avoid local optima] end subgraph Exploitation[Exploitation] X1[Focus on known good areas] X2[Refine best solutions] X3[Maximize current knowledge] end Exploration <-->|Balance| Exploitation style Exploration fill:#667eea,color:#fff style Exploitation fill:#11998e,color:#fff

Exploration vs Exploitation

Exploration: Testing regions where we have little information, potentially finding better solutions in unexplored areas.

Exploitation: Focusing on regions where we've already found good results, refining our best solutions.

Good optimization algorithms balance both strategies automatically.

3.2 Bayesian Optimization (PHYSBO)

PHYSBO is NIMO's flagship algorithm, based on Bayesian Optimization principles. It's the recommended choice for most materials optimization problems.

How Bayesian Optimization Works

The algorithm follows a three-step process:

  1. Build a surrogate model: Use a Gaussian Process (GP) to model the objective function based on existing data
  2. Compute acquisition function: Calculate where the next experiment is most likely to improve results
  3. Select next candidate: Choose the point that maximizes the acquisition function
graph TB A[Existing Data] --> B[Gaussian Process Model] B --> C[Predict Mean & Variance] C --> D[Acquisition Function] D --> E[Select Next Candidate] E --> F[Run Experiment] F --> A style B fill:#667eea,color:#fff style D fill:#f093fb,color:#fff style E fill:#28a745,color:#fff

PHYSBO in NIMO

Code Example 1: Basic PHYSBO Usage
import nimo

# Basic Bayesian Optimization
nimo.selection(
    method="PHYSBO",
    input_file="candidates.csv",
    output_file="proposals.csv",
    num_objectives=1,
    num_proposals=1
)
Code Example 2: PHYSBO with Advanced Options
import nimo

# Bayesian Optimization with configuration
nimo.selection(
    method="PHYSBO",
    input_file="candidates.csv",
    output_file="proposals.csv",
    num_objectives=1,
    num_proposals=3,
    physbo_score="EI",     # Acquisition function: EI, PI, or TS
    physbo_seed=42         # Random seed for reproducibility
)

Acquisition Functions

PHYSBO supports three acquisition functions:

Function Full Name Strategy When to Use
EI Expected Improvement Balanced Default choice, most situations
PI Probability of Improvement Exploitation-heavy When close to optimal, need refinement
TS Thompson Sampling Exploration-heavy Multi-modal functions, parallel experiments

Recommended: Expected Improvement (EI)

For most materials science problems, EI provides the best balance between exploration and exploitation. It naturally adapts to the optimization landscape.

3.3 Random Exploration (RE)

RE is a simple but essential algorithm: it randomly selects from untested candidates.

Code Example 3: Random Exploration
import nimo

# Random selection for initial data collection
nimo.selection(
    method="RE",
    input_file="candidates.csv",
    output_file="proposals.csv",
    num_objectives=1,
    num_proposals=5,
    re_seed=42  # For reproducibility
)

When to Use RE

Typical Workflow

Cycle 1: RE (collect 5-10 random samples)
Cycles 2+: PHYSBO (intelligent selection based on data)

3.4 BLOX: Random Forest Approach

BLOX uses Random Forest models instead of Gaussian Processes. This makes it faster for high-dimensional problems.

Code Example 4: BLOX Usage
import nimo

# Random Forest-based optimization
nimo.selection(
    method="BLOX",
    input_file="candidates.csv",
    output_file="proposals.csv",
    num_objectives=1,
    num_proposals=3
)

BLOX vs PHYSBO Comparison

Aspect PHYSBO BLOX
Model Gaussian Process Random Forest
Uncertainty Well-calibrated Approximate
Speed (low-dim) Fast Fast
Speed (high-dim) Slow Fast
Best for ≤20 descriptors >20 descriptors

3.5 Phase Diagram Construction (PDC)

PDC is designed specifically for materials science problems where you need to map out different phases or regions.

Code Example 5: PDC Usage
import nimo

# Phase diagram construction
nimo.selection(
    method="PDC",
    input_file="candidates.csv",
    output_file="proposals.csv",
    num_objectives=1,
    num_proposals=3
)

When to Use PDC

3.6 Multi-Objective Algorithms

When optimizing multiple objectives simultaneously (e.g., maximize strength AND minimize cost), use these algorithms:

PTR: Pareto-based Thompson Ranking

Code Example 6: Multi-Objective Optimization with PTR
import nimo

# Multi-objective optimization (2 objectives)
nimo.selection(
    method="PTR",
    input_file="candidates.csv",
    output_file="proposals.csv",
    num_objectives=2,  # Optimize 2 properties
    num_proposals=3
)

Pareto Optimality

A solution is Pareto optimal if no objective can be improved without worsening another. Multi-objective algorithms find the set of all Pareto optimal solutions (the Pareto front).

3.7 Algorithm Selection Guide

Use this decision tree to choose the right algorithm:

graph TD A[Start] --> B{First cycle?} B -->|Yes| C[Use RE] B -->|No| D{Multi-objective?} D -->|Yes| E{>2 objectives?} D -->|No| F{>20 descriptors?} E -->|Yes| G[Use PTR or BOMP] E -->|No| H[Use PTR] F -->|Yes| I[Use BLOX] F -->|No| J{Phase mapping?} J -->|Yes| K[Use PDC] J -->|No| L[Use PHYSBO] style C fill:#667eea,color:#fff style G fill:#11998e,color:#fff style H fill:#11998e,color:#fff style I fill:#f093fb,color:#fff style K fill:#28a745,color:#fff style L fill:#667eea,color:#fff

Quick Reference Table

Scenario Recommended Algorithm Reason
First experiments RE Need initial random data
General optimization PHYSBO Best overall performance
High dimensions (>20) BLOX Faster with many features
Phase mapping PDC Designed for phase diagrams
Multi-objective PTR Pareto optimization
Fast exploration SLESA Quick candidate selection

3.8 Algorithm-Specific Parameters

Each algorithm has specific parameters you can tune:

PHYSBO Parameters

RE Parameters

BLOX Parameters

Exercises

Exercise 1: Algorithm Selection

For each scenario, choose the most appropriate algorithm:

  1. You're starting a new optimization with no prior data (10 descriptors)
  2. You want to optimize hardness and ductility simultaneously
  3. You're mapping the phase diagram of a ternary alloy system
  4. You have 50 descriptors and need fast optimization

Exercise 2: PHYSBO Configuration

Write NIMO code to:

  1. Use PHYSBO with Thompson Sampling acquisition
  2. Select 5 proposals per cycle
  3. Set a random seed of 123 for reproducibility

Summary

Disclaimer

This content is provided for educational purposes. NIMO is developed and maintained by NIMS.