> Advanced Programming Techniques > Advanced Presolve Routines > Modifying a Problem

This section briefly discusses the mechanics of modifying a problem after presolve has been performed. This discussion applies only to linear programs; it does not apply to quadratic programs, quadratically constrained programs, nor mixed integer programs.

As noted earlier, the user must indicate through the CPX_PARAM_REDUCE parameter the types of modifications that are going to be performed to the problem. Recall that if primal reductions are turned off, the user can add variables, change the right-hand-side vector, or loosen variable bounds without losing the presolved problem. These changes are made through the standard problem modification interface (CPXaddcols, CPXchgrhs, and CPXchgbds).

Recall that if dual reductions are turned off, the user can add constraints to the problem, change the objective function, or tighten variable bounds. Variable bounds are tightened through the standard interface (CPXchgbds). The addition of constraints or changes to the objective value must be done through the two interface routines CPXpreaddrows and CPXprechgobj. We should note that the constraints added by CPXpreaddrows are equivalent to but sometimes different from those input by the user. The dual variables associated with the added rows may take different values than those the user might expect.

If a user makes a problem modification that is not consistent with the setting of CPX_PARAM_REDUCE, the presolved problem is discarded and presolve is reinvoked at the next optimization call. Similarly, CPLEX discards the presolved problem if the user modifies a variable or constraint that presolve had previously removed from the problem. You can use CPXpreaddrows or CPXprechgobj to make sure that this will not happen. Note that CPXpreaddrows also permits changes to the bounds of the presolved problem. If the nature of the procedure dictates a real need to modify the variables that presolve removed, you can use the CPXcopyprotected routine to instruct CPLEX not to remove those variables from the problem.

Instead of changing the bounds on the presolved problem, consider changing the bounds on the original problem. CPLEX will discard the presolved problem, but calling CPXpresolve will cause CPLEX to apply presolve to the modified problem, with the added benefit of reductions based on the latest problem modifications. Then use CPXcrushx, CPXcrushpi, and CPXcopystart to provide an advanced start for the problem after presolve has been applied on the modified problem.