OptimisationConstraint

class compas_fea2.optimisation.OptimisationConstraint(*args, **kwargs)[source]

Define an optimisation constraint.

Note

Constraints can be set by simply using the ==, >=, <= operators.

Note

In topology optimization the start model for the optimization is the model used for the first finite element analysis in the optimization procedure (iteration 0). The element densities might differ from the initial model (e.g. when no volume constraint is present they are set to 50% of the original density). Take this into account when defining, e.g., relative displacement or frequency onstraints. This behavior can be controlled by the user with the parameter DENSITY_INITIAL in the OptimisationParameters command.

Warning

Inequality constraints can only be used for the sensitivity-based optimizations. Equality constraints can be used only for controller-based optimisations.

Parameters
  • name (str) – name of the constraint

  • design_response (obj) – compas_fea2.optimisation.DesignResponse subclass object of the desing response to constraint

  • relative (bool) – if True the constraint is set relatively to the initial value of the desing response. Relative values always refer to the design response of the start model for the optimization. Example: The relative value 0.8 represents 80%

Example

>>> constraint = OptimisationConstraint('vol_frac', dr_volume, True)
>>> constraint <= 0.3

Inherited Methods

ToString

Converts the instance to a string.

copy

Make an independent copy of the data object.

from_data

Construct an object of this type from the provided data.

from_json

Construct an object from serialized data contained in a JSON file.

from_jsonstring

Construct an object from serialized data contained in a JSON string.

from_name

Create an instance of a class of the registered plugin from its name.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_data

Convert an object to its native data representation.

to_json

Serialize the data representation of an object to a JSON file.

to_jsonstring

Serialize the data representation of an object to a JSON string.

validate_data

Validate the object's data against its data schema.

validate_json

Validate the object's data against its json schema.