gemseo / problems / sellar

sellar_design_space module

The design space for the MDO problem proposed by Sellar et al. in.

Sellar, R., Batill, S., & Renaud, J. (1996). Response surface based, concurrent subspace optimization for multidisciplinary system design. In 34th aerospace sciences meeting and exhibit (p. 714).

Classes:

SellarDesignSpace([dtype])

The design space for the MDO problem proposed by Sellar et al (1996).

class gemseo.problems.sellar.sellar_design_space.SellarDesignSpace(dtype='complex128')[source]

Bases: gemseo.algos.design_space.DesignSpace

The design space for the MDO problem proposed by Sellar et al (1996).

It is composed of: - \(x_{local}\) belonging to \([0., 10.]\), - \(x_{shared,1}\) belonging to \([-10., 10.]\), - \(x_{shared,2}\) belonging to \([0., 10.]\), - \(y_1\) belonging to \([-100., 100.]\), - \(y_2\) belonging to \([-100., 100.]\).

This design space is initialized with the initial solution:

  • \(x_{local}=1\),

  • \(x_{shared,1}=4\),

  • \(x_{shared,2}=3\),

  • \(y_1=1\),

  • \(y_2=1\).

Parameters

dtype (str) – The type of the variables defined in the design space.

Return type

None

Attributes:

AVAILABLE_TYPES

DESIGN_SPACE_GROUP

FLOAT

INTEGER

LB_GROUP

MINIMAL_FIELDS

NAMES_GROUP

NAME_GROUP

SEP

SIZE_GROUP

TABLE_NAMES

TYPE_GROUP

UB_GROUP

VALUE_GROUP

VAR_TYPE_GROUP

Methods:

add_variable(name[, size, var_type, l_b, …])

Add a variable to the design space.

array_to_dict(x_array)

Split the current point into a dictionary with variables names.

check()

Check the state of the design space.

check_membership(x_vect[, variables_names])

Checks whether the input variables satisfy the design space requirements.

dict_to_array(x_dict[, all_vars, all_var_list])

Aggregate a point as dictionary into array.

export_hdf(file_path[, append])

Export to hdf file.

export_to_txt(output_file[, fields, header_char])

Exports the design space to a text file.

extend(other)

Extend the design space with another design space.

filter(keep_variables[, copy])

Filter the design space to keep a sublist of variables.

filter_dim(variable, keep_dimensions)

Filters the design space to keep a sublist of dimensions for a given variable.

get_active_bounds([x_vec, tol])

Determine which bound constraints of the current point are active.

get_current_x([variables_names])

Gets the current point in the design space.

get_current_x_dict()

Get the current point in the design space.

get_current_x_normalized()

Returns the current point normalized.

get_indexed_var_name(variable_name)

Return a list of the variables names with their indices such as.

get_indexed_variables_names()

Return a list of the variables names with their indices such as.

get_lower_bound(name)

Gets the lower bound of a variable.

get_lower_bounds([variables_names])

Generates an array of the variables’ lower bounds.

get_pretty_table([fields])

Builds a PrettyTable object from the design space data.

get_size(name)

Get the size of a variable Return None if the variable is not known.

get_type(name)

Get the type of a variable Return None if the variable is not known.

get_upper_bound(name)

Gets the upper bound of a variable.

get_upper_bounds([variables_names])

Generates an array of the variables’ upper bounds.

get_variables_indexes(variables_names)

Return the indexes of a design array corresponding to the variables names.

has_current_x()

Tests if current_x is defined.

import_hdf(file_path)

Imports design space from hdf file.

normalize_vect(x_vect[, minus_lb])

Normalizes a vector of the design space.

project_into_bounds(x_c[, normalized])

Projects x_c onto the bounds, using a simple coordinate wise approach.

read_from_txt(input_file[, header])

Parses a csv file to read the DesignSpace.

remove_variable(name)

Remove a variable (and bounds and types) from the design space.

round_vect(x_vect)

Rounds the vector where variables are of integer type.

set_current_variable(name, current_value)

Set the current value of a single variable.

set_current_x(current_x)

Set the current point.

set_lower_bound(name, lower_bound)

Set a new lower bound for variable name.

set_upper_bound(name, upper_bound)

Set a new upper bound for variable name.

to_complex()

Casts the current value to complex.

unnormalize_vect(x_vect[, minus_lb, no_check])

Unnormalizes a normalized vector of the design space.

AVAILABLE_TYPES = ['float', 'integer']
DESIGN_SPACE_GROUP = 'design_space'
FLOAT = 'float'
INTEGER = 'integer'
LB_GROUP = 'l_b'
MINIMAL_FIELDS = ['name', 'lower_bound', 'upper_bound']
NAMES_GROUP = 'names'
NAME_GROUP = 'name'
SEP = '!'
SIZE_GROUP = 'size'
TABLE_NAMES = ['name', 'lower_bound', 'value', 'upper_bound', 'type']
TYPE_GROUP = 'type'
UB_GROUP = 'u_b'
VALUE_GROUP = 'value'
VAR_TYPE_GROUP = 'var_type'
add_variable(name, size=1, var_type='float', l_b=None, u_b=None, value=None)

Add a variable to the design space.

Parameters
  • name – param size: (Default value = 1)

  • var_type – Default value = FLOAT)

  • l_b – Default value = None)

  • u_b – Default value = None)

  • value – Default value = None)

  • size – (Default value = 1)

array_to_dict(x_array)

Split the current point into a dictionary with variables names.

Parameters

x_array – x array to be converted to a dict of array

check()

Check the state of the design space.

