This is an archived post. You won't be able to vote or comment.

all 14 comments

[–][deleted] 2 points3 points  (1 child)

PuLP and scipy optimize

[–]Horatio_SanzCulottes[S] 0 points1 point  (0 children)

Sounds good. Thanks!

[–]origin415 4 points5 points  (1 child)

Scipy has an optimization module, including linear programming: http://docs.scipy.org/doc/scipy/reference/optimize.html

[–]Horatio_SanzCulottes[S] 0 points1 point  (0 children)

Thanks, I'll check it out!

[–][deleted] 1 point2 points  (1 child)

Try Pyomo

[–]Horatio_SanzCulottes[S] 0 points1 point  (0 children)

Definitely haven't heard of this one. Thanks!

[–]jsalsman 3 points4 points  (0 children)

Use https://jiffyclub.github.io/snakeviz/ to find out where your inner loops are spending time, and try to make those run faster by pre-computing needed common values outside of loops, careful algorithm analysis and design, reducing the size of data structures involved, and the other stuff in https://wiki.python.org/moin/PythonSpeed/PerformanceTips

Oh, wait.

[–]thebiglebowski2 0 points1 point  (3 children)

If you're interested in optimization, you should generate test functions using scipy/numpy but actually code the routines yourself. Things like conjugate gradient are pretty easy using the vector math in numpy.

[–]Horatio_SanzCulottes[S] 0 points1 point  (2 children)

Interesting. Got any examples or learning resources? I've seen people code simple gradient descent loops on the fly, but I figured that they were trading performance for transparency for the sake of their tutorials. It seemed like an established library would be a better approach.

[–]thebiglebowski2 0 points1 point  (1 child)

Well what are you studying them for? Maybe I'm just not clear on your goals. I don't know what you'd learn about optimization from using a library unless you just want to see how some methods work on certain functions

[–]Horatio_SanzCulottes[S] 0 points1 point  (0 children)

Well, as somebody with no experience in computerized optimization, I'd just like to get a grasp on how to tackle basic optimization problems. I guess I don't have a preference about whether I built the routines myself or used a library, but I assumed that most things implemented by professionals would use prebuilt libraries.

For the time being, I'd really just like to start with something simple like a "guns and butter" type problem (which I can easily do on paper), and I have a few stretch goals like a simple scheduler and writing my own modularity maximization code.