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

Handling LP Problem With Integer or Binary Variable in Lingo

This document discusses how to solve a linear programming problem with integer or binary variables in Lingo instead of Lindo. It provides an example LP problem in Lindo format and shows how to convert it to Lingo format by declaring the variables as integer using the @gin() and @int() functions. Solving the converted Lingo model returns an integer optimal solution instead of the fractional solution from Lindo.

Uploaded by

veeru117
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
307 views

Handling LP Problem With Integer or Binary Variable in Lingo

This document discusses how to solve a linear programming problem with integer or binary variables in Lingo instead of Lindo. It provides an example LP problem in Lindo format and shows how to convert it to Lingo format by declaring the variables as integer using the @gin() and @int() functions. Solving the converted Lingo model returns an integer optimal solution instead of the fractional solution from Lindo.

Uploaded by

veeru117
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Handling LP problem with integer or binary variable in Lingo Take exercise 1a as an example, the LP problem is Min 12q + 5r + 3s s.t.

q+2r+4s > 6 5q+6r-7s < 5 8q-9r+11s = 10 q,r,s > 0 In the class, Lindo syntax was introduced to solve the problem as min 12q + st q+2r + 4s 5q + 6r 8q-9r+11s 5r + 3s > 6 7s < 5 = 10

With solution, Global optimal solution found. Objective value: Infeasibilities: Total solver iterations:

6.068966 0.000000 2

Variable Q R S Row 1 2 3 4

Value 0.000000 0.4482759 1.275862 Slack or Surplus 6.068966 0.000000 11.24138 0.000000

Reduced Cost 12.51724 0.000000 0.000000 Dual Price -1.000000 -1.413793 0.000000 0.2413793

However, if the variable q,r,s should be limited to integer or binary type, the above Lindo program has to be converted to Lingo syntax, then use functions @gin() and @int to declare integer or binary variables. For example, the above code can be modified to the following, @gin(q); @gin(r); @gin(s); min= 12*q + 5*r + 3*s; q+2*r + 4*s > 6; 5*q + 6*r - 7*s < 5; 8*q-9*r+11*s = 10; Save it as Lingo format file. It will then solve the above program with integer variables. The solution shall be similar to the following, Global optimal solution found. Objective value: Objective bound:

20.00000 20.00000

Infeasibilities: Extended solver steps: Total solver iterations:

0.000000 0 0

Variable Q R S Row 1 2 3 4

Value 1.000000 1.000000 1.000000 Slack or Surplus 20.00000 1.000000 1.000000 0.000000

Reduced Cost 12.00000 5.000000 3.000000 Dual Price -1.000000 0.000000 0.000000 0.000000

You might also like