Skip to content

Beams2D not detecting all constraint violations #118

@arthurdrake1

Description

@arthurdrake1

At the moment, the constraint check for beams2d appears to only detect violations for rmin. Here's the code to reproduce this issue in v0.py:

if __name__ == "__main__":

    from engibench.problems.beams2d.v0 import Beams2D

    problem = Beams2D()

    dataset = problem.dataset

    params_train = dataset["train"].select_columns(problem.conditions_keys)

    design, idx = problem.random_design()

    config = params_train[idx]

    ############################################################
    # Example of three violating configs
    # Expected behavior: 3 violated constraints
    # Actual behavior: only rmin is violated
    print("Original configs:", config)
    new_cfg = {"volfrac": -1.0, "rmin": -1.0, "forcedist": -1.0}
    config.update(new_cfg)
    print("New configs:", config)
    ############################################################

    violated_constraints = problem.check_constraints(design, config)

    print("Violated constraints:", violated_constraints)

Current output on my system:

Original configs: {'volfrac': 0.225, 'rmin': 1.5, 'forcedist': 0.45, 'overhang_constraint': 0}
New configs: {'volfrac': -1.0, 'rmin': -1.0, 'forcedist': -1.0, 'overhang_constraint': 0}
Violated constraints: rmin_bound: Params.rmin: -1.0 ∉ (0, max(nelx, nely)]

Let me know if you are able to reproduce this. Thanks!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions