ILOG CPLEX 11.0 Getting Started > Tutorials > Interactive Optimizer Tutorial > Changing a Problem > Deleting Entire Constraints or Variables

Another option to the change command is delete. This option is used to remove an entire constraint or a variable from a problem. Return the problem to its original form by removing the constraint you added earlier. Type:

change delete 

ILOG CPLEX displays a list of delete options.

Delete options:

constraints      delete range of constraints
qconstraints     delete range of quadratic constraints
indconstraints   delete range of indicator constraints
soss             delete range of special ordered sets
variables        delete range of variables
filters          delete range of filters
solutions        delete range of solutions from the pool
equality         delete range of equality constraints
greater-than     delete range of greater-than constraints
less-than        delete range of less-than constraints

Deletion to make:

At the first prompt, specify that you want to delete a constraint.

 Deletion to make: constraints 

At the next prompt, enter a constraint name or number, or a range as you did when you used the display command. Since the constraint to be deleted is named new3, enter that name:

Delete which constraint(s): new3 
Constraint 3 deleted.

Check to be sure that the correct range or number is specified when you perform this operation, since constraints are permanently removed from the problem. Indices of any constraints that appeared after a deleted constraint will be decremented to reflect the removal of that constraint.

The last message indicates that the operation is complete. The problem can now be checked to see if it has been changed back to its original form.

display problem all 

Maximize
 obj:  x1 + 2 x2 + 3 x3
Subject To
 c1: - x1 +   x2 +   x3 <= 20
 c2:   x1 - 3 x2 +   x3 <= 30
Bounds
 0 <= x1 <= 40
All other variables are >= 0.

When you remove a constraint with the delete option, that constraint no longer exists in memory; however, variables that appear in the deleted constraint are not removed from memory. If a variable from the deleted constraint appears in the objective function, it may still influence the solution process. If that is not what you want, these variables can be explicitly removed using the delete option.