# Implementation of Linear Programming with IPOPT

**URL:** <https://community.freefem.org/t/implementation-of-linear-programming-with-ipopt/887>\
**Category:** General Discussion\
**Created:** [April 1, 2021, 8:55pm UTC](https://community.freefem.org/t/implementation-of-linear-programming-with-ipopt/887 "2021-04-01T20:55:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [April 1, 2021, 8:55pm UTC](https://community.freefem.org/t/implementation-of-linear-programming-with-ipopt/887/1 "2021-04-01T20:55:56Z")

</div>

Hello,  
I try to use IPOPT to minimize a linear function under some bound constraints. According to the doc the following code should work:

```
load "ff-Ipopt"

real[int] a = [-1.0,-1.2];
real[int] UB = [1.0,1.0];
real[int] LB = [0.0,0.0];
real[int] x0 = [0.5,0.5];

IPOPT(a,x0,lb=LB,ub=UB);

```

However, I get a segmentation fault. I don’t know where the error comes from. Can you please indicate what I am doing wrong? Thank you.  
Best regards,  
Beniamin

---

<div class="post-metadata">

**Author:** ![LucasPa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/lucaspa/32/347_2.png) [@LucasPa](https://community.freefem.org/u/LucasPa)\
**Post date:** [April 2, 2021, 4:57pm UTC](https://community.freefem.org/t/implementation-of-linear-programming-with-ipopt/887/2 "2021-04-02T16:57:00Z")

</div>

Hi,

I’ve never used IPOPT. But I’ve seen that there is some examples in examples/plugin. For instance IpoptMinSurf.edp. It looks like the first arguments should be a func, not a real[int].

Best,

Lucas

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [April 4, 2021, 8:33pm UTC](https://community.freefem.org/t/implementation-of-linear-programming-with-ipopt/887/3 "2021-04-04T20:33:13Z")

</div>

In the documentation it says that the arguments determining the function can be of the form [A,b] when the function to be optimized is x^TAx+b^Tx (basic quadratic function), or a real[int] when the function is simply a linear function. Supposedly, for these basic cases, more efficient algorithms can be used.

I managed to make the algorithm work by supplying [A,b] with A=0. However, I was wondering why the version present in the documentation does not work.

---

<div class="post-metadata">

**Author:** ![Zhang](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@Zhang](https://community.freefem.org/u/Zhang)\
**Post date:** [May 4, 2024, 4:45pm UTC](https://community.freefem.org/t/implementation-of-linear-programming-with-ipopt/887/4 "2024-05-04T16:45:20Z")

</div>

Hello, I was wondering if you have solved this problem? Thank you very much
