Redundant and non redundant constraints

When working with optimization problems, it is common to encounter redundant and non-redundant constraints. Redundant constraints are those that do not provide any additional information and can be removed without affecting the solution. On the other hand, non-redundant constraints are essential for defining the problem and finding an optimal solution.

Option 1: Manual removal of redundant constraints

In this approach, we manually identify and remove redundant constraints from the problem formulation. Let’s consider a simple example to illustrate this method:


using JuMP
using GLPK

# Create a model
model = Model(with_optimizer(GLPK.Optimizer))

# Define variables
@variable(model, x >= 0)
@variable(model, y >= 0)

# Define constraints
@constraint(model, 2x + y <= 10)
@constraint(model, x + y <= 5)
@constraint(model, x + y <= 7)  # Redundant constraint

# Define objective function
@objective(model, Max, 3x + 4y)

# Solve the optimization problem
optimize!(model)

# Print the optimal solution
println("Optimal solution:")
println("x = ", value(x))
println("y = ", value(y))

In this example, we have three constraints, but the third constraint (x + y <= 7) is redundant because it does not provide any additional information. We can remove this constraint from the problem formulation without affecting the optimal solution.

Option 2: Automatic removal of redundant constraints using the Reduced Row Echelon Form (RREF)

In this approach, we can use linear algebra techniques to automatically identify and remove redundant constraints. The RREF of a matrix can help us determine which constraints are redundant. Let's modify the previous example to demonstrate this method:


using JuMP
using GLPK
using LinearAlgebra

# Create a model
model = Model(with_optimizer(GLPK.Optimizer))

# Define variables
@variable(model, x >= 0)
@variable(model, y >= 0)

# Define constraints
@constraint(model, 2x + y <= 10)
@constraint(model, x + y <= 5)
@constraint(model, x + y <= 7)  # Redundant constraint

# Define objective function
@objective(model, Max, 3x + 4y)

# Solve the optimization problem
optimize!(model)

# Get the constraint matrix
A = JuMP.constraint_matrix(model)

# Compute the RREF of the constraint matrix
rref_A = rref(A)

# Identify redundant constraints
redundant_constraints = []
for i in 1:size(rref_A, 1)
    if all(rref_A[i, :] .== 0)
        push!(redundant_constraints, i)
    end
end

# Remove redundant constraints
for i in redundant_constraints
    JuMP.delete(model, JuMP.all_constraints(model)[i])
end

# Solve the modified optimization problem
optimize!(model)

# Print the optimal solution
println("Optimal solution:")
println("x = ", value(x))
println("y = ", value(y))

In this modified example, we compute the RREF of the constraint matrix and identify the rows with all zeros, indicating redundant constraints. We then remove these redundant constraints from the problem formulation and solve the modified optimization problem.

Option 3: Automatic removal of redundant constraints using the Nullspace

Another approach to automatically remove redundant constraints is by using the Nullspace of the constraint matrix. The Nullspace represents the set of all vectors that satisfy the homogeneous system of equations Ax = 0, where A is the constraint matrix. Let's modify the previous example to demonstrate this method:


using JuMP
using GLPK
using LinearAlgebra

# Create a model
model = Model(with_optimizer(GLPK.Optimizer))

# Define variables
@variable(model, x >= 0)
@variable(model, y >= 0)

# Define constraints
@constraint(model, 2x + y <= 10)
@constraint(model, x + y <= 5)
@constraint(model, x + y <= 7)  # Redundant constraint

# Define objective function
@objective(model, Max, 3x + 4y)

# Solve the optimization problem
optimize!(model)

# Get the constraint matrix
A = JuMP.constraint_matrix(model)

# Compute the Nullspace of the constraint matrix
nullspace_A = nullspace(A')

# Identify redundant constraints
redundant_constraints = []
for i in 1:size(nullspace_A, 2)
    if all(nullspace_A[:, i] .== 0)
        push!(redundant_constraints, i)
    end
end

# Remove redundant constraints
for i in redundant_constraints
    JuMP.delete(model, JuMP.all_constraints(model)[i])
end

# Solve the modified optimization problem
optimize!(model)

# Print the optimal solution
println("Optimal solution:")
println("x = ", value(x))
println("y = ", value(y))

In this modified example, we compute the Nullspace of the constraint matrix and identify the columns with all zeros, indicating redundant constraints. We then remove these redundant constraints from the problem formulation and solve the modified optimization problem.

Among the three options, the automatic removal of redundant constraints using the Nullspace (Option 3) is generally the most efficient and reliable method. It avoids the need for manual identification and provides a systematic approach to remove redundant constraints. However, the choice of method may depend on the specific problem and constraints involved.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents