You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As it is put in some of the code comments, constraints are a bit "hacked together" at the moment. :)
Constraints should probably be set apart as their own class, instead of being a subclass of Model. I can see it was done initially for the sympy parsing and plug in, but models have much more functionality and metadata that constraints don't need or need differently. Maybe there just needs to be more overridden functions. I haven't taken a very close look at it, so it's hard to say right now what is the best course of action.
Also, current implementation does not really support constraints that involve non-numeric quantities/symbols. For example, if a model only applies to non-magnetic materials, we should have a constraint magnetic_order == "NM". At present, sympy can kind of figure this out, but not really. A thought would be to generate lambda functions for these kinds of expressions or to use eval() and warn users to not import any YAML files from untrusted sources.
The text was updated successfully, but these errors were encountered:
Do you have any concrete examples of constraints that aren't independent (i.e. rectangular)? For example, not isMetal and resistivity > 1.0e-3 and refractive_index > 1.5 would be independent but resistivity * refractive_index > 1.5e-3 would not be.
As it is put in some of the code comments, constraints are a bit "hacked together" at the moment. :)
Constraints should probably be set apart as their own class, instead of being a subclass of Model. I can see it was done initially for the sympy parsing and plug in, but models have much more functionality and metadata that constraints don't need or need differently. Maybe there just needs to be more overridden functions. I haven't taken a very close look at it, so it's hard to say right now what is the best course of action.
Also, current implementation does not really support constraints that involve non-numeric quantities/symbols. For example, if a model only applies to non-magnetic materials, we should have a constraint
magnetic_order == "NM"
. At present,sympy
can kind of figure this out, but not really. A thought would be to generate lambda functions for these kinds of expressions or to useeval()
and warn users to not import any YAML files from untrusted sources.The text was updated successfully, but these errors were encountered: