4
$\begingroup$
model = pyo.ConcreteModel()
opt = SolverFactory('cplex', executable = cplex_executor_path)
model.x = Var(ftHc, within = NonNegativeIntegers)
model.y = Var(ftHc, within = NonNegativeIntegers)
model.obj = pyo.Objective(expr = xyz, sense=pyo.minimize)
model.C1 = Constraint(abc, rule=abc_rule)
results = opt.solve(model,tee=True)

I have tried to access it this way

for v in model.iter_integer_vars():
    print(v," = ",v.solution_value)

but I am getting an error saying:

AttributeError: 'ConcreteModel' object has no attribute 'iter_integer_vars'
$\endgroup$
1
  • $\begingroup$ Maybe this thread would be helpful. $\endgroup$
    – A.Omidi
    Commented Jul 9, 2022 at 8:45

0

Browse other questions tagged or ask your own question.