[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: spanningtree.png (113 KB, 1280x1034)
113 KB
113 KB PNG
What would be the appropiate language for scripting combinatorial algorithms? Performance is important because the complexity of my problems always is exponential and higher.

I tried Python but it was too slow and used too much memory unless the algorithm was already mostly implemented in a specialized library. C is good, but the writing is quite slow, and I have to reinvent the wheel for most applications.

Examples of things that I need to do:

1. Generate all the partitions of {1,2,...,n} satisfying some property.

2. Generate all the graphs that satisfy a given condition.

3. Concatenate a small collection of integer-valued lists a large number of times, in mostly random order.

So, the typical thing would be to iterate through a huge set of combinatorial objects and perform some memory moves and comparisons on their data.
>>
File: stare.jpg (36 KB, 318x318)
36 KB
36 KB JPG
Wolfram Language
>>
>>101554081
This is exactly what I'm doing, lol. Solving the TSP right now. Anyway, the answer is either C or C++. You can wrap them from Python no problem; it's especially easy in C. C++ has a lot of stuff built in, but if you want the absolute highest performance, that may be less helpful that you think. A lot of the things in its standard library are actually pretty slow, whether it's due to backwards compatibility or upholding properties that you don't care about in your algorithm. So you may still end up writing custom stuff or bringing in external libraries. For the highest performance, you'll probably want lots of control over memory allocation and deallocation too, so you won't use all the "modern" patterns. For this kind of code, the most helpful part of C++ is templates, really.
>>
>>101554762
This
>>
>>101554081
I would also like to get some other opinions on that. If you want to do symbolic calculations, Maple. Literally every other math focused language sucks, in particular Mathematica aka wolfram and sagemath. I've heard good things about the symbolic julia package, but haven't tried it enough to say too much about it.
>>
>>101554081
Java
>>
>>101554081
common lisp
>>
>>101554081
I've used c++ for a lot of dynamic programming and optimization work and it was probably the most straightforward. Yes Python is easier to write than c++ you are right but all the functions are obfuscated and the libraries honestly suck.
>>
prolog
>>
>>101554081
still C
>>
>>101554081
C.
C++ if you need templates.
With CUDA if you need parallelism.
>>
>>101554081
this is an interesting thread, why does g let it reach page 10 but e celeb drama last forever
>>
>>101559746
Most /g/ users are retarded. The board would be improved if 80% were banned.
>>
>>101559746
/g/ is for people who got filtered from (the on-topic part of) /sci/
>>
>>101554081
linear algebra
>>
You are looking for linear programming. Its not as gay as it sounds, its actually pretty cool once you get the hang of it.
>>
fastlisp is combinator based
>>
>>101560205
Yeah, linear programming can come in really useful for combinatorial optimization problems, but it can be kind of a pain in the ass to implement.
>>
>>101555872
there is literally nothing good that's oss. fuck stephen wolfram for making his shit closed, dumbass british schizo
>>
>>101560490
What is fastlisp? Fastest Lisp I know is SBCL, and that's just a normal dynamically typed lang.
>>
>>101560054
>(the on-topic part of) /sci/
tell me more about this, I only see sci being used for IQ and vaccine threads, I never see actual algo theory discussed
>>
>>101560851
well I'm not in /sci/ am I?
ask there
>>
>>101559746
/g/ is for people who got filtered from /ohm/.
>>
>>101560851
>>>/sci/16294582
>>
>>101560911
I thought ohm was from diy tho
>>
>>101554081
C++
>>
>>101554081
>Performance is important because the complexity of my problems always is exponential and higher.
C or C++.
>>
File: images (1).png (2 KB, 267x189)
2 KB
2 KB PNG
>>101554081
Haskell!
>>
>>101559746
How the fuck is it interesting? OP asks retarded question, replies to the thread say nothing of substance.
All the (You)'s this post received are literal fart sniffing copium on top.
>>
What exactly are you trying to do? If you’re devising new algorithms for your own use from scratch and is comfortable with python, take a look at pypy, it helps a lot on loop-heavy code.

If you’re building a package of new algos to be used by others, you probably want to use c++ as it’s the lingua franca for high performance, foundational software

But if you’re implementing existing algorithms to your problems, it’s extremely likely that there already packages implementing them, most likely in c++, but occasionally you’ll see new cool stuff in python, Java, R and other academically popular languages

Most likely your problem can be translated to integer linear programming, though, and if it’s solvable on modern hardware it’s worth the effort to learn how to use specialized software. GLPK and HiGS are popular open source packages for that, highs even being a dependency on scipy for a few years now

If you’re just doing homework and want something more fun than strictly performant, SML can be learned in a weekend and as all ML family languages can be fun to solve combinatorial problema with recursion and pattern matching. Also quite fast if you compile the code. Same for other languages of the family, like ocaml, f#, haskell and more recently flix
>>
>>101564835
Flix? Never heard of that.
>>
>>101564835
P.S. >>101565370
Can you redpill me on that? Why would I use it over other ML-family languages?
>>
>>101564835
I research in combinatorics, so I need to experiment with really specific settings. I gave some examples in the first post, but if you want something more concrete, the last time I had to generate all hypergraphs of certain type and checked if a formula relating the number of hyperedges and vertices was true.
So, it is not combinatorial optimization.
>>
>>101566487
Any particular reason not to use the usual languages for high performance algos, C and C++? Is it the need to do manual memory management? If so, try Java. Once it warms up, it's one of the fastest GCed languages for algorithms. Just be mindful of the boxed/unboxed distinction.
>>
File: F.png (5 KB, 256x256)
5 KB
5 KB PNG
>>101554081
>>101566487
>>101566595
Depends on whether you can recast your graph algorithm as a matrix algorithm (e.g. BFS is also a matrix algorithm), in which case you could even use pic related and call LAPACK, or parallelise the shit out of it if possible.
Otherwise I see no reason not to do C++.
>>
>>101554081
>C is good, but the writing is quite slow, and I have to reinvent the wheel for most applications.
C++ has everything you need.
>>
>>101566595
>>101566743
>>101566761
So C++ is the way.

Thank you guys



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.