I would like to use the solvers of the Coin-or Optimization Suite in pyomo. As I have seen on the website there are rebuild binaries. I have downloaded and unpacked them. But how do I now integrate them into python? How are the binaries installed? Or is it enough to simply move the .exe
file files into the bin folder my venv? Am I missing any dependencies?
Thanks in advance
I found that information but really don't know what to do:
Pre-built Binaries Binaries for most platforms are available for download from Bintray. Binaries can also be installed on specific platforms, as follows. AMPL also kindly provides executables of some solvers for download from here. We are working on some other better ways of getting binaries, such as conda packages, and will keep this README updated as things progress. Installers Windows There is a Windows GUI installer available here for installing libraries compatible with Visual Studio (you will need to install the free Intel compiler redistributable libraries).
I copied the downloaded files in my directory of the python venv but the solvers don't work. Executing the following minlp:
import pyomo.environ as pyo
domain = [0.0216, 0.0285]
model = pyo.ConcreteModel('oddball domain')
model.I = pyo.Set(initialize=range(2)) # x index
model.DI = pyo.Set(initialize=[0, 1]) # domain index
model.vals = pyo.Param(model.DI, initialize=domain)
model.x = pyo.Var(model.I, model.DI, domain=pyo.Binary)
model.obj = pyo.Objective(expr=sum(model.x[i, di]*model.vals[di]
for i in model.I
for di in model.DI), sense=pyo.maximize)
def only_one(m, i):
return sum(m.x[i, di] for di in m.DI) <= 1
model.C1 = pyo.Constraint(model.I, rule=only_one)
model.pprint()
solver = pyo.SolverFactory('couenne')
results = solver.solve(model)
print(results)
I get for couenne and bonmin these errors:
Traceback (most recent call last):
File "L:\Trentmann\Masterarbeit\04_Beispiele\pyomo\DHNetwork_gekoppelt_Ganzzahlig_def.py", line 597, in <module>
result = opt.solve(model, tee=True)
File "C:\Users\ga87ces\Anaconda3\envs\pyomo\lib\site-packages\pyomo\opt\base\solvers.py", line 513, in solve
self.available(exception_flag=True)
File "C:\Users\ga87ces\Anaconda3\envs\pyomo\lib\site-packages\pyomo\solvers\plugins\solvers\ASL.py", line 116, in available
return self.version() is not None
File "C:\Users\ga87ces\Anaconda3\envs\pyomo\lib\site-packages\pyomo\opt\base\solvers.py", line 422, in version
self._version = self._get_version()
File "C:\Users\ga87ces\Anaconda3\envs\pyomo\lib\site-packages\pyomo\solvers\plugins\solvers\ASL.py", line 105, in _get_version
if results.stdout.strip().split()[-1].startswith('ASL('):
IndexError: list index out of range
Process finished with exit code 1
I am also currently writing my master's thesis and needed to go through this problem. I solved it by going to the website of AMPL https://ampl.com/products/solvers/open-source-solvers/ and download the 'AMPL & Solvers demo bundle'. The only thing you need to do is to unpack the zip file, and add the path of the unpacked folder to your system PATH.
Pyomo will find the solver with the code you already have. In case you want to use commercial solvers, which are not open source and free, you can get a 30day test license for it also at AMPL.