fslaborg / flips

Fsharp LInear Programming System
https://flipslibrary.com/#/
MIT License
253 stars 32 forks source link

Logarithm function in Objective Function #76

Closed hoangdungt2 closed 3 years ago

hoangdungt2 commented 4 years ago

hi, as the title says, my objective function is some thing like

1.0log(x1) + 2.0log(x2) s.t. 1<= x1,x2 <= 10 x1 + x2 <= 20

seems flips is quite suitable but the log(x1) gives me error as Decision does not have member Log. Wonder if the log function is supported by flips. I looked through the code and does not find any place to handle it. Not sure if it can be supported. If not, can you advise any dotnet package that can handle my problem above? Thank you very much.

matthewcrews commented 4 years ago

Sorry for not getting back sooner. I was on vacation then had to evacuate my family due to the wildfires happening in Oregon.

Linear Programming(LP) and Mixed-Integer Programming (MIP) only work with linear functions. Now, when you have to optimize a non-linear function, you can often approximate it with a series of linear functions. I'll try to put together a blog post to illustrate this.

hoangdungt2 commented 4 years ago

hi Matthew, thanks for replying and sorry to hear about the wildfires, hope everything is alright with your family. I'm looking forward to your blog, currently I'm using gekko (https://gekko.readthedocs.io/en/latest/) but I just really dislike Python. Do keep me posted about your blog. Thanks.

matthewcrews commented 4 years ago

I just wanted to give you a heads up that I am working on this now. I hope to have an example out by the end of the week. I will post a link here when it is up.

matthewcrews commented 3 years ago

@hoangdungt2 Sorry for the long delay. I finally got a blog post up today which illustrates modeling non-linear functions with linear-approximations in Flips

https://matthewcrews.com/blog/2020-12-01-modeling-nonlinear-functions-with-flips/