check_membership(x_vect, variables_names=None)

Checks whether the input variables satisfy the design space requirements.

Parameters
  • x_vect (dict or array) – design variables

  • variables_names – names of the variables to be checked

dict_to_array(x_dict, all_vars=True, all_var_list=None)

Aggregate a point as dictionary into array.

Parameters
  • x_dict – point as dictionary

  • all_vars – if True, all variables shall be in x_dict

  • all_var_list – list of whole set of variables, if None, use self.variables_names

export_hdf(file_path, append=False)

Export to hdf file.

Parameters
  • file_path – path to file to write

  • append – if True, appends the data in the file

export_to_txt(output_file, fields=None, header_char='', **table_options)

Exports the design space to a text file.

Parameters
  • output_file – output file path

  • fields – list of fields to export, by default all

extend(other)

Extend the design space with another design space.

Parameters

other (DesignSpace) – design space to be appended

filter(keep_variables, copy=False)

Filter the design space to keep a sublist of variables.

Parameters
  • keep_variables (str of list(str)) – the list of variables to keep

  • copy (bool) – if True then a copy of the design space is filtered, otherwise the design space itself is filtered

Returns

the filtered design space (or a copy)

Return type

DesignSpace

filter_dim(variable, keep_dimensions)

Filters the design space to keep a sublist of dimensions for a given variable.

Parameters
  • variable – the variable

  • keep_dimensions – the list of dimension to keep

get_active_bounds(x_vec=None, tol=1e-08)

Determine which bound constraints of the current point are active.

Parameters
  • x_vec – the point at which we check the bounds

  • tol – tolerance of comparison of a scalar with a bound (Default value = 1e-8)

get_current_x(variables_names=None)

Gets the current point in the design space.

Parameters

variables_names (list(str)) – names of the required variables, optional

Returns

the x vector as array

Return type

ndarray

get_current_x_dict()

Get the current point in the design space.

Returns

the x vector as a dict, keys are the variable names values are the variable vales as np array

get_current_x_normalized()

Returns the current point normalized.

Returns

the x vector as array normalized by the bounds

get_indexed_var_name(variable_name)

Return a list of the variables names with their indices such as.

[x!0,x!1,y,z!0,z!1]

Parameters

variable_name (str) – name of the variable

Returns

names of the variable components

Return type

list(str)

get_indexed_variables_names()

Return a list of the variables names with their indices such as.

[x!0,x!1,y,z!0,z!1]

Returns

names of all the variables components

Return type

list(str)

get_lower_bound(name)

Gets the lower bound of a variable.

Parameters

name – variable name

Returns

variable lower bound (possibly infinite)

get_lower_bounds(variables_names=None)

Generates an array of the variables’ lower bounds.

Parameters

variables_names – names of the variables of which the lower bounds are required

get_pretty_table(fields=None)

Builds a PrettyTable object from the design space data.

Parameters

fields – list of fields to export, by default all

Returns

the pretty table object

get_size(name)

Get the size of a variable Return None if the variable is not known.

Parameters

name – name of the variable

get_type(name)

Get the type of a variable Return None if the variable is not known.

Parameters

name – name of the variable

get_upper_bound(name)

Gets the upper bound of a variable.

Parameters

name – variable name

Returns

variable upper bound (possibly infinite)

get_upper_bounds(variables_names=None)

Generates an array of the variables’ upper bounds.

Parameters

variables_names – names of the variables of which the upper bounds are required

get_variables_indexes(variables_names)

Return the indexes of a design array corresponding to the variables names.

Parameters

variables_names (list(str)) – names of the variables

Returns

indexes of a design array corresponding to the variables names

Return type

ndarray

has_current_x()

Tests if current_x is defined.

Returns

True if current_x is defined

import_hdf(file_path)

Imports design space from hdf file.

Parameters

file_path

normalize_vect(x_vect, minus_lb=True)

Normalizes a vector of the design space. Unbounded variables are not normalized.

Parameters
  • x_vect (ndarray) – design variables

  • minus_lb – if True, remove lower bounds at normalization

Returns

normalized vector

project_into_bounds(x_c, normalized=False)

Projects x_c onto the bounds, using a simple coordinate wise approach.

Parameters
  • normalized (bool) – if True then the vector is assumed to be normalized

  • x_c – x vector (np array)

Returns

projected x_c

static read_from_txt(input_file, header=None)

Parses a csv file to read the DesignSpace.

Parameters
  • input_file – returns: s: the design space

  • header – fields list, or by default, read in the file

Returns

the design space

remove_variable(name)

Remove a variable (and bounds and types) from the design space.

Parameters

name – name of the variable to remove

round_vect(x_vect)

Rounds the vector where variables are of integer type.

Parameters

x_vect – design variables to round

set_current_variable(name, current_value)

Set the current value of a single variable.

Parameters
  • name – name of the variable

  • current_value – current value of the variable

set_current_x(current_x)

Set the current point.

Parameters

current_x – the current design vector

set_lower_bound(name, lower_bound)

Set a new lower bound for variable name.

Parameters
  • name – name of the variable

  • lower_bound – lower bound

set_upper_bound(name, upper_bound)

Set a new upper bound for variable name.

Parameters
  • name – name of the variable

  • upper_bound – upper bound

to_complex()

Casts the current value to complex.

unnormalize_vect(x_vect, minus_lb=True, no_check=False)

Unnormalizes a normalized vector of the design space.

Parameters
  • x_vect (ndarray) – design variables

  • minus_lb – if True, remove lower bounds at normalization

  • no_check – if True, don’t check that values are in [0,1]

Returns

normalized vector