What is a good algorithm for solving complex configuration and parameterization problems?

The application I am working on requires complex parameterization and configuration to model custom parts. There are various interdependencies between different parameters, for example, this parameter of parameter β€œA” invalidates certain values ​​for β€œB” and β€œC” or adds additional restrictions to the values ​​of parameter β€œD”.

Currently, this is being solved by storing all the parameters in the lookup tables and executing the rules on them. Rules are written manually in XML, loaded and converted to some intermediate format, which is used for the rule engine. Each time a parameter changes, all the rules are repeated.

It is at the same time very slow and error prone.

I believe that it would be useful to use the DAG-based approach, where we can only do updates on subsets of the graph.

Is that a good idea? Do you know any better approaches? If you have experience with similar problems, how do you solve them?

Edit: I am trying to create a construct in which only changes to dependent subsets of a parameter should be changed when changing. Currently, the rules are repeated globally with every change. Parameters are set by default, but can be changed by the user. Depending on the parameter value, the default values ​​for others may differ.

+4
source share
1 answer

Is that a good idea?

Yes. You can create a DAG and bypass the DFS and figure out the chain of dependencies.

Do you know any better approaches? If you have experience with similar problems, how do you solve them?

From what I understand, there is a complex dependency structure that can be modeled by DAG. If any of them changes, you need to change the dependent components. Compilers have been doing this for many years. You might want to study the dependency analysis performed by them.

Another approach could be simulated by an observer pattern . Here, each object provides a way to notify observers if something has changed. Dependent objects subscribe to notifications. When an event occurs that changes the state of an object, it calls dependent listeners.

+1
source

All Articles