- class iwopy.wrappers.DiscretizeRegGrid(iwopy.wrappers.LocalFD)[source]
A wrapper that provides finite distance differentiation on a regular grid for selected or all problem float variables.
Attributes¶
- grid: iwopy.tools.RegularDiscretizationGrid
The discretization grid
- order: dict
Finite difference order. Key: variable name str, value: 1 = forward, -1 = backward, 2 = centre
- orderb: dict or int
Finite difference order of boundary points. Key: variable name str, value: order int
Public members¶
-
DiscretizeRegGrid(base_problem, deltas, fd_order=
1
, ...)[source] Constructor
-
initialize(verbosity=
1
)[source] Initialize the problem.
- apply_individual(vars_int, vars_float)[source]
Apply new variables to the problem.
- apply_population(vars_int, vars_float)[source]
Apply new variables to the problem, for a whole population.
-
evaluate_individual(vars_int, vars_float, ret_prob_res=
False
)[source] Evaluate a single individual of the problem.
-
evaluate_population(vars_int, vars_float, ret_prob_res=
False
)[source] Evaluate all individuals of a population.
-
finalize_individual(vars_int, vars_float, verbosity=
1
)[source] Finalization, given the champion data.
-
finalize_population(vars_int, vars_float, verbosity=
0
)[source] Finalization, given the final population data.
- calc_gradients(vars_int, vars_float, func, components, ivars, ...)[source]
The actual gradient calculation, not to be called directly (call get_gradients instead).
- var_names_int()[source]
The names of integer variables.
- initial_values_int()[source]
The initial values of the integer variables.
- min_values_int()[source]
The minimal values of the integer variables.
- max_values_int()[source]
The maximal values of the integer variables.
- var_names_float()[source]
The names of float variables.
- initial_values_float()[source]
The initial values of the float variables.
- min_values_float()[source]
The minimal values of the float variables.
- max_values_float()[source]
The maximal values of the float variables.
-
INT_INF =
-999999
- property n_vars_int
The number of int variables
- property n_vars_float
The number of float variables
-
add_objective(objective, varmap_int=
None
, varmap_float=None
, ...)[source] Add an objective to the problem.
-
add_constraint(constraint, varmap_int=
None
, varmap_float=None
, ...)[source] Add a constraint to the problem.
- property min_values_constraints
Gets the minimal values of constraints
- property max_values_constraints
Gets the maximal values of constraints
- property constraints_tol
Gets the tolerance values of constraints
- property n_objectives
The total number of objectives, i.e., the sum of all components
- property n_constraints
The total number of constraints, i.e., the sum of all components
-
get_gradients(vars_int, vars_float, func=
None
, components=None
, ...)[source] Obtain gradients of a function that is linked to the problem.
- property maximize_objs
Flags for objective maximization
-
check_constraints_individual(constraint_values, verbosity=
0
)[source] Check if the constraints are fullfilled for the given individual.
-
check_constraints_population(constraint_values, verbosity=
0
)[source] Check if the constraints are fullfilled for the given population.
- prob_res_einsum_individual(prob_res_list, coeffs)[source]
Calculate the einsum of problem results
- prob_res_einsum_population(prob_res_list, coeffs)[source]
Calculate the einsum of problem results
- property initialized
Flag for finished initialization