Integer linear programming + python + ubuntu - python

I would like to solve an integer linear programming problem in python for the first time. After searching online I was pointed to lp_solve but I can't see how to get the python bindings installed in ubuntu. I have also had gurobi and cplex recommended but they are no open source. Is there a nice and simple way to set up an integer linear programming problem and have it solved in python using only free software?

I'm attending course on linear programming at the moment, recommended module for programming assignments was cvxopt.
I've actually found that I like PuLP module much more.
It's really nice module, give it a try.

I'd recommend looking at SCIP, see http://scip.zib.de/ and the Python interface
http://code.google.com/p/python-zibopt/, just look at the ZIB licence first.
If Academic licence is an option, you can get Cplex, Gurobi, Xpress and some others as well. I think GLPK may be an option if really free is the only option.
IMO, SCIP is fantastic for advanced prototyping, but obviosly works fine for simpler things like just setting up the ILP and solving it. Observe that SCIP can be wired with the most popular commercial alternatives as well for better performance.

Related

Optaplanner and Pyomo

I'm currently using pyomo environment to solve optimization problems. I have used different solvers (Ipopt, glpk, cbc, couenne) in order to solve my problems.
Actually I need to solve a non-linear problem with a global solver. I've already tried couenne but it doesn't give me the right answer. Looking on the web, I have seen the Optaplanner as a metaheurist solver but I only found example written in Java.
Is it possible to use this solver with pyomo on windows?
If yes then how to configure it?
You can't use OptaPlanner in pyomo, but you can use OptaPlanner on Windows. Just download (or git clone) the quickstarts here. If you don't like Java, take a look at the Kotlin quickstart.
Update: You can now also try OptaPy in Python.

Python library or package for bifurcation analysis in ordinary differential equations

What are libraries packages available in Python for the simulation and bifurcation study of dynamical systems?
I want to study the bifurcation phenomenon in ordinary differential equations. I know that there is AUTO in Fortran. I also found PyDSTool in Pyhton. The issue with PyDSTool is that it has some incompatibilities with 64-bit systems and Python 3 (and also numpy, etc.). I was wondering if there is any state-of-the-art library in Python for this purpose.
Thanks.
I don't think there is anything available in Python (except for PyDSTools and its interface with AUTO). You might check out the bifurcation suite in JULIA (which is also well suited to simulate and model dynamical systems): [http://diffeq.sciml.ai/latest/analysis/bifurcation.html][1]
[1]: http://diffeq.sciml.ai/latest/analysis/bifurcation.html
It is also built around PyDstools though but you might be able to circumvent your incompatibility problems.

Should i switch to Python? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I recently have been considering switching to the Python programming language. Currently, Matlab is the language of choice in my department for rapid development and prototyping of code. It’s very good at this, but Mathworks (the company who produces Matlab) have been tinkering with the licencing terms, leading to hassles where none should exist.
I have found python+numpy+scipy+matplotlib+IPython+[random sci/numerical packages] to be almost a complete replacement for matlab. There are certainly some packages missing, so if there is a specialized set of tools that are available in matlab but not in python, this might be an issue, but otherwise, I haven't looked back.
I'll mention a couple of distinct advantages of python over matlab
True programming language instead of a hack of a language thrown over a numerical package (numpy came to python instead of the other way around). Managing large python projects is a complete joy vs matlab. How many different oop systems have been mangled into matlab?
Totally free and portable. I can use python on just about any machine without licensing issues. This is the biggest advantage from my perspective.
Wrapping other libraries in C,C++, Fortran is fairly straightforward using SWIG, Cython,f2py,etc vs the ugliness that is a mex file
Cython for accelerating slow code (although I find that numpy is nearly as fast if not faster than matlab)
mpi4py vs some other package that I have to buy from matlab to run parallel applications
Personally I use the Enthought Python Distribution for a lot of my work, because it packages everything and is free for individuals in academia. I've alternatively built python and all of its libraries and modules from scratch. Module management is perhaps the largest weakness in python, but there are some nice things to help out like virtualenv and pip
The choice comes down to cost. If you are happy paying for Matlab - especially if you use the toolboxes - you will likely find Python doesn't provide such an integrated package. Having a matrix as the basic data type makes Matlab an intuitive language for many mathematical tasks. Personally, I find the this coupled with the debugger invaluable.
Python, through NumPy, SciPy and the like do provide the same functionality. There will of course be a learning curve to overcome.
If you are performing general programming tasks, that are not particularly applied math solutions then Python is an extremely easy to use and adaptable language. It is also free - which may be a deciding factor.
If you're looking for a wholesale Matlab replacement, you may want to take a look at Python(x, y). It aims to provide a more cohesive experience, rather than leaving new users to trawl the internet themselves looking for the right components to use.
Another option is GNU Octave, which is essentially an open-source clone of MATLAB.
Python certainly is useable as a replacement for Matlab for many cases, by using NumPy, SciPy, and Matplotlib (see my development environment setup guide for how to install all these packages). However, there are some things that Matlab does better, such as providing libraries for interfacing with data collection hardware. So you will need to try Python and see if it meets your requirements.
Should you switch or not depends on what you think of Python. I myself love Python, and I know it is extremely effective for rapid prototyping. The syntax is clean and crisp, and very easy to learn.
To make your decision I recommend visiting the home page, Python.org, and having a look at the docs.
Just download scipy and give it a try.

