1

i solve my optimiziation problems whit pyomo and the cbc-solver. Now i try to print the terminal output/solution to a file:

import pandas as pd
from pyomo.opt import SolverFactory
from model import *

import numpy
import matplotlib.pyplot as plt

opt = SolverFactory('cbc')
opt.options['solution'] = 'output.txt'
opt.options['ratioGap'] = 0.02
opt.options['seconds'] = 3600

The solver option 'solution' will not work:

No match for /output.txt - ? for list of commands

I also get the info: Coin:solu ** Current model not valid

Can you help therefor?

Thanks & Greetings Capa

Capa
  • 31
  • 6

2 Answers2

0

thanks for the answer.

i have seen that i have to improve my question. i'am not intresting in the solution values. i will create a file with the solver informations like:

  • number of variables/binaries
  • gap of every calculation step
  • etc.
Capa
  • 31
  • 6
0

The solution is the optinal argument logfile='FILENAME.log', e.g.

results = opt.solve(instance, logfile='FILENAME.log',
                    symbolic_solver_labels=True, tee=True, load_solutions=True)
Capa
  • 31
  • 6