Question

Locked

Assistance in choosing a programming language

By jelormd ·
I'm a psychology student currently trying to redo an experimental AI program; a neural net style approach to creating an autonomous agent. I need help finding a programming language to suit my particular needs, as described below.

I've had a fair amount of experience in programming, mostly in Basic and VB. I began writing a program in VB two months ago, but after ~45k lines (barely halfway through) it began to get real slow. I need language I can learn fairly quickly and use to re-impliment the program. I'm not interested in converting code, I simply want to start over in a language which won't stall on high workloads. I've looked into some languages like Lisp(ported onto Windows), I have no idea how to graphically maneuver around C, and have been through a whole bunch of other well meaning distractions, but all the technical terms are just Greek to me. It's only taken me about about a month to think about asking Techrepublic for help.

I'm pretty sure there are many more qualified programmers to handle this job than myself, but for the purposes of experimentation it's better I write the program myself from scratch, so I can fine tune it.

Here are some details which might help to understand my situation:

* I'm running Windows Vista Home Basic on a Dell Inspiron 1501 with AMD Turion 64 X2 Mobile dual core ~1.6GHz, 1Gig ram

* Program was written in Visual Basic 6.0, length approx. 45,000 lines.

* Program writes output to 18 .dat files, the largest of which tends to be +20Mb.

