0

Running cplex/pyomo the solver found a solution and it reported saved somewhere though I closed before taking note, can't find over the web where is it stored.

running windows, anyone?

ma7555
  • 362
  • 5
  • 17

2 Answers2

2

I don't know how exactly pyomo invokes CPLEX to store solutions on disk. The default behavior of CPLEX is to store solutions in the current working directory. The solution file will have a suffix of either .sol or .mst.

Daniel Junglas
  • 5,830
  • 1
  • 5
  • 22
0

by default pyomo generates a json file results.json in the directory where you call pyomo.

Let me take the bus example in pyomo:

In the file pyomobus.py

from pyomo.environ import *

model = ConcreteModel()

model.nbBus = Var([40,30], domain=PositiveIntegers)

model.OBJ = Objective(expr = 600*model.nbBus[40] + 480*model.nbBus[30])

model.nbKids = Constraint(expr = 40*model.nbBus[40] + 30*model.nbBus[30] >= 300)

then in that directory if you type

pyomo solve pyomobus.py  --solver=cplex

you will get a file results.json in that directory where you will read

"Problem": {},
            "Status": "optimal",
            "Variable": {
                "nbBus[30]": {
                    "Value": 2.0
                },
                "nbBus[40]": {
                    "Value": 6.0
                }
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15