OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
opennn::ResponseOptimization Class Reference

Optimizes input values so that a network's outputs satisfy user-defined conditions and objectives. More...

#include <response_optimization.h>

Classes

struct  Condition
 Constraint or objective imposed on a single variable, with optional bounds. More...
 
struct  Domain
 Bounded domain in input or output space defined by inferior and superior frontiers. More...
 
struct  Objectives
 Encodes the objectives extracted from the response optimization configuration. More...
 

Public Types

enum class  ConditionType {
  None , Between , EqualTo , LessEqualTo ,
  GreaterEqualTo , LessThan , GreaterThan , Minimize ,
  Maximize
}
 Types of constraint or objective applied to an input or output variable. More...
 

Public Member Functions

Objectives build_objectives () const
 Builds the Objectives helper from the current conditions.
 
 ResponseOptimization (NeuralNetwork *=nullptr, Dataset *=nullptr)
 Constructs the optimizer bound to an optional neural network and dataset.
 
void set (NeuralNetwork *=nullptr, Dataset *=nullptr)
 Binds the optimizer to a neural network and a dataset.
 
void clear_conditions ()
 Removes all conditions previously configured on input and output variables.
 
void set_condition (const string &name, const ConditionType condition, float low_bound=0.0, float up_bound=0.0)
 Adds or replaces the condition applied to the variable with the given name.
 
void set_iterations (const int iterations)
 
void set_zoom_factor (float new_zoom_factor)
 
void set_evaluations_number (const int new_evaluations_number)
 
void set_relative_tolerance (float new_relative_tolerance)
 
vector< float > get_utopian_point () const
 Returns the coordinates of the utopian point used as reference for multiobjective optimization.
 
Domain get_original_domain (const string role) const
 Returns the original (untrimmed) domain for variables playing the given role.
 
Condition get_condition (const Index index) const
 Returns the configured condition at the given index.
 
MatrixR calculate_random_inputs (const Domain &input_domain) const
 Draws a random sample of input points within the given input domain.
 
pair< MatrixR, MatrixRfilter_feasible_points (const MatrixR &inputs, const MatrixR &outputs, const Domain &output_domain) const
 Filters the (inputs, outputs) pairs whose outputs fall inside the feasible output domain.
 
pair< MatrixR, MatrixRcalculate_optimal_points (const MatrixR &feasible_inputs, const MatrixR &feasible_outputs, const Objectives &objectives) const
 Selects the optimal points among feasible candidates according to the supplied objectives.
 
MatrixR assemble_results (const MatrixR &inputs, const MatrixR &outputs) const
 Assembles the final results matrix concatenating inputs and outputs.
 
MatrixR perform_single_objective_optimization (const Objectives &objectives) const
 Performs single-objective optimization and returns the best input/output pair.
 
pair< MatrixR, MatrixRcalculate_pareto (const MatrixR &inputs, const MatrixR &outputs, const MatrixR &objective_matrix) const
 Computes the Pareto front of the supplied input/output samples.
 
pair< float, float > calculate_quality_metrics (const MatrixR &inputs, const MatrixR &outputs, const Objectives &objectives) const
 Computes quality metrics of the optimization (e.g. distance to utopian point).
 
MatrixR perform_multiobjective_optimization (const Objectives &objectives) const
 Performs multiobjective optimization and returns the Pareto-optimal input/output samples.
 
MatrixR perform_response_optimization () const
 Runs the response optimization using the configured conditions and returns the optimal results.
 

Detailed Description

Optimizes input values so that a network's outputs satisfy user-defined conditions and objectives.

Member Enumeration Documentation

◆ ConditionType

Types of constraint or objective applied to an input or output variable.

Enumerator
None 
Between 
EqualTo 
LessEqualTo 
GreaterEqualTo 
LessThan 
GreaterThan 
Minimize 
Maximize 

Constructor & Destructor Documentation

◆ ResponseOptimization()

opennn::ResponseOptimization::ResponseOptimization ( NeuralNetwork * = nullptr,
Dataset * = nullptr )

