Main > Reference Manual > Modeling > Solver
A solver represents modules of functionality that manipulate the model.
Examples are solvers to generate a plan, solvers to compute safety stocks, solvers to create production or purchase orders, etc...
Only one solver is included in the core library: solver_mrp, which uses a heuristic algorithm to generate plans.
Other solvers are implemented as optional modules.
For running a solver see the command command_solve.
Fields and methods
Field | Type | Description |
name | non-empty string |
Name of the solver. |
loglevel | 0 - 3 |
Amount of logging and debugging messages:
|
action | A C AC (default) R |
Type of action to be executed:
|
Method | Description |
solve() |
This method runs the solver algorithm. |
solver_mrp
Field | Type | Description |
plantype | unsignedShort | The type of plan being generated:
|
constraints | unsignedShort |
Sum up the values of the constraints you want to enable in the solver:
The default value is 15, ie all constraints are enabled. |
maxparallel | positive integer |
Specifies the number of parallel threads the solver creates during planning.
|
autocommit | boolean |
When true (which is the default) the plan changes are automatically committed after planning a demand. |
userexit_buffer | Python function | The Python function registered in this field as a callback function is called automatically when the solver is about to plan a buffer. The function is passed two arguments: the buffer being evaluated and a boolean that specifies whether the planning mode is constrained or not. The return value of the function is not used. |
userexit_demand | Python function | The Python function registered in this field as a callback function is called automatically when the solver is about to plan a demand. The function is passed two arguments: the demand being planned and a boolean that specifies whether the planning mode is constrained or not. The return value of the function is not used. This user exit enables users to plug in customized logic to adjust the planning parameters in the supply path, or to print debugging information. Note that changes to the due date, quantity or priority of the demand are possible, but such changes won't influence the sort order of the demand compared to other demands any more. |
userexit_flow | Python function | The Python function registered in this field as a callback function is called automatically when the solver evaluates alternate flows. The function is passed two arguments: the flowplan being evaluated and a boolean that specifies whether the planning mode is constrained or not. When the function returns True the alternate is acceptable. When it returns False the alternate is not acceptable. This user exit enables users to plug in customized logic to control complex configuration rules in the bill of material. |
userexit_operation | Python function | The Python function registered in this field as a callback function is called automatically when the solver is about to plan an operation. The function is passed two arguments: the operation being evaluated and a boolean that specifies whether the planning mode is constrained or not. The return value of the function is not used. |
userexit_resource | Python function | The Python function registered in this field as a callback function is called automatically when the solver is about to plan a resource. The function is passed two arguments: the resource being evaluated and a boolean that specifies whether the planning mode is constrained or not. The return value of the function is not used. |
Method | Description |
solve() solve([Demand]) |
Without arguments it recreates the complete plan. |
commit() |
Commits the changes to the plan. |
undo() |
Undo the changes to the plan. |
Example XML structures
- Adding or changing a solver
<plan> <solvers> <solver name="MRP" xsi-type="solver_mrp"> <constraints>7</constraints> <maxparallel>2</maxparallel> </solver> </solvers> </plan>
- Deleting a solver
<plan> <solvers> <solver name="MRP" action="R"/> </solvers> </plan>
Example Python code
- Adding or changing a solver, and running it
sol = frepple.solver_mrp(name="MRP", constraints=7, maxparallel=2) sol.solve()
- Deleting a solver
frepple.solver(name="MRP", action="R")