foxes_opt.problems.layout.geom_layouts.constraints¶
Classes¶
Boundary constraint for purely geometrical layouts problems. |
|
Fixed number of turbines constraint for purely geometrical layouts problems. |
|
Maximal number of turbines constraint for purely geometrical layouts problems. |
|
Minimal turbine density constraint for purely geometrical layouts problems. |
|
Minimal number of turbines constraint for purely geometrical layouts problems. |
|
Minimal distance constraint for purely geometrical layouts problems. |
|
Validity constraint for purely geometrical layouts problems. |
Module Contents¶
-
class foxes_opt.problems.layout.geom_layouts.constraints.Boundary(problem: iwopy.Problem, n_turbines: int | None =
None, D: float | None =None, name: str ='boundary', **kwargs: Any)[source]¶ Bases:
iwopy.ConstraintBoundary constraint for purely geometrical layouts problems.
- Parameters:¶
- problem
The underlying geometrical layout optimization problem
- n_turbines
The number of turbines
- D
The rotor diameter
- name
The constraint name
- kwargs
Additioal parameters for the base class
- active_components(vars_float: numpy.ndarray, lower: numpy.ndarray, upper: numpy.ndarray) numpy.ndarray¶
Select components that can bind within a guarded variable box.
- Parameters:¶
- vars_float
Initial values in this function’s float-variable order.
- lower, upper
Enforced variable bounds in the same order. Infinite bounds must be treated conservatively.
- Returns:¶
- components
Unique local component indices. The default retains all. Overrides may omit a component only when it is guaranteed feasible throughout the box, not merely at the initial point. Full evaluation and feasibility contracts remain unchanged.
-
ana_deriv(vars_int: numpy.ndarray, vars_float: numpy.ndarray, var: int, components: collections.abc.Sequence[int] | numpy.ndarray | None =
None) numpy.ndarray[source]¶ Calculate the analytical derivative for one float variable.
-
calc_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for a single individual of the underlying problem.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_vars_int,)
- vars_float
The float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_sel_components,)
-
calc_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for all individuals of a population.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_pop, n_vars_int)
- vars_float
The float variable values, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_pop, n_sel_components)
-
check_individual(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given individual.
-
check_population(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given population.
-
finalize(verbosity: int =
0, /) None¶ -
finalize(*, verbosity: int =
0) None Finalize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
-
finalize_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the champion data.
- Parameters:¶
- vars_int
The optimal integer variable values, shape: (n_vars_int,)
- vars_float
The optimal float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_components,)
-
finalize_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the final population data.
- Parameters:¶
- vars_int
The integer variable values of the final generation, shape: (n_pop, n_vars_int)
- vars_float
The float variable values of the final generation, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_pop, n_components)
- get_bounds() tuple[numpy.ndarray, numpy.ndarray]¶
Returns the bounds for all components.
Non-existing bounds are expressed by np.inf.
- Returns:¶
- min
The lower bounds, shape: (n_components,)
- max
The upper bounds, shape: (n_components,)
-
initialize(verbosity: int =
0) None¶ Initialize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
- n_components() int[source]¶
Returns the number of components of the function.
- Returns:¶
- value
The number of components.
- classmethod new(constraint_type: str, *args: object, **kwargs: object) Constraint¶
Run-time constraint factory.
- Parameters:¶
- constraint_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
- rename_vars_float(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename float variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- rename_vars_int(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename integer variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- vardeps_float() numpy.ndarray¶
Gets the dependencies of all components on the function float variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_float)
- vardeps_int() numpy.ndarray¶
Gets the dependencies of all components on the function int variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_int)
- D¶
- property component_names : list[str]¶
The names of the components
- Returns:¶
- names
The component names
- property initialized : bool¶
Flag for finished initialization
- Returns:¶
- initialized
True if initialization has been done
- n_turbines¶
-
name =
'Base'¶
- problem¶
-
tol =
1e-05¶
-
class foxes_opt.problems.layout.geom_layouts.constraints.CFixN(problem: iwopy.Problem, N: int, name: str =
'cfixN', **kwargs: Any)[source]¶ Bases:
foxes_opt.core.zero_derivatives.ZeroFloatDerivatives,iwopy.ConstraintFixed number of turbines constraint for purely geometrical layouts problems.
- Parameters:¶
- problem
The underlying geometrical layout optimization problem
- N
The number of turbines
- name
The constraint name
- kwargs
Additioal parameters for the base class
- active_components(vars_float: numpy.ndarray, lower: numpy.ndarray, upper: numpy.ndarray) numpy.ndarray¶
Select components that can bind within a guarded variable box.
- Parameters:¶
- vars_float
Initial values in this function’s float-variable order.
- lower, upper
Enforced variable bounds in the same order. Infinite bounds must be treated conservatively.
- Returns:¶
- components
Unique local component indices. The default retains all. Overrides may omit a component only when it is guaranteed feasible throughout the box, not merely at the initial point. Full evaluation and feasibility contracts remain unchanged.
-
ana_deriv(vars_int: numpy.ndarray, vars_float: numpy.ndarray, var: int, components: collections.abc.Sequence[int] | numpy.ndarray | None =
None) numpy.ndarray¶ Calculate the analytical derivative for one float variable.
-
calc_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for a single individual of the underlying problem.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_vars_int,)
- vars_float
The float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_sel_components,)
-
calc_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for all individuals of a population.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_pop, n_vars_int)
- vars_float
The float variable values, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_pop, n_sel_components)
-
check_individual(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given individual.
-
check_population(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given population.
-
finalize(verbosity: int =
0, /) None¶ -
finalize(*, verbosity: int =
0) None Finalize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
-
finalize_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the champion data.
- Parameters:¶
- vars_int
The optimal integer variable values, shape: (n_vars_int,)
- vars_float
The optimal float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_components,)
-
finalize_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the final population data.
- Parameters:¶
- vars_int
The integer variable values of the final generation, shape: (n_pop, n_vars_int)
- vars_float
The float variable values of the final generation, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_pop, n_components)
- get_bounds() tuple[numpy.ndarray, numpy.ndarray]¶
Returns the bounds for all components.
Non-existing bounds are expressed by np.inf.
- Returns:¶
- min
The lower bounds, shape: (n_components,)
- max
The upper bounds, shape: (n_components,)
-
initialize(verbosity: int =
0) None¶ Initialize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
- n_components() int[source]¶
Returns the number of components of the function.
- Returns:¶
- value
The number of components.
- classmethod new(constraint_type: str, *args: object, **kwargs: object) Constraint¶
Run-time constraint factory.
- Parameters:¶
- constraint_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
- rename_vars_float(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename float variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- rename_vars_int(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename integer variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- vardeps_float() numpy.ndarray¶
Gets the dependencies of all components on the function float variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_float)
- vardeps_int() numpy.ndarray¶
Gets the dependencies of all components on the function int variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_int)
- N¶
- property component_names : list[str]¶
The names of the components
- Returns:¶
- names
The component names
- property initialized : bool¶
Flag for finished initialization
- Returns:¶
- initialized
True if initialization has been done
-
name =
'Base'¶
- problem¶
-
tol =
1e-05¶
-
class foxes_opt.problems.layout.geom_layouts.constraints.CMaxN(problem: iwopy.Problem, N: int, name: str =
'cmaxN', **kwargs: Any)[source]¶ Bases:
foxes_opt.core.zero_derivatives.ZeroFloatDerivatives,iwopy.ConstraintMaximal number of turbines constraint for purely geometrical layouts problems.
- Parameters:¶
- problem
The underlying geometrical layout optimization problem
- N
The maximal number of turbines
- name
The constraint name
- kwargs
Additioal parameters for the base class
- active_components(vars_float: numpy.ndarray, lower: numpy.ndarray, upper: numpy.ndarray) numpy.ndarray¶
Select components that can bind within a guarded variable box.
- Parameters:¶
- vars_float
Initial values in this function’s float-variable order.
- lower, upper
Enforced variable bounds in the same order. Infinite bounds must be treated conservatively.
- Returns:¶
- components
Unique local component indices. The default retains all. Overrides may omit a component only when it is guaranteed feasible throughout the box, not merely at the initial point. Full evaluation and feasibility contracts remain unchanged.
-
ana_deriv(vars_int: numpy.ndarray, vars_float: numpy.ndarray, var: int, components: collections.abc.Sequence[int] | numpy.ndarray | None =
None) numpy.ndarray¶ Calculate the analytical derivative for one float variable.
-
calc_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for a single individual of the underlying problem.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_vars_int,)
- vars_float
The float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_sel_components,)
-
calc_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for all individuals of a population.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_pop, n_vars_int)
- vars_float
The float variable values, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_pop, n_sel_components)
-
check_individual(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given individual.
-
check_population(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given population.
-
finalize(verbosity: int =
0, /) None¶ -
finalize(*, verbosity: int =
0) None Finalize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
-
finalize_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the champion data.
- Parameters:¶
- vars_int
The optimal integer variable values, shape: (n_vars_int,)
- vars_float
The optimal float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_components,)
-
finalize_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the final population data.
- Parameters:¶
- vars_int
The integer variable values of the final generation, shape: (n_pop, n_vars_int)
- vars_float
The float variable values of the final generation, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_pop, n_components)
- get_bounds() tuple[numpy.ndarray, numpy.ndarray]¶
Returns the bounds for all components.
Non-existing bounds are expressed by np.inf.
- Returns:¶
- min
The lower bounds, shape: (n_components,)
- max
The upper bounds, shape: (n_components,)
-
initialize(verbosity: int =
0) None¶ Initialize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
- n_components() int[source]¶
Returns the number of components of the function.
- Returns:¶
- value
The number of components.
- classmethod new(constraint_type: str, *args: object, **kwargs: object) Constraint¶
Run-time constraint factory.
- Parameters:¶
- constraint_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
- rename_vars_float(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename float variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- rename_vars_int(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename integer variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- vardeps_float() numpy.ndarray¶
Gets the dependencies of all components on the function float variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_float)
- vardeps_int() numpy.ndarray¶
Gets the dependencies of all components on the function int variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_int)
- N¶
- property component_names : list[str]¶
The names of the components
- Returns:¶
- names
The component names
- property initialized : bool¶
Flag for finished initialization
- Returns:¶
- initialized
True if initialization has been done
-
name =
'Base'¶
- problem¶
-
tol =
1e-05¶
-
class foxes_opt.problems.layout.geom_layouts.constraints.CMinDensity(problem: iwopy.Problem, min_value: float, dfactor: int =
1, name: str ='min_density')[source]¶ Bases:
iwopy.ConstraintMinimal turbine density constraint for purely geometrical layouts problems.
- Parameters:¶
- problem
The underlying geometrical layout optimization problem
- min_value
The minimal turbine density
- dfactor
Delta factor for grid spacing
- name
The constraint name
- kwargs
Additioal parameters for the base class
- active_components(vars_float: numpy.ndarray, lower: numpy.ndarray, upper: numpy.ndarray) numpy.ndarray¶
Select components that can bind within a guarded variable box.
- Parameters:¶
- vars_float
Initial values in this function’s float-variable order.
- lower, upper
Enforced variable bounds in the same order. Infinite bounds must be treated conservatively.
- Returns:¶
- components
Unique local component indices. The default retains all. Overrides may omit a component only when it is guaranteed feasible throughout the box, not merely at the initial point. Full evaluation and feasibility contracts remain unchanged.
-
ana_deriv(vars_int: numpy.ndarray, vars_float: numpy.ndarray, var: int, components: collections.abc.Sequence[int] | numpy.ndarray | None =
None) numpy.ndarray[source]¶ Calculate the analytical derivative for one float variable.
-
calc_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for a single individual of the underlying problem.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_vars_int,)
- vars_float
The float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_sel_components,)
-
calc_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for all individuals of a population.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_pop, n_vars_int)
- vars_float
The float variable values, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_pop, n_sel_components)
-
check_individual(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given individual.
-
check_population(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given population.
-
finalize(verbosity: int =
0, /) None¶ -
finalize(*, verbosity: int =
0) None Finalize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
-
finalize_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the champion data.
- Parameters:¶
- vars_int
The optimal integer variable values, shape: (n_vars_int,)
- vars_float
The optimal float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_components,)
-
finalize_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the final population data.
- Parameters:¶
- vars_int
The integer variable values of the final generation, shape: (n_pop, n_vars_int)
- vars_float
The float variable values of the final generation, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_pop, n_components)
- get_bounds() tuple[numpy.ndarray, numpy.ndarray]¶
Returns the bounds for all components.
Non-existing bounds are expressed by np.inf.
- Returns:¶
- min
The lower bounds, shape: (n_components,)
- max
The upper bounds, shape: (n_components,)
- initialize(verbosity: int) None[source]¶
Initialize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
- n_components() int[source]¶
Returns the number of components of the function.
- Returns:¶
- value
The number of components.
- classmethod new(constraint_type: str, *args: object, **kwargs: object) Constraint¶
Run-time constraint factory.
- Parameters:¶
- constraint_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
- rename_vars_float(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename float variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- rename_vars_int(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename integer variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- vardeps_float() numpy.ndarray¶
Gets the dependencies of all components on the function float variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_float)
- vardeps_int() numpy.ndarray¶
Gets the dependencies of all components on the function int variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_int)
- property component_names : list[str]¶
The names of the components
- Returns:¶
- names
The component names
-
dfactor =
1¶
- property initialized : bool¶
Flag for finished initialization
- Returns:¶
- initialized
True if initialization has been done
- min_value¶
-
name =
'Base'¶
- problem¶
-
tol =
1e-05¶
-
class foxes_opt.problems.layout.geom_layouts.constraints.CMinN(problem: iwopy.Problem, N: int, name: str =
'cminN', **kwargs: Any)[source]¶ Bases:
foxes_opt.core.zero_derivatives.ZeroFloatDerivatives,iwopy.ConstraintMinimal number of turbines constraint for purely geometrical layouts problems.
Initialize the constraint.
- Parameters:¶
- args
Positional parameters for the base class.
- tol
Feasibility tolerance applied to every constraint component.
- kwargs
Keyword parameters for the base class.
- active_components(vars_float: numpy.ndarray, lower: numpy.ndarray, upper: numpy.ndarray) numpy.ndarray¶
Select components that can bind within a guarded variable box.
- Parameters:¶
- vars_float
Initial values in this function’s float-variable order.
- lower, upper
Enforced variable bounds in the same order. Infinite bounds must be treated conservatively.
- Returns:¶
- components
Unique local component indices. The default retains all. Overrides may omit a component only when it is guaranteed feasible throughout the box, not merely at the initial point. Full evaluation and feasibility contracts remain unchanged.
-
ana_deriv(vars_int: numpy.ndarray, vars_float: numpy.ndarray, var: int, components: collections.abc.Sequence[int] | numpy.ndarray | None =
None) numpy.ndarray¶ Calculate the analytical derivative for one float variable.
-
calc_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for a single individual of the underlying problem.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_vars_int,)
- vars_float
The float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_sel_components,)
-
calc_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for all individuals of a population.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_pop, n_vars_int)
- vars_float
The float variable values, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_pop, n_sel_components)
-
check_individual(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given individual.
-
check_population(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given population.
-
finalize(verbosity: int =
0, /) None¶ -
finalize(*, verbosity: int =
0) None Finalize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
-
finalize_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the champion data.
- Parameters:¶
- vars_int
The optimal integer variable values, shape: (n_vars_int,)
- vars_float
The optimal float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_components,)
-
finalize_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the final population data.
- Parameters:¶
- vars_int
The integer variable values of the final generation, shape: (n_pop, n_vars_int)
- vars_float
The float variable values of the final generation, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_pop, n_components)
- get_bounds() tuple[numpy.ndarray, numpy.ndarray]¶
Returns the bounds for all components.
Non-existing bounds are expressed by np.inf.
- Returns:¶
- min
The lower bounds, shape: (n_components,)
- max
The upper bounds, shape: (n_components,)
-
initialize(verbosity: int =
0) None¶ Initialize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
- n_components() int[source]¶
Returns the number of components of the function.
- Returns:¶
- value
The number of components.
- classmethod new(constraint_type: str, *args: object, **kwargs: object) Constraint¶
Run-time constraint factory.
- Parameters:¶
- constraint_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
- rename_vars_float(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename float variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- rename_vars_int(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename integer variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- vardeps_float() numpy.ndarray¶
Gets the dependencies of all components on the function float variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_float)
- vardeps_int() numpy.ndarray¶
Gets the dependencies of all components on the function int variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_int)
- N¶
- property component_names : list[str]¶
The names of the components
- Returns:¶
- names
The component names
- property initialized : bool¶
Flag for finished initialization
- Returns:¶
- initialized
True if initialization has been done
-
name =
'Base'¶
- problem¶
-
tol =
1e-05¶
-
class foxes_opt.problems.layout.geom_layouts.constraints.MinDist(problem: iwopy.Problem, min_dist: float | None =
None, n_turbines: int | None =None, name: str ='min_dist', **kwargs: Any)[source]¶ Bases:
iwopy.ConstraintMinimal distance constraint for purely geometrical layouts problems.
- Parameters:¶
- problem
The underlying geometrical layout optimization problem
- min_dist
The minimal distance between turbines
- n_turbines
The number of turbines
- name
The constraint name
- kwargs
Additioal parameters for the base class
- active_components(vars_float: numpy.ndarray, lower: numpy.ndarray, upper: numpy.ndarray) numpy.ndarray¶
Select components that can bind within a guarded variable box.
- Parameters:¶
- vars_float
Initial values in this function’s float-variable order.
- lower, upper
Enforced variable bounds in the same order. Infinite bounds must be treated conservatively.
- Returns:¶
- components
Unique local component indices. The default retains all. Overrides may omit a component only when it is guaranteed feasible throughout the box, not merely at the initial point. Full evaluation and feasibility contracts remain unchanged.
-
ana_deriv(vars_int: numpy.ndarray, vars_float: numpy.ndarray, var: int, components: collections.abc.Sequence[int] | numpy.ndarray | None =
None) numpy.ndarray[source]¶ Calculate the analytical derivative for one float variable.
-
calc_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for a single individual of the underlying problem.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_vars_int,)
- vars_float
The float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_sel_components,)
-
calc_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for all individuals of a population.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_pop, n_vars_int)
- vars_float
The float variable values, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_pop, n_sel_components)
-
check_individual(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given individual.
-
check_population(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given population.
-
finalize(verbosity: int =
0, /) None¶ -
finalize(*, verbosity: int =
0) None Finalize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
-
finalize_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the champion data.
- Parameters:¶
- vars_int
The optimal integer variable values, shape: (n_vars_int,)
- vars_float
The optimal float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_components,)
-
finalize_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the final population data.
- Parameters:¶
- vars_int
The integer variable values of the final generation, shape: (n_pop, n_vars_int)
- vars_float
The float variable values of the final generation, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_pop, n_components)
- get_bounds() tuple[numpy.ndarray, numpy.ndarray]¶
Returns the bounds for all components.
Non-existing bounds are expressed by np.inf.
- Returns:¶
- min
The lower bounds, shape: (n_components,)
- max
The upper bounds, shape: (n_components,)
-
initialize(verbosity: int =
0) None[source]¶ Initialize the constaint.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
- n_components() int[source]¶
Returns the number of components of the function.
- Returns:¶
- value
The number of components.
- classmethod new(constraint_type: str, *args: object, **kwargs: object) Constraint¶
Run-time constraint factory.
- Parameters:¶
- constraint_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
- rename_vars_float(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename float variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- rename_vars_int(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename integer variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- vardeps_float() numpy.ndarray¶
Gets the dependencies of all components on the function float variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_float)
- vardeps_int() numpy.ndarray¶
Gets the dependencies of all components on the function int variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_int)
- property component_names : list[str]¶
The names of the components
- Returns:¶
- names
The component names
- property initialized : bool¶
Flag for finished initialization
- Returns:¶
- initialized
True if initialization has been done
- min_dist¶
- n_turbines¶
-
name =
'Base'¶
- problem¶
-
tol =
1e-05¶
-
class foxes_opt.problems.layout.geom_layouts.constraints.Valid(problem: iwopy.Problem, name: str =
'valid', **kwargs: Any)[source]¶ Bases:
foxes_opt.core.zero_derivatives.ZeroFloatDerivatives,iwopy.ConstraintValidity constraint for purely geometrical layouts problems.
- Parameters:¶
- problem
The underlying geometrical layout optimization problem
- name
The constraint name
- kwargs
Additioal parameters for the base class
- active_components(vars_float: numpy.ndarray, lower: numpy.ndarray, upper: numpy.ndarray) numpy.ndarray¶
Select components that can bind within a guarded variable box.
- Parameters:¶
- vars_float
Initial values in this function’s float-variable order.
- lower, upper
Enforced variable bounds in the same order. Infinite bounds must be treated conservatively.
- Returns:¶
- components
Unique local component indices. The default retains all. Overrides may omit a component only when it is guaranteed feasible throughout the box, not merely at the initial point. Full evaluation and feasibility contracts remain unchanged.
-
ana_deriv(vars_int: numpy.ndarray, vars_float: numpy.ndarray, var: int, components: collections.abc.Sequence[int] | numpy.ndarray | None =
None) numpy.ndarray¶ Calculate the analytical derivative for one float variable.
-
calc_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for a single individual of the underlying problem.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_vars_int,)
- vars_float
The float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_sel_components,)
-
calc_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: tuple[numpy.ndarray, numpy.ndarray], cmpnts: list[int] | None =
None) numpy.ndarray[source]¶ Calculate values for all individuals of a population.
- Parameters:¶
- vars_int
The integer variable values, shape: (n_pop, n_vars_int)
- vars_float
The float variable values, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- components
The selected components or None for all
- Returns:¶
- values
The component values, shape: (n_pop, n_sel_components)
-
check_individual(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given individual.
-
check_population(constraint_values: numpy.ndarray, verbosity: int =
0) numpy.ndarray¶ Check if the constraints are fullfilled for the given population.
-
finalize(verbosity: int =
0, /) None¶ -
finalize(*, verbosity: int =
0) None Finalize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
-
finalize_individual(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the champion data.
- Parameters:¶
- vars_int
The optimal integer variable values, shape: (n_vars_int,)
- vars_float
The optimal float variable values, shape: (n_vars_float,)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_components,)
-
finalize_population(vars_int: numpy.ndarray, vars_float: numpy.ndarray, problem_results: object, verbosity: int =
1) numpy.ndarray¶ Finalization, given the final population data.
- Parameters:¶
- vars_int
The integer variable values of the final generation, shape: (n_pop, n_vars_int)
- vars_float
The float variable values of the final generation, shape: (n_pop, n_vars_float)
- problem_results
The results of the variable application to the problem
- verbosity
The verbosity level, 0 = silent
- Returns:¶
- values
The component values, shape: (n_pop, n_components)
- get_bounds() tuple[numpy.ndarray, numpy.ndarray]¶
Returns the bounds for all components.
Non-existing bounds are expressed by np.inf.
- Returns:¶
- min
The lower bounds, shape: (n_components,)
- max
The upper bounds, shape: (n_components,)
-
initialize(verbosity: int =
0) None¶ Initialize the object.
- Parameters:¶
- verbosity
The verbosity level, 0 = silent
- n_components() int[source]¶
Returns the number of components of the function.
- Returns:¶
- value
The number of components.
- classmethod new(constraint_type: str, *args: object, **kwargs: object) Constraint¶
Run-time constraint factory.
- Parameters:¶
- constraint_type
The selected derived class name
- args
Additional parameters for constructor
- kwargs
Additional parameters for constructor
- rename_vars_float(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename float variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- rename_vars_int(varmap: collections.abc.Mapping[str | int, str]) None¶
Rename integer variables.
- Parameters:¶
- varmap
The name mapping. Key: old name str, Value: new name str
- vardeps_float() numpy.ndarray¶
Gets the dependencies of all components on the function float variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_float)
- vardeps_int() numpy.ndarray¶
Gets the dependencies of all components on the function int variables
- Returns:¶
- deps
The dependencies of components on function variables, shape: (n_components, n_vars_int)
- property component_names : list[str]¶
The names of the components
- Returns:¶
- names
The component names
- property initialized : bool¶
Flag for finished initialization
- Returns:¶
- initialized
True if initialization has been done
-
name =
'Base'¶
- problem¶
-
tol =
1e-05¶