FitnessTermDefinition#

class ansys.hps.client.jms.FitnessTermDefinition(id=<marshmallow.missing>, name=<marshmallow.missing>, expression=<marshmallow.missing>, type=<marshmallow.missing>, weighting_factor=<marshmallow.missing>, **kwargs)#

Provides the fitness term definition resource.

Parameters:
idstr, optional

Unique ID to access the resource, generated internally by the server on creation.

namestr, optional

Name of the fitness term.

expressionstr, optional

Python expression that defines the fitness term.

typestr, optional

Fitness term type.

weighting_factorfloat, optional

Relative importance of the fitness term in comparison to other fitness terms.

Examples

Create a fitness term of the objective type.

>>> ft1 = FitnessTermDefinition(
...     name="weight",
...     type="design_objective",
...     weighting_factor=1.0,
...     expression="map_design_objective(values['weight'],7.5,5.5)"
... )

Create a fitness term of the target constraint type.

>>> ft2 = FitnessTermDefinition(
...     name="torsional_stiffness",
...     type="target_constraint",
...     weighting_factor=0.8,
...     expression="map_target_constraint(
...         values['torsion_stiffness'], 1313.0, 5.0, 30.0)"
... )

Create a fitness term of the limit constraint type.

>>> ft3 = FitnessTermDefinition(
...     name="max_stress",
...     type="limit_constraint",
...     weighting_factor=0.6,
...     expression="map_limit_constraint(
...         values['max_stress'], 451.0, 50.0 )"
... )

Initialize the object.

Methods

FitnessTermDefinition.declared_fields()

Provide a helper function for retrieving fields.

FitnessTermDefinition.get(key[, default])

Get an item from the object, returning a default value if the key is not found.