Skip to main content
Became Hot Network Question
added 89 characters in body
Source Link

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

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)

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

added 10 characters in body
Source Link

I have a simple infeasible problem as below.

Maximize z = 4x1 + 3x2

  • Maximize z = 4x1 + 3x2

  • 2x1 - x2 >= 6

  • x1 + x2 <= 2

  • x1 and x2 >= 0

2x1 - x2 >= 6 x1 + x2 <= 2 x1 and x2 >= 0 AfterAfter 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)

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)

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)
Source Link

GLPK solver with Pyomo, not recognizing infeasibility

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)