# COUENNE with Julia

**URL:** <https://discourse.julialang.org/t/couenne-with-julia/43216>\
**Category:** Optimization (Mathematical)\
**Created:** [July 17, 2020, 7:00am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216 "2020-07-17T07:00:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 17, 2020, 7:00am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/1 "2020-07-17T07:00:29Z")

</div>

hello there,

I am trying to install and use Couenne on Windows 10 so I can use it in my Julia program, Does anyone has experience with installing solvers. It is my first time to do something like that. What I understand is that I have to go through the steps on Git Hub and that this solver is not found under any name in julia library, is that correct?  
GitHub Link:  
[https://github.com/coin-or/Couenne](https://github.com/coin-or/Couenne)

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [July 17, 2020, 9:23am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/2 "2020-07-17T09:23:26Z")

</div>

I have no experience with Couenne but I think [https://github.com/rdeits/CouenneNL.jl](https://github.com/rdeits/CouenneNL.jl) is what you’re looking for.

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 17, 2020, 11:09am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/3 "2020-07-17T11:09:44Z")

</div>

This is what I was looking for  
Thank you

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 17, 2020, 1:35pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/4 "2020-07-17T13:35:56Z")

</div>

Alternatively, download Couenne from here: [Open Source Solvers - AMPLAMPL](https://ampl.com/products/solvers/open-source/) and use it with [https://github.com/jump-dev/AmplNLWriter.jl](https://github.com/jump-dev/AmplNLWriter.jl).

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 17, 2020, 1:44pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/5 "2020-07-17T13:44:19Z")

</div>

Thank you @odow

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 17, 2020, 2:17pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/6 "2020-07-17T14:17:53Z")

</div>

general question pls …with JuMP  
I need to define a NL expression that included the real part of an imaginary expression, but I get this message " Unrecognized function “real” used in nonlinear expression."  
This means that real can not be used with JuMP ?! right and what can I do instead ?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 17, 2020, 3:25pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/7 "2020-07-17T15:25:16Z")

</div>

You cannot use complex numbers with JuMP. You need to use the rectangular or polar form.

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 17, 2020, 3:43pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/8 "2020-07-17T15:43:36Z")

</div>

Aha…I see  
Thanks

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 20, 2020, 1:51am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/9 "2020-07-20T01:51:12Z")

</div>

I downloaded the 64bit windows binaries from [ampl.com](http://ampl.com) , yet I got this error msg when I tried running the .exe ![runtime](https://global.discourse-cdn.com/julialang/original/3X/c/4/c4fc55ed04d1700ecb0f18e74a19f7180a81050a.png)

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 20, 2020, 2:17am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/10 "2020-07-20T02:17:04Z")

</div>

m = JuMP.Model(() → AmplNLWriter.Optimizer(“C:/Users/mayar.madboly/Downloads/couenne-win64”))

I have put my path to couenne but I get a strange error msg saying that .Optimizer is not defined !!

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 20, 2020, 3:41am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/11 "2020-07-20T03:41:57Z")

</div>

m = JuMP.Model(JuMP.with\_optimizer(“C:/Users/mayar.madboly/Downloads/couenne-win64.exe”, print\_level =0))

Optimizer constructor is invalid…error msg

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 20, 2020, 12:59pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/12 "2020-07-20T12:59:03Z")

</div>

What is the output of `] add AmplNLWriter@0.6.0`?

The full syntax should be

```julia
model = Model(
    () -> AmplNLWriter.Optimizer(
        "C:/Users/mayar.madboly/Downloads/couenne-win64/couenne.exe"
    )
)

```

assuming you extracted the `couenne-win64.zip` so the path matches.

---

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [July 21, 2020, 1:00am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/13 "2020-07-21T01:00:13Z")

</div>

I had the same problem on windows.  
Its a C++ redistributable issue, related to couenne compilation on windows.

If you look online for VCRUNTIME140\_1.dll error there is a bunch of forum entries.

