Any good tools to solve integer programs on linux? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Are there any good tools to solve integer programs on Linux?
I have a small problem that I want to compute to save time :D. It is kind of a subset sum problem. I have a list of around 20 Integer-Values and I want to compute the subset with the smallest sum that satisfies a certain minimum. You could formulate this with a integer program... something like
\sum_{i=1}^{n} w*x -> min
with
\sum_{i=1}^{n} w*x >= c with x \in \{0,1\}
Or is there an other good way to do this?

I would try either GLPK or SCIP.
They have their own modeling language, GLPK has GNU MathProg and SCIP has ZIMPL, so you can conveniently code your LP problem.
GNU MathProg has the advantage of being compatible with AMPL. Thus, you could try the student version of AMPL with CPLEX or Gurobi with your GNU MathProg model. Keep in mind that AMPL, CPLEX and Gurobi are commercial software.

Have you tried to do that with LibreOffice Calc Solver?
Microsoft Solver Foundation on Mono Framework could also do the job for you if you know C#.

Try Lindo/Lingo. They are not free, but you can try them.
They allow you to specify your problem in a very neat mathematical way.

You could try gnu octave - its a subset of matlab

I wanted to add one more option to the GLPK suggestions that #Ali has made. I suggest that anyone interested in solving LPs/IPs also look into the optimization packages that the R Language offers.
If you already know and use R, then it is just a matter of downloading the right package. And even if you don't, this is a good way to get introduced to R, which is really taking off in the analytics space.
This vignette is very good way to know which R packages are relevant.
For you, RSymphony or Rglpk might be the ones to start with.

Related

