I have a simple infeasible problem as below.

  • Maximize z = 4x1 + 3x2

  • 2x1 - x2 >= 6

  • x1 + x2 <= 2

  • x1 and x2 >= 0

After solving I see that the termination status says 'ok' rather than saying 'infeasible'. May I know if something is wrong with the formulation in code?

# Create a concrete model
model = ConcreteModel()

# Define variables with initialization and domain
model.x1 = Var(domain=NonNegativeReals, initialize=0.0)
model.x2 = Var(domain=NonNegativeReals, initialize=0.0)

# Define the objective function
model.obj = Objective(expr=4 * model.x1 + 3 * model.x2, sense=maximize)

# Define the constraints
model.constraint1 = Constraint(expr=2 * model.x1 - model.x2 >= 6)
model.constraint2 = Constraint(expr=model.x1 + model.x2 <= 2)

# Solve the model using the GLPK solver
solver = SolverFactory('glpk')
results = solver.solve(model)

enter image description here

  • $\begingroup$ Perhaps you can show us all the (Pyomo and GLPK) output, with verbose on its maximum setting. $\endgroup$ Commented Nov 11, 2023 at 22:20
  • $\begingroup$ I have edited the question with an image. I'm a new student trying to learn OR. Please kindly help with syntax if you are looking for something specific. Thank you. $\endgroup$
    – Prasanna
    Commented Nov 11, 2023 at 22:37
  • $\begingroup$ You haven't shown us TerminationCondition. Perhaps it is "infeasible". I don't think SolverStatus 'ok' precludes a solver determination of infeasibility. $\endgroup$ Commented Nov 12, 2023 at 2:26
  • $\begingroup$ That makes sense and agree. TerminationCondition is not 'infeasible' but it says 'other', atleast it does not say 'optimal'. For now, I'm assuming that 'other' is also some sort of 'infeasibility'. Thank you so much for your insight. $\endgroup$
    – Prasanna
    Commented Nov 12, 2023 at 3:39

1 Answer 1


This is indeed a little weird! When I run your example, I get the output from GLPK:

GLPK Simplex Optimizer 5.0
3 rows, 3 columns, 5 non-zeros
2 rows, 2 columns, 4 non-zeros
 A: min|aij| =  1.000e+00  max|aij| =  2.000e+00  ratio =  2.000e+00
Problem data seem to be well scaled
Constructing initial basis...
Size of triangular part is 2
      0: obj =  -0.000000000e+00 inf =   6.000e+00 (1)
      1: obj =   8.000000000e+00 inf =   2.000e+00 (1)
glp_simplex: unable to recover undefined or non-optimal solution
If you need actual output for non-optimal solution, use --nopresol
Time used:   0.0 secs
Memory used: 0.0 Mb (40412 bytes)

From this it is very clear that GLPK is well aware that there is no primal feasible solution, hence it knows that it is an infeasible problem.

However, results.solver.status says ok and results.solver.termination_condition says other. I have tried to solve the problem with cplex, gurobi, and cbc as well. They report the following

status ok warning ok warning
termination_condition other infeasible infeasible infeasibleOrUnbounded

From this, it seems that there is something going on with what GLPK is returning as the termination condition to Pyomo. The other solvers are capable of conveying the message that your model does not have an optimal solution.

  • $\begingroup$ Totally agree! Thank you for the effort you put in. $\endgroup$
    – Prasanna
    Commented Nov 12, 2023 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.