title: Implementation of MINLP solver "apopt" in Pyomo
body: <p>I have a mixed integer non linear problem in Pyomo with an objective function and several constraints consisting of non-linear terms and binary variables.</p>
  <p>The popular solver &quot;ipopt&quot; finds a solution, but it treats the binary variables as continuous variables.</p>
  <pre><code>opt=SolverFactory(&quot;ipopt&quot;)
  results=opt.solve(instance)
  results.write()
  instance.load(results)
  </code></pre>
  <p>Now I have already tried desperately to try two solvers that can solve mixed-integer non-linear problems.</p>
  <ol>
  <li>First I tried the MindPy solver ( <a href="https://pyomo.readthedocs.io/en/stable/contributed_packages/mindtpy.html" rel="nofollow noreferrer">https://pyomo.readthedocs.io/en/stable/contributed_packages/mindtpy.html</a>). Unfortunately without success:</li>
  </ol>
  <p>I always get the error message: &quot;<strong>type NoneType doesn't define <strong>round</strong> method</strong>&quot;. This surprises me, because the ipopt-solver finds a solution without problems and the mindtpy-solver is a mixture of a linear solver and a non-linear solver and should actually get this solved.</p>
  <pre><code>opt=SolverFactory('mindtpy').solve(instance, mip_solver=&quot;glpk&quot;, nlp_solver=&quot;ipopt&quot;, tee=True)
  results=opt.solve(instance)
  results.write()
  instance.load(results)
  </code></pre>
  <p>2)Then I tried the apopt solver. You have to download it separately from &quot;https://github.com/APMonitor/apopt&quot; and put all files into the working directory.</p>
  <p>Then I tried to execute the following code, unfortunately without success:</p>
  <pre><code>opt=SolverFactory(&quot;apopt.py&quot;)
  results=opt.solve(instance)
  results.write()
  instance.load(results)
  </code></pre>
  <p>I always get the following error message: &quot;Error message: <strong>[WinError 193] %1 is not a valid Win32 application</strong>&quot;. This is probably related to the fact that my Python interpreter requires an apopt.exe since I have a Windows machine. Attempts such as converting the .py to an .exe file have failed. Also, specifying Solverfactory(..., &quot;executable=C\Users\Python...\\apopt.py&quot; separately did not work.</p>
  <p>Does anyone have an idea how to get the solver &quot;apopt&quot; and/or the solver &quot;Mindtpy&quot; to work and can do something with the error messages?
  Thank you very much in advance!</p>
  <p>Edit:</p>
  <p>Here is an exemplary and simple concrete model. I have tried to translate it into easier code. As I've already said, the ipopt solver finds a solution:</p>
  <pre><code>model = pyo.ConcreteModel()
  
  model.x = pyo.Var([1,2,3,4], domain=pyo.NonNegativeReals)
  
  model.x = pyo.Var([5], domain=pyo.Binary)
  
  model.OBJ = pyo.Objective(expr = 2*model.x[1] + 3*model.x[2] + 3*model.x[3] + 4*model.x[4])
  
  model.Constraint1 = pyo.Constraint(expr = 3*model.x[1] + 4*model.x[2] &gt;= 1)
  
  model.Constraint2 = pyo.Constraint(expr = 3*model.x[3] + 4*model.x[4] &gt;= 1)
  
  model.Constraint3 =pyo.Constraint(expr = 1000*cos(model.x[3]) &lt; 1000)
  
  model. Constraint4=pyo.Constraint(expr = 1000*sin(model.x[4]) &lt; 1000)
  
  model.Constraint5=pyo.Constraint(expr = model.x[2] &lt;= 10000*(1-model.x[5])
  
  model.Constraint6= pyo.Constraint (expr=model.x[2] &lt;= 10000*(model.x[5]))
  </code></pre>