Access criteria lhs/rhs values per design
- Dominant language
- Python
- Stars
- 24
- Forks
- 5
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 12
Description
### 📝 Description of the feature
As an app developer, I want to access "lhs_value" and "rhs_value" of a criteria of an evaluated design, to show the criteria as "lhs_value <= rhs_value", instead of the internal value, similar to the "Results"-tab:
With `ansys-optislang-core==1.4.1` I can get only the evaluated constraint value of a design or the definition from the system:
``` python
import pathlib
from ansys.optislang.core import Optislang
from ansys.optislang.core.project_parametric import CriterionType
osl_project_file = pathlib.Path(r"path/to/project.opf")
with Optislang(project_path=osl_project_file) as osl:
sensitivity = osl.project.root_system.find_nodes_by_name("Sensitivity")[0]
for design in sensitivity.design_manager.get_designs():
for design_variable in design.constraints:
print(f"{design.id}, {design_variable.name}, {design_variable.value}, ({type(design_variable)})")
"""
0.4, constr_r1, -4.075192241505276, ()
0.3, constr_r1, -0.6835367115818881, ()
0.2, constr_r1, 0.1864137676161562, ()
0.5, constr_r1, 0.1295280305294036, ()
0.1, constr_r1, -5.969393475372262, ()
"""
for criterion in sensitivity.criteria_manager.get_criteria():
if criterion.type == CriterionType.CONSTRAINT:
print(f"{criterion.name} ({criterion.type}): {criterion.expression}, {criterion.expression_value},"
f" {criterion.limit_expression}, {criterion.limit_expression_value}")
"""
constr_r1 (CriterionType.CONSTRAINT): r1^2, 0.0, abs(r2), 0.0
"""
```
### 💡 Steps for implementing the feature
_No response_
### 🔗 Useful links and references
_No response_
Contributor guide
Research direction
Start with the project_parametric DesignVariable and CriterionType APIs, then trace sensitivity.design_manager.get_designs() and sensitivity.criteria_manager.get_criteria(). Compare the evaluated constraint value with criterion.expression_value and criterion.limit_expression_value. Done means an evaluated design criterion exposes its lhs_value and rhs_value so callers can display the criterion in the requested form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100