Public Python API¶
Import the main configuration and fitting classes from rend. The export section also describes helpers in rend.json_interchange.
MaterialRegressor constructor¶
from rend import (
MaterialRegressor,
MaterialProfile,
StressUnit,
ValidationRanges,
DeformationRange,
SearchPhysicsChecks,
StrongEllipticityCheck,
PostSearchChecks,
ConstitutiveChecks,
FEChecks,
)
regressor = MaterialRegressor(
csv_path="tests.csv",
profile=MaterialProfile.INCOMPRESSIBLE_ANISOTROPIC,
material_directions=((1.0, 0.0, 0.0),),
stress_unit=StressUnit.MPA,
max_generations=500,
target_mse=1e-3,
validation_ranges=ValidationRanges(
uniaxial=DeformationRange(1.0, 1.7),
biaxial=None,
planar=None,
shear=DeformationRange(-0.3, 0.3),
),
search_checks=SearchPhysicsChecks(
strong_ellipticity=StrongEllipticityCheck(step=0.04),
reference_stability=True,
),
post_search_checks=PostSearchChecks(
constitutive=ConstitutiveChecks(max_states=30),
fe=FEChecks(kinematic=True, robustness=True),
),
edge_weighting=None, # Default: no beginning/end emphasis
group_weighting=None, # Default: unweighted curves
)
result = regressor.run()
Required keyword-only arguments¶
| Argument | Type | Meaning |
|---|---|---|
csv_path |
str \| Path |
Input measurements (see the CSV specification) |
profile |
MaterialProfile |
Material symmetry/compressibility and operator preset |
stress_unit |
StressUnit |
Stress-unit label without rescaling data |
max_generations |
int |
Maximum evolution generations |
target_mse |
positive float |
Dimensionless threshold. The weighted full-dataset MSE must be at most target_mse times the unweighted Rust target variance. Fit metrics. |
validation_ranges |
ValidationRanges |
Rust screening path intervals, also used as post-search representative load settings |
Optional keyword-only arguments¶
| Argument | Default | Meaning |
|---|---|---|
search_checks |
None |
SearchPhysicsChecks: optional Rust search-time physical acceptance criteria |
post_search_checks |
None |
PostSearchChecks: optional post-search Python constitutive and FEM verification |
material_directions |
() |
Fiber axes for incompressible anisotropic and dispersive profiles, orthonormal lattice axes for cubic symmetry, and no directions for isotropic profiles |
edge_weighting |
None |
Optional head/tail emphasis, not enabled by default |
group_weighting |
None |
Optional mode/tag weights or group balancing (unit weights by default) |
name |
"unnamed" |
Report/run label |
verbose |
False |
Periodic generation updates in the console |
live_plot |
False |
Interactive live plot |
export_json |
False |
Solver-neutral material JSON export |
export_uhyper |
False |
Restricted isotropic Abaqus source export |
export_calculix_umat |
False |
Compressible isotropic CalculiX ABAQUSNL source export |
Entry-point methods¶
| Call | Returns | Purpose |
|---|---|---|
MaterialRegressor(...) |
MaterialRegressor |
Validate configuration and prepare a discovery run. |
MaterialRegressor.advanced(search=SearchConfig(...), **kwargs) |
MaterialRegressor |
Customize search budgets/operators without changing the validation phases. |
regressor.run() |
DiscoveryResult |
CSV preflight → Rust search → Python checks → HTML report/optional exports. |
The compiled Rust executable is loaded only from the installed wheel (rend/_bin/rsr.exe). Each run writes results/<name>_<timestamp>/result.html and requested exports into the same directory.
Configure numerical verification through post_search_checks and optional Rust physics screening through search_checks. Pass reference fiber or lattice directions using material_directions, as shown above.
rend.api.MaterialRegressor ¶
MaterialRegressor(*, csv_path: str | Path, profile: MaterialProfile, max_generations: int, target_mse: float, validation_ranges: ValidationRanges, stress_unit: StressUnit, search_checks: SearchPhysicsChecks | None = None, post_search_checks: PostSearchChecks | None = None, verbose: bool = False, live_plot: bool = False, material_directions: tuple[tuple[float, float, float], ...] = (), name: str = 'unnamed', edge_weighting: EdgeWeighting | None = None, group_weighting: GroupWeighting | None = None, _search: SearchConfig | None = None, export_json: bool = False, export_uhyper: bool = False, export_calculix_umat: bool = False)
Discover symbolic hyperelastic strain-energy equations from measured data.
MaterialRegressor is Rend's main public entry point. Construct it
with typed physical settings, then call run(). It checks the CSV,
invokes the Rust discovery engine, optionally evaluates the resulting
models with FEM and Python float64 checks, and writes a timestamped
scientific HTML report. Each call runs with an isolated configuration.
Select the ordinary constructor for profile defaults. Use
advanced() with SearchConfig to override evolutionary
parameters and the active operator set.
Note
target_mse is an internally variance-scaled search stopping
criterion, not a promise about the dimensional MSE shown for the
discovered models. stress_unit labels the actual stress units of
the CSV: Rend does not convert input stress values.
Examples:
>>> from rend import (MaterialRegressor, MaterialProfile, StressUnit,
... ValidationRanges, DeformationRange, SearchPhysicsChecks,
... StrongEllipticityCheck)
>>> regressor = MaterialRegressor(
... csv_path="measurements.csv",
... profile=MaterialProfile.INCOMPRESSIBLE_ISOTROPIC,
... max_generations=500,
... target_mse=1e-3,
... validation_ranges=ValidationRanges(
... uniaxial=DeformationRange(1.0, 2.0),
... biaxial=None, planar=None, shear=None,
... ),
... search_checks=SearchPhysicsChecks(
... strong_ellipticity=StrongEllipticityCheck(step=0.04),
... reference_stability=True),
... stress_unit=StressUnit.MPA,
... )
>>> # result = regressor.run()
See Also
The CSV input specification documents supported columns and tags.
Configure one reproducible material-model discovery run.
The initial settings are validated at construction time. Existence and
physical consistency of the CSV rows are checked when run() is
invoked. Mandatory arguments have no hidden defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_path
|
str | Path
|
Path to a CSV file with |
required |
profile
|
MaterialProfile
|
One of five |
required |
max_generations
|
int
|
Positive upper limit of evolutionary generations. Search may finish earlier if the stopping criterion is reached. |
required |
target_mse
|
float
|
Positive, internally target-variance-scaled early-stop threshold; it is not the dimensional MSE displayed in the report. |
required |
validation_ranges
|
ValidationRanges
|
|
required |
search_checks
|
SearchPhysicsChecks | None
|
Optional Rust search-time physics checks. |
None
|
post_search_checks
|
PostSearchChecks | None
|
Optional independent Python constitutive and finite-element checks. Mandatory float64 and applicability scans still run for every reported model. |
None
|
stress_unit
|
StressUnit
|
Label of supplied CSV stress values; no conversion. |
required |
verbose
|
bool
|
Print periodic generation updates. Defaults to |
False
|
live_plot
|
bool
|
Display an interactive evolving plot while Rust runs;
|
False
|
material_directions
|
tuple[tuple[float, float, float], ...]
|
Unit reference material directions. One to three fiber axes for anisotropic/dispersive profiles; exactly three orthogonal lattice axes for cubic symmetry. Empty for isotropy. |
()
|
name
|
str
|
User-facing run label for logs and reports. |
'unnamed'
|
edge_weighting
|
EdgeWeighting | None
|
None (default) means no head/tail weighting; explicitly supply EdgeWeighting() to enable it. |
None
|
group_weighting
|
GroupWeighting | None
|
Optional |
None
|
export_json
|
bool
|
Write the solver-neutral material interchange. |
False
|
export_uhyper
|
bool
|
Generate Abaqus UHYPER source for supported models. |
False
|
export_calculix_umat
|
bool
|
Generate CalculiX ABAQUSNL source for supported models. |
False
|
Raises:
| Type | Description |
|---|---|
TypeError
|
A typed enum/configuration parameter has the wrong type. |
ValueError
|
Configuration limits, symmetry or required settings are invalid. These constructor errors are logged and re-raised. |
advanced
classmethod
¶
advanced(*, search: SearchConfig, **kwargs) -> 'MaterialRegressor'
Construct a regressor with explicit search-algorithm overrides.
This entry point sends SearchConfig parameters and operator
overrides to the Rust strain-energy search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search
|
SearchConfig
|
Search overrides supplied as a validated |
required |
**kwargs
|
object
|
Additional keyword arguments for the
|
{}
|
Returns:
| Type | Description |
|---|---|
'MaterialRegressor'
|
A configured |
Raises:
| Type | Description |
|---|---|
TypeError
|
|
Examples:
>>> from rend import SearchConfig, Operator
>>> # regressor = MaterialRegressor.advanced(
>>> # search=SearchConfig(num_islands=8,
>>> # exclude_operators=(Operator.DIVIDE,)),
>>> # csv_path="measurements.csv", profile=..., ...)
run ¶
run() -> DiscoveryResult
Execute the discovery pipeline and write its HTML report.
Stages: CSV preflight and group-weight preparation; Rust evolutionary
search and its built-in screening; independent Python float64 checks;
optional FEM checks; generation of a timestamped research report under
results/<run-name>_<timestamp>/result.html. The report includes equations that failed Python
checks, and distinguishes rejected from untested checks.
Progress and diagnostics use [info], [gen], [warning] and
[error] prefixes. Exceptions during execution are caught and reported
through DiscoveryResult instead of surfacing as tracebacks.
Returns:
| Type | Description |
|---|---|
DiscoveryResult
|
A |
DiscoveryResult
|
elapsed time, a report path if produced, and any execution error. |
DiscoveryResult
|
Check |
DiscoveryResult
|
|
Examples:
>>> # result = regressor.run()
>>> # if result.error:
>>> # print(result.error)
>>> # else:
>>> # for model in result.models[:5]:
>>> # print(model.mse, model.as_string)
Phase 2: optional Rust search-time physics¶
SearchPhysicsChecks¶
SearchPhysicsChecks(strong_ellipticity=None, reference_stability=False) configures optional physical requirements at Rust candidate admission and final Rust validation. Its absence does not disable the mandatory Rust numerical/reference screening.
rend.config.SearchPhysicsChecks
dataclass
¶
Optional Rust search-time physical admission checks.
Mandatory numerical guards and reference-stress checks cannot be disabled.
strong_ellipticity=None disables extra rank-one curvature checks;
reference_stability=False disables the reference tangent PSD check.
These switches affect search admission and final Rust acceptance, not
Python's independent post-search audits.
StrongEllipticityCheck¶
StrongEllipticityCheck(step=0.04) uses 0.005 ≤ step ≤ 0.15 for numerical rank-one curvature probes. The step is not a deformation range. reference_stability instead uses a separate, fixed internal Hessian step. See physical interpretation.
rend.config.StrongEllipticityCheck
dataclass
¶
Optional Rust sampled Legendre–Hadamard curvature test.
step is the dimensionless central-difference perturbation (not a
deformation range). Tested in Rust during candidate admission and before
returning final equations; no global stability proof is implied.
step: float = 0.04
class-attribute
instance-attribute
¶
Phase 3: optional post-search verification¶
PostSearchChecks¶
PostSearchChecks(constitutive=None, fe=None) never changes the accepted Rust Pareto front. None disables only the corresponding optional group. Float64 audit and applicability scan remain mandatory.
rend.api.PostSearchChecks
dataclass
¶
Optional post-Rust verification only (mandatory float64 and applicability scan remain).
Set constitutive to a ConstitutiveChecks object and/or fe to
FEChecks. None skips the optional group. There are no implicit FEM
or constitutive checks.
ConstitutiveChecks and verifier¶
ConstitutiveChecks(stress=True, tangent=True, objectivity=True, stress_covariance=True, material_symmetry=True, reference=True, domain=True, relative_tolerance=0.02, absolute_tolerance=1e-5, step=2e-4, max_states=18). Individual results contain passed (True/False/None), detail, max_error and samples. For arbitrary multi-axis anisotropy, symmetry may be None when no nontrivial symmetry can be deduced. This does not count as a pass. State sampling is balanced across enabled families.
rend.constitutive.ConstitutiveChecks
dataclass
¶
Optional independent post-search checks; all checks can be disabled separately.
Error tolerances apply to the numerical comparisons below. The stress/tangent checks compare complex-step derivatives against numerical stencils where supported; they do NOT assert agreement with the Rust AD engine.
stress: bool = True
class-attribute
instance-attribute
¶
tangent: bool = True
class-attribute
instance-attribute
¶
objectivity: bool = True
class-attribute
instance-attribute
¶
stress_covariance: bool = True
class-attribute
instance-attribute
¶
material_symmetry: bool = True
class-attribute
instance-attribute
¶
reference: bool = True
class-attribute
instance-attribute
¶
domain: bool = True
class-attribute
instance-attribute
¶
relative_tolerance: float = 0.02
class-attribute
instance-attribute
¶
absolute_tolerance: float = 1e-05
class-attribute
instance-attribute
¶
step: float = 0.0002
class-attribute
instance-attribute
¶
max_states: int = 18
class-attribute
instance-attribute
¶
rend.constitutive.ConstitutiveVerifier
¶
Numerical material-point checks for all five Rend material profiles.
The incompressible stress is the derivative of the supplied extension of W; hydrostatic pressure is not determined by W and is NOT checked here.
verify(model)
¶
FEChecks¶
FEChecks(kinematic=True, robustness=True, benchmark=False, convergence=False). At least one stage must be enabled if an instance is supplied. PostSearchChecks(fe=None) disables the entire optional FEM stage. See numerical FE details.
rend.config.FEChecks
dataclass
¶
Choose which optional finite-element smoke tests to run.
FEM tests run after Rust discovery and independent Python float64 checking. A successful solve indicates numerical completion of the selected scenarios only. It is not a mesh-convergence study, a global stability proof, or industrial material qualification. The supported FE loading families are uniaxial, biaxial and shear; disabled or trivial loading intervals may cause a check to be skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kinematic
|
bool
|
Run loading-case simulations; default |
True
|
robustness
|
bool
|
Repeat a representative case with different FE meshes and
increment counts; default |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
All four switches are |
Input profiles, ranges and weights¶
DeformationRange(min, max) defines inclusive numerical limits. ValidationRanges stores uniaxial, biaxial, planar, shear and optional volumetric, and exposes validate(profile), values() and as_rust() for inspection/serialization. The planar interval controls representative stretch-ratio probes in tension and compression. See where these shared ranges apply.
EdgeWeighting explicitly enables head/tail emphasis, with defaults head_fraction=0.05, head_multiplier=5, tail_fraction=0.05, tail_multiplier=5. Both edge_weighting and group_weighting default to None at the constructor. GroupWeighting supports mode_weights, tag_weights and mutually exclusive balance_tags.
rend.config.MaterialProfile
¶
Bases: str, Enum
Select the material symmetry and compressibility preset.
A profile fixes the constitutive family, whether volumetric deformation is supported, and the initial Rust W-operator set. The Python interface infers compressibility from the selected enum member; do not provide it separately.
Attributes:
| Name | Type | Description |
|---|---|---|
INCOMPRESSIBLE_ISOTROPIC |
Isotropic, volume-preserving material without preferred directions. |
|
INCOMPRESSIBLE_ANISOTROPIC |
Volume-preserving material with explicit fiber directions and ordinary anisotropic invariants. |
|
INCOMPRESSIBLE_ANISOTROPIC_DISPERSIVE |
Volume-preserving anisotropic
material with dispersed fiber operators. Use |
|
COMPRESSIBLE_ISOTROPIC |
Isotropic material permitting volume changes. |
|
COMPRESSIBLE_CUBIC |
Compressible material with three mutually perpendicular material axes (cubic symmetry). |
Examples:
>>> profile = MaterialProfile.INCOMPRESSIBLE_ISOTROPIC
>>> profile.compressible
False
INCOMPRESSIBLE_ISOTROPIC = 'incompressible_isotropic'
class-attribute
instance-attribute
¶
INCOMPRESSIBLE_ANISOTROPIC = 'incompressible_anisotropic'
class-attribute
instance-attribute
¶
INCOMPRESSIBLE_ANISOTROPIC_DISPERSIVE = 'incompressible_anisotropic_dispersive'
class-attribute
instance-attribute
¶
COMPRESSIBLE_ISOTROPIC = 'compressible_isotropic'
class-attribute
instance-attribute
¶
COMPRESSIBLE_CUBIC = 'compressible_cubic'
class-attribute
instance-attribute
¶
compressible: bool
property
¶
Whether this profile permits changes in material volume.
Returns:
| Type | Description |
|---|---|
bool
|
|
anisotropic: bool
property
¶
Whether the profile uses explicitly supplied material directions.
Returns:
| Type | Description |
|---|---|
bool
|
|
rend.config.StressUnit
¶
Bases: str, Enum
Specify the physical units of measured stress and reported response.
Values in the CSV must already use the selected unit. Rend does not convert, rescale or reinterpret the stress columns when this is changed.
Attributes:
| Name | Type | Description |
|---|---|---|
PA |
Pascals (Pa). |
|
KPA |
Kilopascals (kPa). |
|
MPA |
Megapascals (MPa). |
rend.config.DeformationRange
dataclass
¶
Inclusive deformation interval for one validation loading family.
Use stretch ratios for uniaxial, biaxial, planar and volumetric loading;
use the dimensionless engineering shear parameter for the shear family.
A degenerate interval (same minimum and maximum) is permitted. The class
only validates ordering and finiteness; physical positivity for a specific
mode is checked by ValidationRanges.validate().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min
|
float
|
Lower bound, inclusive. Non-shear stretch ranges must be positive. |
required |
max
|
float
|
Upper bound, inclusive; must not be smaller than |
required |
Examples:
>>> DeformationRange(1.0, 1.5)
DeformationRange(min=1.0, max=1.5)
rend.config.ValidationRanges
dataclass
¶
Configure the deformation families probed by physical validation.
Supply exactly one interval or None for each loading family. None
skips the corresponding deformation probes. Undeformed reference-state
checks remain enabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uniaxial
|
DeformationRange | None
|
Stretch-ratio interval for uniaxial states or |
required |
biaxial
|
DeformationRange | None
|
Stretch-ratio interval for biaxial states or |
required |
planar
|
DeformationRange | None
|
Stretch-ratio interval for representative planar tension and compression states or |
required |
shear
|
DeformationRange | None
|
Engineering shear interval (negative values permitted), or |
required |
volumetric
|
DeformationRange | None
|
Volume-related stretch interval for compressible profiles;
|
None
|
Examples:
>>> ranges = ValidationRanges(
... uniaxial=DeformationRange(1.0, 2.0),
... biaxial=None, planar=None,
... shear=DeformationRange(0.0, 0.5),
... )
validate(profile: MaterialProfile) -> None
¶
Check that the ranges are compatible with a material profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile
|
MaterialProfile
|
Profile used to determine whether volumetric tests are allowed. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
Volumetric loading is requested for an incompressible profile, or a stretch range includes nonpositive values. |
values() -> dict[str, DeformationRange | None]
¶
Return every named loading family, including disabled entries.
Returns:
| Type | Description |
|---|---|
dict[str, DeformationRange | None]
|
A mapping from mode names to intervals or |
dict[str, DeformationRange | None]
|
both enabled and disabled validation families. |
as_rust() -> tuple[dict, list[str]]
¶
Serialize enabled intervals and disabled families for the Rust adapter.
Returns:
| Type | Description |
|---|---|
dict
|
A pair |
list[str]
|
families occur in |
tuple[dict, list[str]]
|
separately so the Rust validator does not silently apply defaults. |
rend.config.EdgeWeighting
dataclass
¶
Emphasize the beginning and end of each measured curve.
This optional weighting layer is disabled by default in MaterialRegressor.
Constructing EdgeWeighting() explicitly enables its head/tail treatment. Fractions describe the share of observations at each
end of every (TestType, Tag) curve, in input order. Multipliers apply
to those observations. Overlapping end regions compound multiplicatively;
the second weighting layer is applied using GroupWeighting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
head_fraction
|
float
|
Fraction of samples at the beginning; from 0 to 1. Default: 0.05 (the first 5%). |
0.05
|
head_multiplier
|
float
|
Nonnegative multiplier for the beginning, default 5. |
5.0
|
tail_fraction
|
float
|
Fraction of samples at the end; from 0 to 1. Default: 0.05 (the last 5%). |
0.05
|
tail_multiplier
|
float
|
Nonnegative multiplier for the end, default 5. |
5.0
|
Examples:
>>> EdgeWeighting(head_fraction=0.1, head_multiplier=3.0)
EdgeWeighting(head_fraction=0.1, head_multiplier=3.0, tail_fraction=0.05, tail_multiplier=5.0)
rend.config.GroupWeighting
dataclass
¶
Adjust the relative importance of loading families or measurement tags.
This optional grouping layer multiplies any explicitly enabled
EdgeWeighting mask. For explicit weights, a row's multiplier is
mode_weights[mode] * tag_weights[tag], with the (mode, tag) key
taking priority over a plain tag key. Missing keys imply a multiplier of 1.
Nonexistent tag keys are rejected when data are loaded.
Alternatively, balance_tags=True computes normalized per-row weights
inversely proportional to the group sample count and the squared measured
stress range. A small range floor prevents singular factors. This reduces
the tendency of high-amplitude curves to dominate a multi-tag fit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode_weights
|
Mapping[str, float]
|
Nonnegative multipliers keyed by |
dict()
|
tag_weights
|
Mapping[str | tuple[str, str], float]
|
Nonnegative multipliers keyed by the CSV tag text or an
explicit |
dict()
|
balance_tags
|
bool
|
Equalize each group's influence instead of supplying
explicit mode/tag multipliers. Defaults to |
False
|
Examples:
>>> GroupWeighting(mode_weights={"biaxial": 2.0},
... tag_weights={("shear", "fs"): 0.5})
GroupWeighting(mode_weights={'biaxial': 2.0}, tag_weights={('shear', 'fs'): 0.5}, balance_tags=False)
>>> GroupWeighting(balance_tags=True)
GroupWeighting(mode_weights={}, tag_weights={}, balance_tags=True)
Advanced search configuration¶
SearchConfig controls evolution/optimization budgets, subsets and operator presets through MaterialRegressor.advanced(search=...). resolve_operators(profile) yields the effective preset after additions and exclusions (exclusion takes precedence). The typed Operator enum and exact definitions are listed in the operator guide.
rend.config.SearchConfig
dataclass
¶
Override the evolutionary search's built-in Rust W preset.
All fields have defaults matching the existing W-search configuration.
This object is only used by MaterialRegressor.advanced(); the normal
constructor uses profile defaults. Custom operators modify the profile's
preset instead of replacing it: (preset + additions) - exclusions.
Exclusions always win, even if the same operator is also added.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parsimony_penalty
|
float
|
Nonnegative expression-size regularization factor,
scaled by the variance of target stress values in Rust.
Default |
5e-06
|
island_size
|
int
|
Number of evolving individuals in each island; 8–100000.
Default |
1000
|
num_islands
|
int
|
Number of parallel evolutionary islands, 1–256;
default |
16
|
max_tree_size
|
int
|
Maximum allowable expression-tree size; 5–256,
default |
64
|
mutation_max_depth
|
int
|
Limit for generated mutation subtree depth, 1–12
and no greater than |
6
|
stagnation_threshold
|
int
|
Number of generations without improvement used
in diversification/stagnation handling; 1–1000000, default |
200
|
tournament_size
|
int
|
Number of individuals sampled for tournament
selection; 2–64 and at most |
3
|
opt_iterations
|
int
|
Maximum iterations of L-BFGS during evolutionary
search, 1–100000; default |
24
|
opt_prob
|
float
|
Probability of applying evolutionary L-BFGS, between 0 and
1 inclusive; default |
0.05
|
subset_size
|
int | None
|
Sample count of the working training subset; |
256
|
mini_batch_size
|
int
|
Mini-batch size for fitting/evaluation; at least 8,
at most 10000000, divisible by 8; default |
32
|
add_operators
|
tuple[Operator, ...]
|
Tuple of |
()
|
exclude_operators
|
tuple[Operator, ...]
|
Tuple of |
()
|
Examples:
>>> config = SearchConfig(
... num_islands=8, subset_size=512,
... add_operators=(Operator.I4,),
... exclude_operators=(Operator.DIVIDE,),
... )
>>> Operator.DIVIDE in config.resolve_operators(MaterialProfile.INCOMPRESSIBLE_ISOTROPIC)
False
Note
The configured sizes are validated before search. A subset or mini- batch larger than the CSV row count additionally produces a warning when the dataset is read.
resolve_operators(profile: MaterialProfile) -> tuple[Operator, ...]
¶
Compute the final instruction set for a chosen material profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile
|
MaterialProfile
|
Material profile defining the initial W-preset instructions. |
required |
Returns:
| Type | Description |
|---|---|
Operator
|
A de-duplicated tuple in preset/addition order, excluding everything |
...
|
listed in |
tuple[Operator, ...]
|
preset or the configuration object. |
Examples:
>>> cfg = SearchConfig(add_operators=(Operator.I4,),
... exclude_operators=(Operator.DIVIDE, Operator.I4))
>>> Operator.I4 in cfg.resolve_operators(MaterialProfile.INCOMPRESSIBLE_ISOTROPIC)
False
rend.config.Operator
¶
Bases: str, Enum
Available typed instructions for customizing a W-search operator set.
Operators are instructions, not arbitrary Python functions. A search starts
with the selected profile's built-in W preset, then applies additions and
exclusions using SearchConfig. Exclusions take precedence.
See the Operator reference page for exact LaTeX definitions and the full
instruction list of each profile.
Attributes:
| Name | Type | Description |
|---|---|---|
ADD |
Scalar addition, |
|
SUBTRACT |
Scalar subtraction, |
|
MULTIPLY |
Scalar multiplication, |
|
DIVIDE |
Scalar division, |
|
SQUARE |
Scalar square, |
|
CUBE |
Scalar cube, |
|
EXP |
Scalar exponential, |
|
LOG |
Natural logarithm, |
|
SQRT |
Square root, |
|
RIGHT_CAUCHY_GREEN |
Construct the right Cauchy-Green tensor |
|
ISOCHORIC_I1 |
First isochoric invariant with the reference value subtracted. |
|
ISOCHORIC_I2 |
Second isochoric invariant with the reference value subtracted. |
|
DEVIATORIC_J2 |
Second invariant of a matrix's deviatoric part. |
|
DEVIATORIC_J3 |
Determinant of a matrix's deviatoric part. |
|
I1 |
First invariant of |
|
I2 |
Second invariant of |
|
J |
Volume ratio derived from |
|
I4 |
Reference-shifted fourth invariant along a material fiber. |
|
I5 |
Reference-shifted fifth invariant along a material fiber. |
|
ACTIVE_I4 |
Smoothly activated fourth fiber invariant. |
|
DISPERSED_I4 |
Dispersion-adjusted fourth fiber invariant. |
|
DISPERSED_I5 |
Dispersion-adjusted fifth fiber invariant. |
|
I8 |
Reference-shifted coupling invariant for two fibers. |
|
SOFTPLUS |
Symmetric smooth maximum, log(exp(20a) + exp(20b)) / 20. |
|
CUBIC_J7 |
Seventh cubic-symmetry invariant, shifted at identity. |
|
CUBIC_J8 |
Eighth cubic-symmetry invariant, shifted at identity. |
|
CUBIC_J9 |
Ninth cubic-symmetry invariant, shifted at identity. |
Examples:
>>> config = SearchConfig(exclude_operators=(Operator.DIVIDE, Operator.LOG))
>>> Operator.DIVIDE not in config.resolve_operators(MaterialProfile.INCOMPRESSIBLE_ISOTROPIC)
True
ADD = 'Basic:AddF'
class-attribute
instance-attribute
¶
SUBTRACT = 'Basic:SubF'
class-attribute
instance-attribute
¶
MULTIPLY = 'Basic:MulF'
class-attribute
instance-attribute
¶
DIVIDE = 'Basic:DivF'
class-attribute
instance-attribute
¶
SQUARE = 'Basic:SqrF'
class-attribute
instance-attribute
¶
CUBE = 'Basic:CubeF'
class-attribute
instance-attribute
¶
EXP = 'Basic:ExpF'
class-attribute
instance-attribute
¶
LOG = 'Basic:LnF'
class-attribute
instance-attribute
¶
SQRT = 'Basic:SqrtF'
class-attribute
instance-attribute
¶
RIGHT_CAUCHY_GREEN = 'Solid:RightCauchyGreenM3'
class-attribute
instance-attribute
¶
ISOCHORIC_I1 = 'Solid:IsochoricInvariant1'
class-attribute
instance-attribute
¶
ISOCHORIC_I2 = 'Solid:IsochoricInvariant2'
class-attribute
instance-attribute
¶
DEVIATORIC_J2 = 'Solid:InvariantJ2M3'
class-attribute
instance-attribute
¶
DEVIATORIC_J3 = 'Solid:InvariantJ3M3'
class-attribute
instance-attribute
¶
I1 = 'Solid:InvariantI1'
class-attribute
instance-attribute
¶
I2 = 'Solid:Invariant2M3'
class-attribute
instance-attribute
¶
J = 'Solid:InvariantJ'
class-attribute
instance-attribute
¶
I4 = 'Solid:InvariantI4'
class-attribute
instance-attribute
¶
I5 = 'Solid:InvariantI5'
class-attribute
instance-attribute
¶
ACTIVE_I4 = 'Solid:InvariantI4Active'
class-attribute
instance-attribute
¶
DISPERSED_I4 = 'Solid:DispersedI4'
class-attribute
instance-attribute
¶
I8 = 'Solid:InvariantI8'
class-attribute
instance-attribute
¶
DISPERSED_I5 = 'Solid:DispersedI5'
class-attribute
instance-attribute
¶
SOFTPLUS = 'Solid:SoftplusF'
class-attribute
instance-attribute
¶
CUBIC_J7 = 'Solid:InvariantJ7'
class-attribute
instance-attribute
¶
CUBIC_J8 = 'Solid:InvariantJ8'
class-attribute
instance-attribute
¶
CUBIC_J9 = 'Solid:InvariantJ9'
class-attribute
instance-attribute
¶
Results and export¶
DiscoveryResult preserves returned models even if Python checks fail. rejected_models lists final Rust validator rejections.
DiscoveryResult attribute |
Meaning |
|---|---|
models |
Tuple of reported MaterialModel objects, sorted by full-dataset weighted MSE. |
report_path |
Path \| None: output HTML path, if generated. |
elapsed_seconds |
Measured wall-clock runtime. |
error |
None or a captured orchestration error. Check before using results. |
cancelled |
True on interruption. The result has no report or execution error. |
rejected_models |
Final Rust validation rejections with reasons (not all quick-search penalties). |
MaterialModel member |
Meaning |
|---|---|
as_string, as_latex |
Raw symbolic equation and formatted LaTeX when available. |
get_numpy_function() |
Numerical strain-energy evaluator with X0_Mat3=F and referenced material-direction vectors when needed, or None when unsupported. |
get_jax_function() |
Differentiable JAX evaluator when supported. |
mse, complexity |
Full-dataset weighted clear_mse over the Rust nominal stress targets in stress units squared, and expression complexity. Fit metrics. |
audit_status, audit_reason |
Mandatory Python float64 status and explanation. |
constitutive_checks |
Per-check optional independent numerical results or empty when not run. |
fe_kinematic_status, fe_robustness_status, fe_benchmark_status, fe_convergence_status |
Independent FEM outcomes (None if not performed). |
fe_convergence_metrics |
Mesh and increment comparison details when the comparison was reached. Read the corresponding fe_*_reason fields for messages on individual FEM checks. |
validity_domain |
Sampled applicability intervals and failure brackets. |
json_path, solver_path, calculix_umat_path |
Paths to generated JSON, Abaqus UHYPER and CalculiX ABAQUSNL exports. |
write_material_json(model, destination, **kwargs) takes profile, optional material_directions, stress_unit and original_ranges for rend.material.v4 exports. write_abaqus_uhyper(model, target, *, profile) and write_calculix_umat(model, destination, *, profile) return the generated source path. To export from a saved JSON, use rend.json_interchange.export_solver_from_json(path, directory, backend=...) with abaqus_uhyper, calculix_umat or the default standalone_fortran.
rend.api.DiscoveryResult
dataclass
¶
Result of a single material-discovery run.
The Pareto front is preserved even when a post-search Python or FEM
check fails. A check's None status indicates not executed, not
rejected. Rust-rejected candidates never appear in this result. The
result is immutable, but returned MaterialModel objects contain their
individual diagnostic fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
models
|
tuple[MaterialModel, ...]
|
All Pareto models returned by Rust and parsed in Python, including failed or untested post-search checks. Empty on errors. |
required |
report_path
|
Path | None
|
Path to the generated HTML report, or |
required |
elapsed_seconds
|
float
|
Wall-clock duration of the complete run, in seconds. |
required |
error
|
str | None
|
A captured orchestration error as readable text, or |
None
|
cancelled
|
bool
|
True when the run was interrupted. In this case the result has no models, report path or execution error. |
False
|
Examples:
>>> # result = regressor.run()
>>> # if result.error is None:
>>> # print(result.report_path, len(result.models))
models: tuple[MaterialModel, ...]
instance-attribute
¶
report_path: Path | None
instance-attribute
¶
elapsed_seconds: float
instance-attribute
¶
error: str | None = None
class-attribute
instance-attribute
¶
rejected_models: tuple[dict, ...] = ()
class-attribute
instance-attribute
¶
cancelled: bool = False
class-attribute
instance-attribute
¶
rend.model.MaterialModel
¶
A single symbolic strain-energy candidate returned by discovery.
Each instance stores the Rust-exported equation, its expression complexity and MSE, and a symbolic representation used by downstream plotting, float64 checks and FEM evaluation. A model may be present even if it fails post-search validation; inspect each check's status explicitly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_equation
|
str
|
Equation string emitted by Rust. A leading |
required |
complexity
|
int
|
Expression-complexity score used on the Pareto front. |
required |
mse
|
float
|
Model's dimensional, post-search clear MSE in the input
stress units squared. Not the variance-scaled |
required |
latex_str
|
str
|
Optional LaTeX representation supplied by Rust. |
''
|
model_type
|
str
|
Symbolic model family identifier, default |
'W'
|
Attributes:
| Name | Type | Description |
|---|---|---|
complexity |
Pareto-complexity score (smaller is simpler). |
|
mse |
Dimensional mean squared error (smaller is a better fit). |
|
latex |
Original LaTeX text received from Rust. |
|
model_type |
Uppercase model-family designation. |
|
passed_validation |
Legacy aggregate FEM status: |
|
failure_reason |
Legacy human-readable FEM failure explanation. |
|
audit_status |
Independent Python float64 status ( |
|
audit_reason |
Details of the float64 audit; empty if unavailable. |
|
numerical_warnings |
Unique runtime diagnostics from checks and report evaluation. |
|
fe_kinematic_status |
Kinematic FE test outcome, or |
|
fe_kinematic_reason |
Explanation of a kinematic check failure. |
|
fe_robustness_status |
Robustness FE test outcome, or |
|
fe_robustness_reason |
Explanation of a robustness check failure. |
Note
These objects are mutable and may acquire validation results after construction.
as_string: str
property
¶
Return the exact equation text exported by the Rust engine.
Returns:
| Type | Description |
|---|---|
str
|
The unmodified raw equation, including any prefix such as |
as_latex: str
property
¶
Provide a symbolic LaTeX representation of the equation.
Returns:
| Type | Description |
|---|---|
str
|
A string starting with |
str
|
otherwise the raw equation string. For the original Rust LaTeX text, |
str
|
read the separate |
get_numpy_function()
¶
Build a callable evaluator for the symbolic strain-energy expression.
The returned function accepts keyword arguments named after the free
symbols in the Rust expression. X0_Mat3 is the deformation-gradient
input; directional arguments such as X1_Vec3 represent supplied fibers
when referenced by the formula. Unused keyword arguments are ignored.
NumPy/JAX operations are used to preserve differentiation compatibility.
Numeric evaluation can fail for invalid logarithms, singular matrices or nonfinite intermediate values.
Returns:
| Type | Description |
|---|---|
Callable | None
|
Keyword-based energy evaluator for a parsed
expression, or |
Examples:
>>> # evaluate = model.get_numpy_function()
>>> # if evaluate is not None:
>>> # energy = evaluate(X0_Mat3=np.eye(3))
get_jax_function()
¶
Differentiable W(F, **directions) evaluator with JAX float64 arrays.
rend.material_export.write_material_json(model, destination, **kwargs)
¶
rend.solver_integration.uhyper.write_abaqus_uhyper(model, target, *, profile)
¶
rend.solver_integration.calculix.abaqusnl.write_calculix_umat(model, destination, *, profile)
¶
Write the Fortran source to compile and load through ABAQUSNL.