I solved my issue downloading: [Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019](https://www.visualstudio.com/downloads/).  
from here:

> **[Latest supported Visual C++ Redistributable downloads](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170)**
>
> This article lists the download links for the latest versions of Visual C++ Redistributable packages.

One of these:

- x86: [vc\_redist.x86.exe](https://aka.ms/vs/16/release/vc_redist.x86.exe)
- x64: [vc\_redist.x64.exe](https://aka.ms/vs/16/release/vc_redist.x64.exe)

might be enough.

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 22, 2020, 10:07am UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/14 "2020-07-22T10:07:44Z")

</div>

I have seen on AMPL WEBSITE a vide explaining how to use the AMPL ide with the ampl language…  
Have you considered this as an option to use the couenne solver or even other solvers?  
I am new to julia and I want to decide either to continue on julia or switch to another language  
What do you think?  
@odow  
@joaquimg

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 22, 2020, 2:50pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/15 "2020-07-22T14:50:58Z")

</div>

Note that AMPL is a commercial product. Your university may have licenses though.

I’m somewhat biased with my preference for JuMP over AMPL…

---

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [July 22, 2020, 2:56pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/16 "2020-07-22T14:56:27Z")

</div>

About usage explanations,

You can check: [https://github.com/jump-dev/JuMPTutorials.jl](https://github.com/jump-dev/JuMPTutorials.jl) for many tutorial, they complement the docs [Introduction · JuMP](https://jump.dev/JuMP.jl/v0.21.1/index.html) very well.

For a video intro: [JuMP-dev 2019 | Juan Pablo Vielma | Introductory Tutorial on Julia and JuMP - YouTube](https://www.youtube.com/watch?v=RJsZDk-27mk&list=PLP8iPy9hna6QkxelZiDOc5HnVGvQmEsLX&index=20&t=0s)  
(might be slightly out of date, you can double check in the manual if something does not go smoothly)

About suggestions same here… I would alway go for JuMP, but just like @odow, I am biased…

---

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [July 22, 2020, 2:58pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/17 "2020-07-22T14:58:08Z")

</div>

About the IDE, I like VSCode with the julia extension: [GitHub - julia-vscode/julia-vscode: Julia extension for Visual Studio Code](https://github.com/julia-vscode/julia-vscode)

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 22, 2020, 7:00pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/18 "2020-07-22T19:00:00Z")

</div>

@odow @joaquimg  
I am stuck here: What does that mean…I tried typing export in my cmd but it didnot work  
Add the `BARON_EXEC` environment variable pointing to the BARON executable (full path, including file name as it differs across platforms).

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 22, 2020, 7:08pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/19 "2020-07-22T19:08:36Z")

</div>

[https://docs.oracle.com/en/database/oracle/r-enterprise/1.5.1/oread/creating-and-modifying-environment-variables-on-windows.html#GUID-DD6F9982-60D5-48F6-8270-A27EC53807D0](https://docs.oracle.com/en/database/oracle/r-enterprise/1.5.1/oread/creating-and-modifying-environment-variables-on-windows.html#GUID-DD6F9982-60D5-48F6-8270-A27EC53807D0)  
I have windows OS  
Is that what I have to do ?  
@odow @joaquimg

---

<div class="post-metadata">

**Author:** ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)\
**Post date:** [July 22, 2020, 7:52pm UTC](https://discourse.julialang.org/t/couenne-with-julia/43216/20 "2020-07-22T19:52:43Z")

</div>

![why](https://global.discourse-cdn.com/julialang/original/3X/4/a/4a38d418b22a6d37c4b52026e9b6132a44836afc.jpeg)

decided to start with BARON and move to COUENNE  
This is what I made to add the variable  
I still get error when trying to build BARON

“Error building `BARON`:  
│ ERROR: LoadError: Unable to locate BARON executable. Make sure the solver has been separately downloaded, and that you properly set the BARON\_EXEC environment variabl”

[Next page](https://discourse.julialang.org/t/couenne-with-julia/43216.md?page=2)
