# C++ Reference: class CpModelPresolver

This documentation is automatically generated.

Presolves the initial content of presolved_model.This also creates a mapping model that encode the correspondence between the two problems. This works as follow:

- The first variables of mapping_model are in one to one correspondence with the variables of the initial model.

- The presolved_model variables are in one to one correspondence with the variable at the indices given by postsolve_mapping in the mapping model.

- Fixing one of the two sets of variables and solving the model will assign the other set to a feasible solution of the other problem. Moreover, the objective value of these solutions will be the same. Note that solving such problems will take little time in practice because the propagation will basically do all the work.

Note(user): an optimization model can be transformed into a decision problem, if for instance the objective is fixed, or independent from the rest of the problem.

TODO(user): Identify disconnected components and returns a vector of presolved model? If we go this route, it may be nicer to store the indices inside the model. We can add a IntegerVariableProto::initial_index;

Method | |
---|---|

`CpModelPresolver` | Arguments: |

`Presolve` | Return type: Returns false if a non-recoverable error was encountered. TODO(user): Make sure this can never run into this case provided that the initial model is valid! |

`PresolveOneConstraint` | Return type: Arguments: Executes presolve method for the given constraint. Public for testing only. |

`SyncDomainAndRemoveEmptyConstraints` | Return type: Public for testing only. |