What's a good library to do computational geometry (like CGAL) in a garbage-collected language?

I need a library to handle computational geometry in a project, especially boolean operations, but just about every feature is useful. The best library I can find for this is CGAL, but this is the sort of project I would hesitate to make without garbage collection.
What language/library pairs can you recommend? So far my best bet is importing CGAL into D. There is also a project for making Python bindings for CGAL, but it's very incomplete.
I would still recommend to proceed with Python and the existing Python binding. When you find it's incomplete, you'll also find that it is fairly easy to extend - Python's C API is designed so that integrating with external libraries is fairly easy (for experienced C programmers).
Perhaps you can look at Shapely for python
http://pypi.python.org/pypi/Shapely/
For Java I would use JTS
For .NET I would use SharpMap or .NETTopologySuite
The CGAL-bindings project provides bindings for CGAL using SWIG. The targeted languages, so far, are Java and Python. The CGAL-bindings project is open source, and supported/founded by two french companies.
JTS is also available in .NET via IKVM.
I've just found this and it seems very promising even if it seems a young project: https://pyrr.readthedocs.org/en/latest/index.html#
Pyrr is a Python mathematical library.
and it is based on numpy!

Porting MATLAB functions to Scilab. How do I use symbolic?

I'm porting some MATLAB functions to Scilab. The cool thing is that there is a conversion toolbox that make things very easy.
The problem is I did not find the counterpart to the syms function, and the symbolic toolbox in general. (I'd like a port of the Control System Toolbox too, amd I'm still searching for some functions I'd may need).
The only thing about symbolic toolbox I've found is this, but it was a little trcky and not so easy (actually I was not able to set up it correctly in 30 minutes, and I gave up for now. I'm going to try later), and it needs Maxima to be installed. Does anyone know anything about that?
Scilab is not exactly a must. The project aims to give a more free and open source alternative to MATLAB. I saw there is SymPy for Python, and I just could use it with SciPy, but I'd lost the conversion toolbox thing :\
That said, what should be better? Get SciLab and Maxima work together or move to Python & co.? This is the start of the project, so the earlier I choose this, the better.
See Bye MATLAB, hello Python, thanks Sage for a first-hand experience of migrating from MATLAB to Python.
Not to discourage your project, but if you just want a free and open source alternative to MATLAB, have you looked at the Octave project? Contributing there might be more productive than building your own MATLAB alternative.
If your project requires the functionality of MATLAB's Symbolic then take a look at
http://wiki.octave.org/wiki.pl?CategorySymbolic
From my quick Google search I didn't find anything comparable to MATLAB's Simulink.
Also, Python and SciPy do have most of the functionality of MATLAB, and I guess Scilab's conversion utility would be useful in porting your own M-Files into Scilab code.
Your question seems to imply you want to port over MATLAB Toolboxes
The only thing about symbolic toolbox I've found is this...
I hope I am just misinterpreting you. If you are then there might be licensing issues if you were to distribute your system because the MATLAB Toolbox. Just a thought. But perhaps you wish to port your MATLAB code to, so that it doesn't not have the MATLAB dependency.
Update
For Control System functionality Octave, I just found that Octave does have a toolbox, see:
Octave Control Systems Toolbox
Which has some of the functionality of Simulink, but it doesn't seem to have the graphical interface for building block diagrams.

Categories

Resources