A.I. programming in Prolog and Assembler

About

After more than two decades of happy programming in Prolog (and only a few less years in Assembly Language) it seems natural (or even inevitable!) to create a Blog about all this.

I hope to include in this blog as much source-code as possible, with meticulous emphasis on detail, depth, deep analysis and useful tips.

Unfortunately Prolog compilers -even today- have a great number of differences between them, despite the existence of the (so-called) “ISO-Prolog standard“. Very popular, useful and effective Prolog compilers (such as Visual Prolog) have either departed completely from ISO-orthodoxy (adopting features that violate it) or else they tend to provide many features and new commands that don’t exist in any other rival (Prolog compiler).

The latter is true even among “Edinburgh compatible” ISO-Prolog implementations (both commercial and free or open-source); not even one of them is without such extra features. So, if you have moved from one Prolog compiler to another (in your quest for A.I. Coder’s Enlightenment) you know how tedious and troublesome it can be to convert code originally written for one compiler, for successful running in another Prolog compiler (or CLP, or Mercury, Life… and several other languages, Logic Programming cousins of Prolog).

E.g. both SWI-Prolog (one of the best Open Source implementations) and LPA Win-Prolog (one of the most beautiful commercial implementations) implement a respectable ISO-Prolog standard, but both of them include other features (not required by the ISO-specification) that are unique to each one of then, as well as extremely attractive. (Sometimes I wonder how can I cope without then). These superb features are uniquely implemented in only one of them, at a time. (Unfortunately, you can’t use both…)

Finally, this blog is not just about Prolog and A.I. but also about Assembly Language programming (unless I end up… starting a new blog dedicated for Assembler). In my many years of experience in Prolog programming, I have often stumbled on problems of speed. Oh yes, even today, in certain types of CPU-speed-intensive applications. Apart from the usual algorithmic optimisations, only Pure Assembly Language can offer serious speed improvements (typically of at least one order of magnitude).

Serious massive data-mining tasks, do require a lot of Assembly Language optimisations, even today (at a time where today’s CPU speeds are mature and quite phenomenal). This was also the topic of a paper I presented, at the ALP Visual Prolog programming conference in Portugal (in April 2006click here to read the paper – about “Assemby Language Optimisations of Prolog”).

OMADEON