* Neural info in these files is stored in byte sized allocations, meaning the program needs to cycle through all 20Mb several times/sec checking for certain values in order to access and modify specific neural data.(I'm guessing this contributes largely to my problem)

* When the program is fully functional, I can only expect the collective .dat files to eventually exceed 50Mb each(I have no idea if that's even feasible, but this is an experimental software so I intend to push the limits)


* The program uses a 2D graphic output in the form of a grid. It was cakes to do this in VB, but I'm completely clueless in most other languages, particularly the largely text-based ones.

That's the most important information. I would greatly appreciate contributions from the community. I realize I have quite a bit to learn, so I'm only asking to be pointed in the right direction, and I'll take it from there. There is far too much information around for me to make any sense of. I simply need to find out which programming language/s (and possibly computing infrastructure) will best suit my needs.

This conversation is currently closed to new comments.

11 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Answers

Collapse -

C, data structure, pointers, etc

by helder.velez In reply to Assistance in choosing a ...

If you actualize just few data among a huge data problably maintaining an index with references (or pointers) to such data could help, even in VB.
Consider using C in the core where you define data structures carefully and perform the calculations.
Eventualy write output to files and use another program in VB to do the graphics.
Use pointers to loop thru adjacent data.
Make a test to see if accessing a single byte is slower than accessing an int.
In VB it's dificult to implement pointers, and it's much slower.
Without pointers every access to an element of an array is done using an underlying multiplication and with pointers only an add is performed to reach the next element.

Collapse -

That's a bit much...

... remember, this gentleman is not a professional programmer. :)

Lisp is a good direction in general for AI related items. I think your biggest issue, from what you have described, is partially the VB 6 language (move up to VB.Net, at the very least), and partially the way you are handling those dat files. If you are constantly writing and reading to the disk, you will get very slow. Try to keep them in memory. 360 MB RAM usage (18 dat files * 20 MB each) sounds high to you, but it really isn't. Right now, I have a piece of code running in the background on my PC that has over 1 GB allocated to it, and my PC is still running pretty smoothly. Windows XP and Vista (and 2000, for that matter) react much better than 95 and 98 did to huge memory allocations. If you find that using this much RAM causes the OS to hit the swap file a lot (a file on the PC used to supplement physical RAM, you'll know that you're hitting it if the hard drive light is thrashing, but all of your data is in memory and you are not actively reading or writing the disk), spend $40 on some extra RAM.

The next thing you need to do is to parallelize (multithread) this task. You have a dual core CPU. For your needs, this is a total waste for you. The sad secret on dual core PCs, is that each core runs a bit slower than the single cores from a few years ago. For example, my Intel Core 2 Duo E6600, considered a very top end CPU a year ago, runs at 2.4 GHz per core. Compare that to the 3.4 GHz single core Pentium 4 CPUs from not too long ago. Of course, I am sure that each cycle is more efficient, but at the end of the day, this is a *slower* CPU for a single-threaded application. Your AMD CPU is going to have the same issue. Without multithreading this application, you can grab at best 50% of the available CPU power, effectively doubling the amount of time it takes to run your task (assuming that it is CPU intensive). If you see that your CPU usage is at "50%" for this task (check Task Manager by running "taskmgr", or download "Process Explorer" from Winternals) that really means that you have 1 core maxed out and the other is idling. Multithreading the app will let you hit 100% CPU and cut this task in half.

Definitely move up to VB.Net though, it handles the large data much more easily (and better!), and can do the multithreading. You can download an "Express Edition" of Visual Studio for free from Microsoft which will let you write VB.Net code. In addition, once you are in .Net, you can do things like use F# (a functional language, similar to O'Caml) for certain tasks, and it can talk both ways with the rest of the code, quite seemlessly.

Hope this helps!

J.Ja

Collapse -

Programming language

by g.dombrowski In reply to Assistance in choosing a ...

The best choice would be Power Basic
see www.powerbasic.com

It is a modern 32 bit basic and is much faster than VB and a lot less expensive.

I have seen on the PBCC Forum some discussion
about neural network and many members gave help on that subject.

You will not find Power Basic hard to learn as most VB commands are supported.

Collapse -

I agree with others that you can probably stick with a flavor of basic

by jslarochelle In reply to Assistance in choosing a ...

As you suspect (and as Justin pointed out) optimizing your file access is probably your best bet at getting this working properly. Keeping your files in memory will be a key factor. The question is: what process is updating the files ? Is it another program or another thread in your own program ? If a thread in your program is doing the update then you could manage most of this in memory. If another program is doing the update then you should look into modifying this program to add a hit count for each file and reload only the modified files. Another option might be to have the program doing the updates log the modifications in an intermediate file (each entry in this file would be: index, updated data). The large files would be used to initialize at startup but after that your program would only need to update the data in memory based on those smaller log files.<br/>
Switching to another language will not give you the performance gain that this kind of modification to the code will give you.<br/>
Good luck<br/>
JS

Collapse -

One More IMPORTANT Note!!

by tjbtech In reply to I agree with others that ...

I agree with most suggestions here - namely...

- Stick with VB. Another language is unnecessary, especially considering VB is what you know best. PowerBasic is completely excessive, as you already own a VB compiler.

- Optimize your file access and memory management.

- Use parallel processing (with multiple lightweight threads) to your advantage.

One more thing: Considering your sophomoric programming skills (no offense intended), I would analyze your code for unnecessary loops. I suspect that, because your small program (45k lines) is running so slowly, the language has little to do with its performance, relative to poorly written algorithms. Bone up on the fundamentals of algorithm analysis, and you will see your code in new light. Your code will be much happier!

Collapse -

agreed, on the basic premise

by apotheon In reply to One More IMPORTANT Note!!

The key point you should be getting from all the responses here is that a good algorithm will probably speed up your code a lot more than switching languages. If you want performance, something like C or OCaml would be a good choice of language -- but if you just port a bad algorithm to a new language that performs better, you aren't going to get a whole lot of benefit out of it. Your bottleneck is probably in I/O, not in the language's CPU-intensive execution time.

. . . and, as Justin pointed out, even if it is in CPU-intensive execution time, you'll get a bigger boost to speed learning how to leverage threading or process forking for concurrency than you would out of just trading languages and doing the same linear, non-concurrent programming stuff you have been doing in VB.

There's a lot of other stuff you can do to improve your programming environment for this sort of work. For instance, an OS with less resource overhead can free up more resources for you to use in your software, and a language that provides better iteration constructs can improve not only performance but your ability to crank out good apps with good underlying algorithms more quickly and with less fuss. Ultimately, though, the key to the problem at hand is almost certainly learning more about programming in general, so you can implement a better-performing algorithm.

You can learn a programming language in 21 days, if the Sam's books are any indication. You can teach yourself programming in ten years.

Knowing a programming language and knowing how to program are unfortunately not the same thing.

Collapse -

Dive into Python

by akhasha In reply to Assistance in choosing a ...

Looking at your requirements I think Python may be your best bet. Among the goals it takes seriously are clarity and consistency. Its a very dynamic language that was originally aimed at teaching and is still a good match for that.

When it comes to speed, Python offers many libraries that are written in optimized C, such as Numeric and SciPy, so you shouldn't have a problem there. There are a bunch of free Python development environments and it has an interactive mode that's great for trying out ideas and is reminiscent of the basic command line of yore. And unlike VB it is cross platform.

http://python.org

Collapse -

tunnel vision

by apotheon In reply to Dive into Python

"Looking at your requirements I think Python may be your best bet."

Repeat after me: "Python is not a panacea."

When all you have is a hammer, everything looks like a nail. (Of course, when C++ is your hammer, everything starts looking like your thumb, but that's another matter entirely.)

Collapse -

MASON or JASON Multi-Agent Simulators , JOONE neural

by helder.velez In reply to Assistance in choosing a ...

MASON Stands for Multi-Agent Simulator Of Neighborhoods... or Networks... or something...
explore, with the Start Button, at site:
http://cs.gmu.edu/~eclab/projects/mason/#Screenshots

This is a platform for social networks, in JAVA (mainly for programmer oriented guys)
very powerfull but not neural type

JASON is a platform multi-agent, implements the language AgentSpeak(L) (extended logic programming)

JOONE , platform to develop neural nets
http://linux.softpedia.com/get/Science-and-Engineering/Artificial-Intelligence/Joone-1256.shtml

http://www.heatonresearch.com/book/programming-neural-networks-java.html

As you are a psychology student then ...use and reuse what as been done in the area of neural and multi-agent.
If you have new ideas to test I think it's preferable to join some student of IT to do the program.

For almost 30 years I've been a programmer and used a lot of languages. Started with Basic but soon discovered that language is not suited for all kind of problems. With respect for other opinions

Collapse -

Thanks for the help

by jelormd In reply to Assistance in choosing a ...

A lot of people have suggested that the problem is an I/0 one and that I should try memory mapping, so I'm going to try that out first and see what results I get. Thanks for all the tips.

Back to Desktop Forum
11 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums