Page 11 of 11

Re: SBASIC & C++

Posted: Mon Feb 01, 2016 10:35 am
by stevepoole
Thankyou Tobias,
Now all the malloc arrays compile and run OK.
Except that to transpose int distance[ARRAYSIZE][ARRAYSIZE] as you indicate, i get:
invalid types 'int[int]' for array subscript, when compiling with malloc...
There must be some special supplementary requirement to allocate 2D arrays in c++? (That is, how does the compiler know we want a square matrix?
Regards,
Steve.

Re: SBASIC & C++

Posted: Mon Feb 01, 2016 12:20 pm
by tofro
Steve,

dynamic multi-dimensional arrays (that is what you are trying to do) are hard to get by in C - To make things easier, it is nearly always best to allocate a single dimension and handle the multi-dimension on your own like

Code: Select all

// Allocate a two-dimensional array
d = (int*) malloc (FIRSTDIM * SECONDDIM * sizeof (int));
// access to element x,y
a = d [x * FIRSTDIM + y];
This is also what the C compiler would be doing internally - It is just harder to tell it to ;)

Tobias

Re: SBASIC & C++

Posted: Mon Feb 01, 2016 3:26 pm
by stevepoole
Many thanks Tobias,
The TSP now runs with as many nodes as there is memory to allow for.
Your help has been indispensable...
Steve.

Re: SBASIC & C++

Posted: Fri Feb 12, 2016 2:27 pm
by stevepoole
Hi,
I wrote a convex_hull routine in superbasic which uses little code, but whose running time is slugged as the number of nodes increases. (Printed as the TSP 'find_outers' in the Quanta magazine).
Does anyone have fast convex_hull code in basic or c++ that they would be prepared to share?
The TSP team are preparing the 'precise' TSP progam version for transcodage to c++.
The initial short TSP c++ version calculates 1000 nodes in one second, but is only 97% accurate. The latest version will also be much faster.
So far my attempts at fast convex-hull routines end up with excessively long code...and are buggy!
All suggestions will be appreciated...
Regards,
Steve.

Re: SBASIC & C++

Posted: Tue Jul 26, 2016 11:08 am
by stevepoole
The Travelling Salesman Program in SuperBasic has now been successfully transcoded into an _exe file, using C68 and Cfix. The process was not automatic, as the basic needed tweaking to recopile.

But C68 uses some specific functions to emulate SB ones, such as SB_scale, etc.
Our team is now adapting the C68_code into Cee so it will run on PCs with Borland BGI graphics.

Has anyone already rewritten C68 SB_FuNctions in Cee? If so would you be prepared to divulge them?
The TSP program will be released when the SB to Cee adaption will have been finished. Our team is steadily recoding the SB_FuNctions, but if this has already been done it would save us time...

Such recoded SB_Functions are, of course, reuseable for any C68 to Cee program conversion!

Regards,
Steve Poole.

Re: SBASIC & C++

Posted: Fri Sep 02, 2016 11:55 pm
by stevepoole
Finally the shrink team have transcoded the superbasic TSP code into C++. It runs around 200 times faster... which was the figure we have been looking for since the first posting on the subject. Now we can compare shrink to other heuristic programs running on pcS with Borland Graphics. And initial results look very good.
3 years of work have gone into the program, After a full testing cycle, we should know its full potential. More news will appear as soon as a windows version becomes finalised quite soon. Release dates have not yet been decided.
Thanks to all the parties whohave contributed advice and information on this forum.
Shrink shows that major research prottypes can be developed on QLs in basic, and later transcoded for the pc world.
QL Forever...
Steve Poole.

Re: SBASIC & C++

Posted: Sat Sep 03, 2016 10:23 pm
by NormanDunbar
Well done Steve, and team.

Cheers,
Norm.

Re: SBASIC & C++

Posted: Sat Sep 10, 2016 6:06 am
by stevepoole
Hi,
Shrink C++ TSP has now been tested on a middle-range 64-bit laptop.
Formerly 200 times faster than superbasic on an old desktop machine, it , is now 400 times faster.
C++ is so very fast, but without superbasic, C68, CPort & Cfix, shrink would never have been written...
QL Forever!
Steve Poole.

Re: SBASIC & C++

Posted: Wed Jan 03, 2018 6:53 am
by stevepoole
Hi,
The 'SHRINK' Travelling Salesman Program' was finalised some months ago, and an article describing its development appeared in the nov/dec 2017 Quanta Issue.

A short demonstration video can be seen at : https://1drv.ms/v/s!AiyNuhEqpD_Xlz1u3WMVeLJQrOgM

If anyone would like to see the code, please let me know, and we will consider posting it on the site...

The program is actually being assessed by major software houses, as it has broken new ground....

Regards,
Steve Poole,
(for the Shrink Team).