Most Powerful Open Source ERP

How To Create Automatic Target Solvers

showing how to configure both target solvers and divergence testers to invoke automatically.
  • Last Update:2016-02-11
  • Version:001
  • Language:en

Each time we get a divergence by a divergence tester, automatic solvers will be invoked in delivery_causality_workflow. To use this feature, you need to configure both target solvers and divergence testers.

Table of Contents

Create a target solver portal type

Target Solver portal types should be created under portal_solvers, not portal_types.

  • Go to portal_solvers and create a target solver portal type.
  • Go to the 'View' tab, choose 'target_solver' in the 'Groups' selection field.
  • Go to the 'Solver Configuration' tab, check the 'Automatic Solver' checkbox, and configure other properties.
  • Go to the 'Predicate' tab and configure when this solver can be used ('context' for the predicate is a simulation movement that has a divergence).

And add it in Solver Process portal_type's allowed content types.

  • Go to portal_types/Solver Process.
  • Add the target solver portal type in the 'Allowed Content Types' field.

Then add 'solver_workflow' in the solver portal type's workflow chain.

  • Go to portal_workflow/manage_selectWorkflows.
  • Add 'solver_workflow' in the workflow chain of the solver portal type.

Configure divergence testers

In each divergence testers where you want to use the automatic target solver that you just created, you need to register the target solver.

  • Select the automatic target solver that you want to use for this divergence tester in the 'Solvers' selection field.

Please note that each divergence tester should be atomic, i.e. if we want to solve several properties at a single step (eg. quantity and quantity_unit), we should use a single target solver and thus we should handle there divergences with a single divergence tester. On the other hand, if you might want to solve differently for several properties, divergence testers should be separated per a target solver.

Configure default parameters for the target solver (optional)

If you want to pass some parameters to the target solver, you can create a script that returns a dict of parameters, and specify it in the target solver portal type ('Default Configuration Property Dict Method' field). You can get these parameters by calling target_solver.getConfigurationPropertyDict() in your target solver class implementation.

Configure a delivery solver for the target solver (optional)

If you want to use a delivery solver to modify the quantity of simulation movements, you can create a delivery solver portal type. To specify which delivery solver should be used in the automatic target solver, you need to include 'delivery_solver':'XXX Delivery Solver' in the default parameters described above.

Examples

You can see working examples in TestAutomaticSolvingPackingList class in ERP5/tests/testPackingList.py.

Related Articles