High Level language with Low level Graphics [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am looking for a high level language which will still allow me to work directly with graphics. I want to be able to modify screen pixels, for instance. But I do not want to write huge amounts of code for each operation. I want simple one line commands for graphics somewhat like those listed below. What are some programming languages which would have these features?
Possible pseudocode:
Screen.clear
Graphics.line(4,5,20,25).color=green
Circle(centerx,centery,radius)
Depending on what you want to do (ie, how complex do you need to get?) Processing is a very high-level, graphics-focused environment. Note, however, that it seems to be focused on the fixed function OpenGL pipeline, which is deprecated (though arguably the easiest and most intuitive way to get started).
Processing is built in Java, runs in web browser (or from your desktop), and abstracts most of the initialization and cleanup code required to use OpenGL.
Edit
I've just noticed your comment that says you're not an experienced programmer. In that case, I'd recommend starting with Processing. Once you get the hang of it, move on to Python.
Another, slightly more complex, option is Python. Python is very powerful, fairly easy to pick up (depending upon your prior development experience), and widely supported. It'll also allow you to use shaders and other features from the 21st century, and is cross-platform See this link for PyOpenGL, the first Python OpenGL site that popped up in google.
Then, there's C# + OpenTK. This can get pretty complex pretty quickly, but is very powerful, and since it's compiled (under .NET or Mono), can potentially give you better performance than Python.
Finally, for close-to-bare-metal performance, C++ is unbeatable, though arguably the most complex of these options, with a significant learning curve. However, most of the example code you'll find online is in C++, which can be an issue if you're not using C++ and aren't comfortable reading it.
Using Qt you can create QImage objects and draw on them usign QPainter.
You've of course pixel control using that abstraction level, but you can also access the underlying memory directly using bits() and bytesPerLine() methods thus accessing the image memory directly.
The format that is easiest to use to do fast special computations is in my opinion QImage::Format_ARGB32 with 32 bits per pixel.
Qt is a C++ library portable on may OSs and platforms, and bindings are available for many very high level languages (e.g. Python).

Fast (possibly approximate) linear programming library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I need to solve a sparse linear programming problem, and I am looking for a library for the same.
Primary requirements:
The most important requirement is that it should be very fast. A randomised approximate solution is acceptable, if it is faster.
LP specifications:
The size of the problem is a function of 2 parameters : P and Q, with P << Q most of the times.
No. of variables ~ P + Q
No. of constraints ~ 2Q
The constraint matrix is sparse - it has only O(Q) non-zero entries.
Solutions tried
1) MATLAB : The linprog function of MATLAB is not particularly useful in our setting, as it takes very long to solve the LP.
2) GLPK : glpk_simplex is also not as fast as expected - for a problem with P=15, Q=15,000, I need to get an answer in at most 10 seconds, but glpk_simplex takes 20-25 minutes. glpk_interior runs out of memory for a problem of the above-mentioned size.
Can anyone suggest some efficient libraries? Please suggest both free and commercially available ones, that can be used to solve the problem exactly or approximately.
Regarding other solver options, here are two SO questions that you should take a look at if you haven't checked them out already:
SO Question on which solvers to
use
Java Solver
Options
But the reason I am posting is that I have a couple of other suggestions for you, rather than going for the solver speed. (Something might work for Q ~ 15K in your problem, but if Q gets bigger, you will have to search for even faster solvers.)
Other suggestions to try
Have you played around with the solver options in either MATLAB or GLPK? There are quite a number of things you could try: Setting iteration limit, or Timelimit (to 10000 milliseconds).
Look into decomposing and relaxing your formulation. Typically, in these large LP's there is a nice underlying structure, but a few dense constraints play spoil-sport and those are the ones that give the solver trouble. If you can identify those, you can relax those, and maybe even throw it into the objective function with a multiplier.
To make it a little more concrete, you consider Lagranian relaxations for 'troublesome constraints.' (As one reference to what I'm referring to see how problem 12.3 becomes 12.4 here
after being relaxed. You can do the same for dense several constraints in your problem.
Hope this helps you move forward.

Graphical Programming Language [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
In control engineering or instrumentation, I see Simulink or LabVIEW(G) is pretty popular.
In ESL design, I see that Agilent SystemVue is gaining some popularity.
If you see the well established compiler theroy, almost 100% is about the textual language. But how about the graphical language?
Is there any noticable research or discussion about the graphical programming language? In terms of
Theory about Graphical Language - syntactic/semantic analysis and whatever relevant
expressiveness (Actually, I asked a question about it at SO - What do you mean by the expressiveness of a programming language?)
Possibility of the Graphical language
...
Or what do you think about the Graphical Programming Language?
DRAKON is basically a flowchart optimized for readability.
http://drakon-editor.sourceforge.net/DRAKON.pdf
There are editors that can generate source code in C, C++, Python and Tcl.
For example:
http://drakon-editor.sourceforge.net/python/python.html
I heard about one such language called DRAKON. It was developed for the Buran space project and now it seems to rebirth (language, not Buran =)). The only problem is that the most of materials about this language is in Russian. I'll give you some links anyway:
Article in Russian Wikipedia.
OberonCore forum DRAKON subsection in Russian.
DRAKON + Oberon = DRON visual programming language in English.
Wouldn't know anything about theory, but Lego MindStorms has a great graphical programming environment for programming the NXT robot toolkit (based on LabView components) that is extremely fun to use.
For kids it seems to be very easy environment in which to learn how to program by for example tweaking the functionality of existing programs or following instructions. When English (or any other written language for that matter) is not all that well understood the graphical environment makes it much easier to use than any written textual language.
The graphical language is perhaps "simple" in the sense that there is only one loop construct, one switch construct and a set of "high" level functions but i find it fit for the purpose.
From a slightly different angle, this is in issue tackled in the interfaces for graphical programming tools for creative use, such as MaxMSP and Isadora - it might be useful to see how they handle the issues involved.
Prograph is pretty cool - it's a general purpose graphical programming language and it uses a data flow paradigm.
See also Marten.
Quartz Composer presents a graphical interface for constructing image composition workflows. (I think that would be considered a "programming language".)
A little late but I can also recommend the IBM / Rational Rose Realtime (commercial). Be aware that it is something different than "Rational Rose".
http://www-01.ibm.com/software/awdtools/developer/technical/
http://nimotoons.com is a 100% graphical development language based on functional languages.
it is from UPC and still under construction
You should also try YAWL which has a pretty good background in workflow programming in a graphical way, you can see:
http://www.yawlfoundation.org/
See workflow patterns which is a really good theoretical basis, I think, to approach graphical programming.
You could try Cameleon: http://www.shinoe.org/cameleon which seems to be simple to use.
Its written in C++ but can call any type of local or distant programs writen in any programming language.
It has a multi-scale approach and seems to be turing complete (this is a petri net extension).
sheers,
Myosis.sh

learning from open source code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm a student and I have a lot of free time on this vacation so I decided to put some time in learn more about how to write good code.(All I know at this moment is C and some C++)
My question is about how to find some applications source code?
Let's say I'm looking for some source codes which are using a specific library. How can I find the open source projects which are using the library about I'm interested.
I've tried on google code and sourceforge but without success. I think i don't know how to search. Do you have any advice/link about how to do that?
There isn't a one-stop-shop for finding open source code.
If you want to read some well written code, GNU's Savannah is a browsable repository of the GNU stuff (Binutils, GCC toolchain and tons of others). The GNU software, IMHO is some of the best written C anywhere.
You could also checkout MINIX which is an open-source microkernel based operating system (which is POSIX compliant too).
The Gnome project has many projects that cover a wide range of languages from C to Python and even C# (FSpot).
When searching for a project, if you know the name, google should help. If not, search for the library on google such as "libfoo", or look in the metadata of the package manager you use (it often has the upstream maintainer's website).
For example:
[aiden#devbox ~]$ ldd /bin/ls
...
libcap.so.2 => /lib64/libcap.so.2
libacl.so.1 => /lib64/libacl.so.1
libc.so.6 => /lib64/libc.so.6
libpthread.so.0 => /lib64/libpthread.so.0
...
I could google "libpthread" to find that it is part of the GNU C Library
If you want to get involved in FOSS/C then learn to use source control systems like Git or subversion, and diff for making patches. Talk to people, they always want fresh developers to triage bugs and fix problems. But you will probably find a pecking order and a social ladder to climb.
GNU Savannah
MINIX 3
Gnome Projects
Git Distributed Version Control
Free book on Subversion
The Linux Kernel
Good luck and have fun!
http://www.google.com/codesearch is your friend.
If there are specific methods that you know are included in the library, then you can always search for those.
Alternatively, if the library has an irc channel or a newsgroup set up, then ask the question on there.
Have a look at "The Dragon Book" if you can find it. Spinelli's Code Reading is also good. Both will help you understand the code you're reading.
There is a one-stop-shop for finding open source code.
It's called google codesearch and searches in lots of open source projects.
To find code using a specific library, just search for the term you use to include it in code, for example #include <libusb.h> or import ipaddr.
Koders may be helpful. It is a search-engine for source-code.
Visit Launchpad.net and get in touch with the friendly Ubuntu Community. This is a good place to start cause they are not that harsh if you ask a question.
Scott Hanselman has a series on his blog called The Weekly Source Code which is worth checking out.
Four "easy" steps:
Select a free application you enjoy using
Think about a feature it lacks
Try to discover how to implement this feature
Do it
Point 1 and 2 will retain you doing things.
With point 3 you will learn how to download sources, read patches and understand the code of different people.
And with point 4 you will practise coding and, if you like, you can start to officially collaborate with the project :)

How can I make voronoi treemaps? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I want to make voronoi treemaps for statistics data, like
newsgraphy
Do you know how I can do that in Perl, PHP, Ruby, or Python?
Math::Geometry::Voronoi
Nice demos and graphics for Python: http://home.scarlet.be/zoetrope/voronoi/ (Archived copy at wayback)
Just found this page. I've been working on a Voronoi demo applet using Javascript/canvas, after translating into Javascript a C# version of Steven Fortune's algorithm by Benjamin Dittes (available at Code Project, see "Fortune's Voronoi algorithm implemented in C#"). Here is the page which include Fortune's Voronoi algorithm in Javascript:
http://www.raymondhill.net/voronoi/voronoi.php
This is a first iteration, I plan to adapt it further to be better suited to Javascript. Hope this helps.
First of all, the lines are not strange: it's the result of the fact that this is not a normal Voronoi tessellation, but an area-weighted Voronoi (AWT) tessellation, possibly even a centroidal Voronoi tessellation (CVT). That being said, in order to have Voronoi regions (polygons) with significantly differing areas (which would reflect some attribute of the data), you need AWTs (preferably implemented as CVTs to retain nice aspect ratios for the polygons); a normal Voronoi algorithm (as suggested by some people above) will not be able to help you. There is probably no direct solution for this available, especially not for scripted languages, since the computational complexity due to iterative updating steps for AWTs is quite high. You should look up the work on "Voronoi Treemaps" and "Dynamic Voronoi Treemaps" by Balzer et al. and Sud et al. to get an idea of the algorithm and then implement it on your own (everything that you need is in their papers).
the other Python answer seems to point at a raster only solution. I am also interested in solving this problem (in Python) and I think the following script could form a usable starting point:
http://www.oxfish.com/python/voronoi.py
(Archived copy at wayback)
James Tauber is writing a tutorial that uses JavaScript and Fortune's algorithm to draw a Voronoi diagram in a canvas element: Voronoi Canvas Tutorial
It's not complete yet (he's at part 3 of 4) but there's enough there to complete it I think.
The latest version (2.0) of Macrofocus TreeMap has the Voronoi algorithm as an option, among others.

Resources