hmmauryc
hmmauryc

Reputation: 11

How to get dual variables for a MILP in Pyomo using NEOS

I already obtained the dual variables of a constraint writting the "model.dual = Suffix(direction=Suffix.IMPORT_EXPORT)" and so on, using CBC.exe as solver. But I'm trying to link my code with NEOS because CBC is extremely slow and CPLEX is really faster. But when I use NEOS as SolverManager, I can't obtain the dual variables of the constraint. Can anybody help me with this?
These are my lines of code that don't work:

model.balance = Constraint(model.N, model.T, rule=balance_rule)
model.dual = Suffix(direction=Suffix.IMPORT_EXPORT)
solver_manager = SolverManagerFactory('neos')
results= solver_manager.solve(model, solver = "cplex")
objective_value = model.obj()
lmp=0
    for n in model.N:
            for t in model.T:
                if t > 1:
                    lmp += d[n-1,t-1]*model.dual[model.balance[n,t]]

Upvotes: 1

Views: 80

Answers (0)

Related Questions