0% found this document useful (0 votes)
7 views

code

useful

Uploaded by

Quang Lã Việt
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

code

useful

Uploaded by

Quang Lã Việt
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Write a Python script to illustrate how a Gomory cut is generated.

Report: Application of Gomory Cut in Integer Linear Programming


1. Introduction
Integer Linear Programming (ILP) is a mathematical optimization technique where the
objective function and constraints are linear, but the decision variables are restricted to
integer values. These problems arise in many practical applications, such as resource
allocation, scheduling, and production planning.
In an ILP problem, the goal is to find the integer solution that optimizes (minimizes or
maximizes) an objective function while satisfying a set of linear constraints. However,
solving ILPs is challenging due to the discrete nature of the variables. The Gomory cut is
a powerful method used in the branch-and-bound algorithm to find integer solutions
more efficiently by adding new constraints to eliminate fractional solutions from the
feasible region.
2. Problem Formulation
In this report, we solve a simple two-variable Integer Linear Programming (ILP)
problem. The objective is to minimize the cost subject to linear constraints, and the
decision variables are required to be integers.
Objective Function:

where x1 and x2 are integer variables.


Subject to the constraints:

The goal is to find the integer values of x1 and x2 that minimize the objective function
while satisfying these constraints.
3. Solution Procedure
Step 1: Solve the LP Relaxation
The first step is to relax the integer constraints and solve the Linear Programming (LP)
problem without the integer requirement. This gives us a real-valued solution for x1 and
x2, which may or may not be integers.
By solving the relaxed LP, we obtain a solution, but in many cases, the solution may have
fractional values. These fractional solutions are not valid for the ILP, and thus, we must
apply techniques such as the Gomory cut to move toward an integer solution.
Step 2: Check for Fractional Solutions
Once the LP relaxation is solved, we check if any of the variables in the solution are
fractional. A fractional solution means that the solution is not valid for the ILP, and a
Gomory cut should be applied to eliminate this fractional solution.
Step 3: Apply the Gomory Cut
The Gomory cut method generates a cutting plane that eliminates fractional solutions
from the feasible region of the ILP. The cut is added as an additional constraint, and the
problem is re-solved to move toward an integer solution.
A Gomory cut typically takes the form:

where ai is a coefficient derived from the current solution, and the floor function ensures
that fractional solutions are removed.
Step 4: Re-solve the Problem
After applying the Gomory cut, the problem is solved again. This process can be repeated
iteratively, adding more cuts if necessary, until an optimal integer solution is found.
4. Example Solution
For this example, we use the Python package PuLP to solve the ILP problem and apply
the Gomory cut. The following steps were performed:
1. LP Relaxation: We first solve the LP relaxation of the problem (i.e., without the
integer constraints), and the solution was found to be:
o x1=2.0
o x2=1.5
2. Fractional Solution Detected: Since x2=1.5is fractional, we apply the Gomory
cut to eliminate this fractional solution.
3. Gomory Cut Application: A cut was generated based on the fractional parts of
the solution. The cut constraint is added to the problem, and the problem is solved
again.
4. Re-solved Problem: After applying the Gomory cut, the new integer solution was:
o x1=2.0
o x2=1.0
This is the final integer solution to the ILP problem.

5. Gomory Cut in Detail


The Gomory cut works by analyzing the LP relaxation solution and creating a constraint
that removes the fractional solution. In this case, the cut added is based on the fractional
part of the variables.
For example, in the case where x1=2.0 and x2=1.5, the fractional part of x2 is 0.5. A
Gomory cut could be generated that forces x2 to take integer values, eliminating the
fractional solution x2=1.5.
6. Results and Conclusion
The initial solution to the LP relaxation was fractional, which was not valid for the ILP
problem. After applying the Gomory cut, we were able to eliminate the fractional solution
and find an integer solution, which satisfies the original integer constraints.
Final Integer Solution:
 x1=2
 x2=1
Thus, the Gomory cut method helped us move from a fractional solution to an optimal
integer solution. This technique is particularly useful in solving complex ILP problems
that arise in practical scenarios.

You might also like