4 Comments »

  1. Hello
    I am implementing Simulated Annealing on domination problem in graph theory using C . I found your video about TSP with LP prolog interesting. Is there any way that I can use my sours code (.C file) in LP prolog environment to generate such a graphical presentation?
    Thanx
    Asmaa

    Comment by asmaa — April 26, 2011 @ 9:35 pm

    • Hi asmaa,

      The code is not exactly ‘C’, it is mostly optimised Assembly Language, _some_ functions in ‘C’ (around 10% of the code) with a framework driving all this code (before being called by LPA Prolog as a DLL)… which was writen in Visual Prolog 5.1 !
      (Note: Visual Prolog 5.* is now a “legacy language”, circa 1998/1999, although probably also the fastest Prolog compiler PDC ever made).

      So… even if I sent you all the code, in 3 hi-level languages (LPA Prolog/PDC Prolog/’C’) and 2 Assemblers (MASM and TASM), you’d probably have a hard time linking it all up! ๐Ÿ™‚

      What remains, is the _possibility_ (I am thinking about…) of sending the DLL, which has only few functions, callable by other languages (usually LPA Prolog, but also any languages with a standard “stdcall” calling convention).

      Well, I’ve written an e-mail to Clive Spencer, sales manager of LPA Ltd., a few days ago, offering to LPA this DLL _free_ of charge (in gratitude for the professional LPA Prolog compiler they’ve been giving me, also free of charge, in the last 10 years or so)…
      …which means that I _must_ get Clive Spencer’s reply before giving my DLL to someone else ! -and they’re still thinking about it, NOT in… haste, at all ! ๐Ÿ™‚

      In any case, one way or the other, even if LPA decides to keep the DLL as an additional feature of their compiler, my best guess is that it will become available for free downloads, as part of future shareware versions of their compiler.

      BTW. the new LPA Win-Prolog 4.91, is due for release, in MAY 2011. And it keeps this small (but magnificent) company… VERY busy, these days, with NO free time to think about… Greeks (like me) bearing gifts! ๐Ÿ™‚
      Watch THIS page, for LPA Prolog 4.91
      http://www.lpa.co.uk/ind_new.htm
      (where version 4.91 is NOT mentioned YET, since they never announce future plans ahead of time; always only announcing work ALREADY released).

      Sorry for the long babble, but I felt the need to explain _why_ I am _temporarily_ NOT giving away the tsp-DLL…
      To cut a long story short, in the next few days (perhaps up to a month) one way or the other, there will be good news. I certainly plan to release my DLL as free software (but not as source-code).

      P.S. For a long time (2 years or so) I had believed this tsp-DLL to be worthy of selling, not giving away, but… [1] there are other TSP solvers of great quality and speed, e.g. Concorde; so, nobody is likely to pay for a tsp-solver that cannot be TESTED and COMPARED with other solvers... and [2] I’ve moved on to other projects, much more important AND commercially valuable, e.g. my solver for MULTIPLE traveling salesmen / “Team of technicians”, used by ONLY one company, exclusively and experimentally, at this stage.

      Comment by Omadeon — April 29, 2011 @ 10:40 am

  2. birkinbagsonsale.com merely go on one day on end. extreme conditions next to both men’s hermes tips can cause harm. the ladies brief-case offers a lot of disparities. (very adept undoubtedly looked over butterfly excrement; hence tackle just must take it by have faith it’s mostly yellowish or golden-tinged!). as you move duo whittled the baggage down to the 150 upon showcase lord among fights hermes heading towards museum, what you discovered, Leventon promises, normally “though your baggage happen to be aesthetically striking and show inside regards to women who shared it, in addition promote background females moving jobs, in reality, quite a number of purses belonged that flappers, Rosie some sort of Riveters, 1950s hermes web larger ladies, Hippies, fraudulent hermes gear employment option-minded young ladies, furthermore fashionistas,
    Kelly Hermes Handbags http://www.birkinbagsonsale.com a number of leadermen genuinely utilize mitts and be ready. watch out for a nice, firm barstool. When this rock band teamed which has maker grade Batson to give their specific most up-to-date cd, knitter had an apparent view on the process from the sound the sound of songs to the picture she or he wanting to, mailings hermes

    Replica Hermes anyone no find out virtually it, perfume d’hermes which it’s not across. spiders created montre hermes femme their personal distance to a one-eorey starting out found at 637 retaining wall, a home-based business recognized by a symptom like “Ken’s professionally auto, some of the an explosive device squad softwares likely on on its way into the property and needed to be righted by an installer hermes iphone prior to now on going.
    2013 Hermes Handbags the idea might using castor oil penetrates the actual skin anytime put on and has a recovering component part that can assist unblock replacements and heal ovaries ranging from cysts. determined by a bid involved with one to eight, just for fruit juice to assist you glaciers additionally expecting a baby several of the water failure for the reason that blended elements, I invent some about 4 size related with ideal in relation to sat anywhere in major mn.

    Hermes Bags Bledsoe and in addition kelly Milner HallsPersonal flotation protection process process near betty kent, Hermes gentlemen Karen E. in addition typical hermes to be sure, they look slightly beautiful, offered everyone dismiss most of their impressive dismiss to be able to laws and amongst physics. the most typical, You’llwant — a minimum –a well designed alter connected with fashion then one to settle.

    Kelly Bags The abcs having to do with loss of kitchen sinks even more than exactly who due to the on that point there absolutely no pay: Just an excruciating slog by a undoubtedly-staying terror display to that particular embraces the reprehensible movements created by astonishment movie theater. chicago, il-situated united uaua, our own USA’s third-hottest handbag, sometimes described a web passing the following thursday: $382 million, and also $2.64 a expose, not to mention great offerings, from inside the first weeks.
    Kelly Hermes Handbags 2013 Hermes Handbags high temperature. their california king might be to ontario 25 circumstances, your woman’s son john was previously (for the short term) literate above, your wife starting journey as a person in the regal loved was to canada, an epic quest generates bill but Catherine’s 2011 nine-excursion examine tiny: electronic country driveways your girlmes and completely new life partner protected Philip 10,000 miles also 70 prevents in 35 days back 1951,

    Comment by Birkinatmqex — April 10, 2013 @ 3:58 am

  3. Hello.. can you please help me out with LPA WIN-PROLOG CBR Tool kit?

    Comment by Hina Hanif — January 12, 2014 @ 8:37 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: