LCS III: Java conversions of Delphi code from LCS III

Hi all,

My name is Mark L. Smith. I’ve been lurking the PCT community on and off for several years. I was a serial founder of software companies who’s retired early (and that’s my story until I start something else :P).

As part of my PCT studies, I’ve converted a few of the Delphi/Pascal demos from LCS III to Java Swing. For me, the “doing” of the conversion greatly increased my understanding versus the “reading” and “watching” of all the other good PCT resources.

I’ve included some animated GIFs of my work below.

I wanted to post here in case anyone else is interested in this.

Here’s the Crowd demo. It does read the same format files as the LCS III code.
Crowd

Here’s the arm tracking demo.
ArmTrackTarget

Here’s the inverted pendulum.
Inverted Pendulum

I also converted the C code from “CSG 9207A, Bill Powers, (920711.0800)”:
Reorganizer

Well done Mark, and nice to hear from you! What are you plans regarding PCT going forwards?

Howdy Warren,

I’ve been a “computer person” my whole life and became interested in PCT as a general problem solving paradigm. By “general problem solving” I mean compared to things like genetic algorithms, reenforcement learning, etc…

I know you’re familiar with Rupert Young’s work where he has compared RL approaches to PCT. He’s got a cart hill climbing example where a state of the art RL solution generates a solution that is hundreds of nodes deep and compares that to a superior performance PCT solution that is ~5 nodes in a loop.

The parsimony and performance of negative feedback loops is compelling. There’s a there there.

Where I’ve been trying to apply this recently is in betting/prediction markets. I don’t have anything to show here yet.

In support of that, I’m especially interested different reorganization algorithms. In Rupert’s example, he evolved that solution using genetic algorithms. I’m obsessed with the idea of the self bootstrapping negative feedback controller (“it’s PCT turtles all the way down”).

Terrific!

Yes, conceptually the reorganization system stands off to the side in a block diagram, but I think it is emergent from capacities of individual control loops to make adjustments to their own parameters when control is poor. This is a natural interpretation of the observation that reorganization is always effective at the location of poor control.

Neurologically, there is evidence that neurons want to interconnect and play together (viz. the observation years ago that nerve cells in vitro spontaneously extend branches and synapse with one another). Couple this with some kind of homeostasis process in the cell that makes adjustments when control error persists, maybe when a high rate of firing is prolonged. The neurons functioning in a perceptual input function (PIF) and reference input function (RIF) might be specialized for this. (A comparator is a PIF and RIF synapsed together.) This could account not only for changes in weights for existing means of control (lower level reference inputs) and forming of new branches making synapses to new RIFs below, but also for forming of new branches making synapses to new PIFs above, including higher-level systems for exploration and problem-solving. Two modes of learning, random reorganization and problem-solving, would have a common cellular initiation.

Hi Mark

Would it be possible (or feasible) to convert your java versions of the LCS III demos to applets so that they could be run in a browser? If so, maybe whoever is handling publication/distribution of LCS III could then let it be known that these web versions of the demos are available, which might increase interest in (and sales of ) LCS III.

And please keep me posted on how it’s going with your application of PCT to betting/prediction markets…just as a matter of intellectual interest, of course;-)

Best, Rick

To all:
If anyone wants this source code, it’s yours to do with as you see fit. I have no pride of authorship (convertership?) here.

Hi Rick,

I think running proper Java applets in the browser is now mostly infeasible (it’s not impossible but the hoops you go through to get Java in the modern browser now are much worse than just getting set up to run the code locally).

I’m only aware of one tool that claims to be able to take the Java Swing code I’ve got here and convert it to run on modern browsers. It looks costly and I’ve got no personal experience with it.

It’s one of those things where I think this might be a better (or at least additional) springboard for someone if they wanted to convert it to something that does run in the browser or a mobile app.

I’d like a copy of the source for the converted LCSIII demos. You can send them to me at rsmarken@gmail.com

Thanks!

That’s what I thought. I am not much of a programmer but I learned a little java back in 1995 and wrote some java programs (with a little help from my friends) when I learned that I could let people do some of my interactive PCT demos via a web browser. But I started running into weird security problems with those programs about 10 years ago and rewrote the demos in JavaScript (well, most of them), which worked fine given the exponential increase in computer processing speed since 1995.

Anyway, nice to have you contributing to discourse. The animated GIFs of your programs look great.

I’ve packaged up my work into its own project and targeted Java version 8 which should mean that if you have Java installed, it should certainly be new enough to run.

Here are some links:

Source code is here:
http://www.locatemark.com/pctjavademos/pctjavademos.zip

Compiled JAR file is here:
http://www.locatemark.com/pctjavademos/pctjavademos-compiled.zip

If you download the pctjavademos-compiled.zip, unzip, and CD into that directory, then you should be able to run like this:

Arm tracking demo:
java -cp pctjavademos-1.0-SNAPSHOT.jar com.brainopener.pctjavademos.armtracktarget.ArmTrackTarget

Crowd demo:
java -cp pctjavademos-1.0-SNAPSHOT.jar com.brainopener.pctjavademos.crowd.Crowd

That one randomly picks one of the original “per” files from LCS III or a blank field. Press space to reset the field and run again.

Inverted pendulum:
java -cp pctjavademos-1.0-SNAPSHOT.jar com.brainopener.pctjavademos.invertedpendulum.InvertedPendulum

Left click once to “wake up” the cart. Left click and hold to cause a disturbance. Right click to set the reference level for the bob at the end of the pole.

Reorganizer:
java -cp pctjavademos-1.0-SNAPSHOT.jar com.brainopener.pctjavademos.reorganization.Reorganizer

Thanks Mark.

This is going to take a bit of reorganizing on my part but I’ll report back to you as soon as I have things relatively under control!

Best, Rick

Hi Mark

I’ve tried to run your demos.

The Arm tracking demo works fine. But when I try to run the Crowd demo I get this message:


Do you know how I can fix this?

The Inverted Pendulum demo works fine. It reminded me that there is a nice inverted pendulum demonstration at the Exploratorium in San Francisco (a hands-on scientific museum developed by Robert Oppenheimer’s brother Frank) . I went there a couple months ago with my son and granddaughter (his niece) and had them do a mere demonstration of the disturbance resisting capabilities of the system controlling the vertical position of the pendulum. My son had to lift my granddaughter above the barrier in order to carry out the test, which probably violated the rules of the museum. But sometimes you just have to break a few eggs to make a good science omelet.

And the Reorganizer demo works but I don’t know to which demo in LCS III it corresponds. There are no graphics and it just produces a table that shows the solution to the reorganization:


From these results it looks like the reorganization found perceptual coefficients for 10 control systems controlling perceptions that are different linear combinations of the same 10 environmental variables. I think I remember seeing a demo like this, with graphics, but I don’t think it was in LCS III; at least I couldn’t find an equivalent demo in the book or the accompanying disk.

I don’t think I will have the time to try convert these programs to javascript. It would be great if you you would take on the job. Then these wonderful demos could be run easily via a browser on any platform. Right now it seems that both the original Delphi version and your java version have to be run on Windows operating systems.

Best, Rick

Hi Rick,

Can you tell me what version of Java you are running? java -version will reveal that.

I’m running Java 21.0.1 on my Mac but I set the target to Java 8. I may be overly optimistic that this latest Java can really target older Java VMs.

The Reorganizer demo is a Java conversion of the C code that Bill Powers posted to the Control Systems Group Network (CSGnet) on July 11, 1992. It looks like each message has a listserv generated ID and the one for that message is 920711.0800. It looks like it got loaded into Discourse here: Reorganization - #27 by William_T_Powers2 (make sure to click the 3 dots to expand the text — the C code is at the bottom of that particular message).

So that one is not LCS III but one that I moved over to play with as part of my own research on reorganization.

Hi Mark

It’s version 1.8.0_391, which I guess is version 8?

Thanks for the reference to Bill’s reorganization program.

– Rick

Hi Rick,

Alright… I think I’ve got this sorted.

I found a Java version 8 (1.8.0_392) and replicated the error you were seeing. And, I did find the right arguments to get my modern Java to really target Java 8 and verified that updated version works.

Updated zip files are here:
http://www.locatemark.com/pctjavademos/pctjavademos.zip?v=RbkflAoUg
http://www.locatemark.com/pctjavademos/pctjavademos-compiled.zip?v=RbkflAoUg

No Java source code changes. The only change was in the pom.xml file that controls the build process.