Constructs the optimizer bound to an optional neural network and dataset.

Member Function Documentation

◆ assemble_results()

MatrixR opennn::ResponseOptimization::assemble_results ( const MatrixR & inputs,
const MatrixR & outputs ) const

Assembles the final results matrix concatenating inputs and outputs.

◆ build_objectives()

Objectives opennn::ResponseOptimization::build_objectives ( ) const

Builds the Objectives helper from the current conditions.

◆ calculate_optimal_points()

pair< MatrixR, MatrixR > opennn::ResponseOptimization::calculate_optimal_points ( const MatrixR & feasible_inputs,
const MatrixR & feasible_outputs,
const Objectives & objectives ) const

Selects the optimal points among feasible candidates according to the supplied objectives.

◆ calculate_pareto()

pair< MatrixR, MatrixR > opennn::ResponseOptimization::calculate_pareto ( const MatrixR & inputs,
const MatrixR & outputs,
const MatrixR & objective_matrix ) const

Computes the Pareto front of the supplied input/output samples.

◆ calculate_quality_metrics()

pair< float, float > opennn::ResponseOptimization::calculate_quality_metrics ( const MatrixR & inputs,
const MatrixR & outputs,
const Objectives & objectives ) const

Computes quality metrics of the optimization (e.g. distance to utopian point).

◆ calculate_random_inputs()

MatrixR opennn::ResponseOptimization::calculate_random_inputs ( const Domain & input_domain) const

Draws a random sample of input points within the given input domain.

◆ clear_conditions()

void opennn::ResponseOptimization::clear_conditions ( )

Removes all conditions previously configured on input and output variables.

◆ filter_feasible_points()

pair< MatrixR, MatrixR > opennn::ResponseOptimization::filter_feasible_points ( const MatrixR & inputs,
const MatrixR & outputs,
const Domain & output_domain ) const

Filters the (inputs, outputs) pairs whose outputs fall inside the feasible output domain.

◆ get_condition()

Condition opennn::ResponseOptimization::get_condition ( const Index index) const

Returns the configured condition at the given index.

◆ get_original_domain()

Domain opennn::ResponseOptimization::get_original_domain ( const string role) const

Returns the original (untrimmed) domain for variables playing the given role.

◆ get_utopian_point()

vector< float > opennn::ResponseOptimization::get_utopian_point ( ) const

Returns the coordinates of the utopian point used as reference for multiobjective optimization.

◆ perform_multiobjective_optimization()

MatrixR opennn::ResponseOptimization::perform_multiobjective_optimization ( const Objectives & objectives) const

Performs multiobjective optimization and returns the Pareto-optimal input/output samples.

◆ perform_response_optimization()

MatrixR opennn::ResponseOptimization::perform_response_optimization ( ) const

Runs the response optimization using the configured conditions and returns the optimal results.

◆ perform_single_objective_optimization()

MatrixR opennn::ResponseOptimization::perform_single_objective_optimization ( const Objectives & objectives) const

Performs single-objective optimization and returns the best input/output pair.

◆ set()

void opennn::ResponseOptimization::set ( NeuralNetwork * = nullptr,
Dataset * = nullptr )

Binds the optimizer to a neural network and a dataset.

◆ set_condition()

void opennn::ResponseOptimization::set_condition ( const string & name,
const ConditionType condition,
float low_bound = 0.0,
float up_bound = 0.0 )

Adds or replaces the condition applied to the variable with the given name.

Parameters
nameVariable name as defined in the dataset.
conditionCondition type to enforce.
low_boundLower bound used by bounded condition types.
up_boundUpper bound used by bounded condition types.

◆ set_evaluations_number()

void opennn::ResponseOptimization::set_evaluations_number ( const int new_evaluations_number)

◆ set_iterations()

void opennn::ResponseOptimization::set_iterations ( const int iterations)

◆ set_relative_tolerance()

void opennn::ResponseOptimization::set_relative_tolerance ( float new_relative_tolerance)

◆ set_zoom_factor()

void opennn::ResponseOptimization::set_zoom_factor ( float new_zoom_factor)