Poplar Decisions

One of my colleagues, let's call her M, has a rather deep dislike of toes. At least that is the conclusion I would draw from the frequency with which she steps on them. It is not that she is malicious, but as she strives towards an unachievable level of perfection casualties are inevitable. Her frustration with one less enthusiastic or less intelligent (I like to think I am just "more chilled") is also just as inevitable. Suffice to say, I have to wear emotional boots with steel toe caps to meetings where she attends wearing her ideological stilettos.

While I am suitably armoured, other colleagues are less protected. Ash, (the poor fellow) providing a verbose and detailed outline of a problem he was facing, stood no chance.

Data Structure

"If you can't decide," M said helpfully, "you have either got insufficient data, or insufficient competence...which is it?"

"My problem is that I know a number of possible actions I could take, there may be others I haven't considered, and I am really not sure which way to proceed," said the chap, not knowing the danger his pedal digits were in.

"Perfect," said M to me, "lack of both data and competence."

"Come come, Ash," I intervened, "you can only do one thing at a time. Go with your gut. You will either get it right or learn for next time",

"'Go with your gut?' what kind of advice that?" M turned on me, "Surely at least some effort at objective analysis is better than an irrational decision based on what you ate last night?"

"M, the poor guy is just trying to apologise to his girlfriend. Whatever he does, chances are he is going to get it wrong, trust me." Ash's tactics typically reflect his passion for Liverpool Football Club, which usually dampens any kind of passion in his better half.

"Worst of all, I am not quite sure what I am apologising for, and I am too scared to ask." Ash would have wrung his hands is despair, if he knew what that meant, but his pain was obvious. "But, I have made a start. A list of options, to be analysed with estimates of cost, time, cheesiness, potential to backfire, humour etc...most of which remain as yet unknown"

"Your strategy should start with a tree said our resident know-it-all. "and there are many to choose from"

"Poplar?", I suggested.

"Very," said our sage, "Rational deterministic decisions are based on them, as opposed to non-deterministic ones, which rely on 'gut' or other obscure hidden black-box calculations, or a large database search which is both inherently incomplete while at the same time has data duplication. Trees are also easier to map to a reasoning engine".

"Sounds good," I countered, "but I suspect that there are more non-measurable and variably consistent parameters that shape the potential girlfriend-response-space from any decision that is made."

M turned sharply at me, making me instantly recoil "Excuse me?".

I quickly re played my words in my head...had I accidentally suggested that there may be gender-specific interpretation of rationality? No, no, no...I better stay quiet.

"A Tree can classify the options, with each branch offering up weighted sub options. A tree that is flexible,...", M continued.

ash tree.png

M was on a roll, and we could just stand by, admire, and tuck our feet well under our chairs. Perhaps only a woman can truly understand another woman, and here is one trying to illustrate the remote possibility that, in truth, there is a genuine reasoning model underlying female thought. Ash and I gave each bewildered glances. Easier to explain the off-side rule we both thought silently.

Choosing a next move, whether it is what you need to say, buy, do etc is directed by that neural network that resides between your ears. Often it is modulated by other human or electronic neural networks driven by desires/designs to help you, exploit you, or even change you. The inner workings of these are often difficult to explain in the context of the domain of your decision dilemmas, but in the end something is chosen. Trees can help classify the problem , rationalise and add objectivity to the otherwise obscure algorithmic mechanisms based on statistics, thresholds, and digital noise in a structured systematic way. Perl is not short of modules that deliver this kind of data modelling, but it is trivial to "roll your own" use-case-specific module with abilities to add weights, serialisation/ deserialisation, restructuring, visualisation methods etc.

Masters of Destiny

Doomed

It is an unfortunate fact of life reflected in the stages of man, that we start off facing problems looking to others to solve these problems. Later we learn to solve these problems ourselves, we teach others to do the same. After that we delegate problem solving to those we have taught but find that as our own capacity diminishes, those that come after us simply ask an AI to do that which we struggled to learn in the past. A steady spiral ensuring future humanity’s cognitive decline, fuelled by the genius of its ancestors. We had become masters of our destiny only to hand it over to machines, because we hope machines will do it better. Perhaps they will.

In my job, tools that were created to make our job easier demand data from us, enforce protocols and are the exclusive conduit for information. Thus in our so called “caring profession”, the modern doctor spends as much time staring at a monitor as looking at patients, more hands on keyboard than hands-on examination, relying more on scans than an unreliable clinical acumen. Indeed this future may be safer and it is foolish to value old system of compassionate care delivery just because dispassionate algorithms have dispensed with the need for a human touch.

Clouded Judgement

Enter one of my newest colleagues; let’s call him Waq. A gentle giant of a youth, who looked like he could beat you to a pulp with a cheerful handshake. This big-brained surgeon whose head was always in the clouds, had discovered LLMs residing in those clouds and wished to bring them to the reach of the lesser mortals such as myself.

“I know what you need!” he announced. Of course I knew exactly what I needed, and it didn’t involve a smart-alec youth (even if he is 8 feet tall, with arms the size of my thighs) telling me.

“Oh, hello Waq”, I said putting on my well-practised fake sincerity, “I was just hoping you would come along and tell me.”

Waq didn’t need any encouragement, seeming to derive an unending supply of enthusiasm from the ether, “You need A Cloud”.

“Goodness, you’re right!” I said, “A Cloud, you say? Lenticular or Cumulonimbus do you think?”

“You know how you hate AI and think it will take our jobs, end the world and so on?”

“I have seen Terminator, Waq”, I said “Of course I know what’s coming.”, with visions of Waq revealing himself as a cyborg with living biomimetic skin grown over a metallic endoskeleton.

“A Two-Way Interface for a Dynamic Digital Learning Experience and Deterministic Encoding of Expertise”, he declared. “Now this will use experts to encoding their knowledge, experience and available evidence in a form that be used to train other individuals, rather than rely on some dependency inducing neural network on a server somewhere.”

TWIDDLE-DEE? Twiddle dumb, I thought. But this was going way over my simpleton head, “Ah…and how is this better than, I don’t know, something archaic, say a textbook?”

Waq’s face clouded over, “Well it will have a Cloud, be Digital, Dynamic, and Deterministic.”

“Did you ask ChatGPT to come up with this?”

Waq realised how easily he had fallen fell into the trap created by an AI that was not above subterfuge in the guise of being helpful.

“It’s ok, Waq.”, I consoled him, “This is exactly why you should watch 80s Sci-Fi on VHS tapes instead of adding to the training dataset of those silicon cybernetic systems planning to take over the world.”

“It’s too late, isn’t it?”

I would have patted him on his shoulder if I could have reached it. But an idea struck me. There is another kind of cloud that could be useful. “The future is not set, Waq”, I said, “You’ll be back.”

Interactive Word Cloud

Examples of Word Cloud Generators abound on-line. While useful for one off projects, for flexible and easily configurable it is handy to have a module for your own language of choice. MetaCPAN has a couple of options. c0bra(Brian Hann) created Image::WordCloud to generate raster Word Cloud Images. It is rather clever, depends on SDL to determine the dimensions of a word to create a attractive word cloud. Sarah Roberts created HTML::TagCloud to generate HTML Tags.

textcloudhtm.png

I am developing yet another option, this time using addressable elements to generate Word Clouds in svg and html. This potentially allows dynamic manipulation and interaction with the cloud. One possible goal is to develop a deterministic tree connecting multiple such word clouds as part of an expert system.

My early effort is CloudElement

Beware of Geeks bearing Grifts

Every year we “welcome” a new bunch of trainees into our department. Young, intelligent and enthusiastic, their psyche and physique have yet to be shaped to accommodate cynical scepticism, efficient laziness, and an integument thickened by years of abuse into something that offers natural protection from radiation emanating from the monitors they will stare at all day playing Solitaire.

One such fellow, let’s call him Nik the Greek, came up to me with that sickening joie de vivre characteristic of youth, and proceeded to reveal how eager he was to demonstrate his enormous intellectual assets. I would have raised an eyebrow, had I the energy to do so. But been there, done that. I was once his age I suspect, though either I can’t remember or have developed a block to my memories as an act of self-preservation.

“I can program in Perl!” he said. “What do you think of this idea, that will transform all our disorganised operations into something cohesive and integrated and replace all of the old, legacy, clunky, cruft cluttering everything up.”

By cruft, I knew he meant me. Thank goodness, I thought, someone here to finally put me out of my misery.

“Sounds exciting, Nik,” I said through inwardly gritted teeth, “do show all.”

“Here is an NDA you will have to sign first.” This nutcase was almost well prepared.

I duly signed the papers.

“I have created a Super Manager; a task segmenting, randomising, redistributing and self-re-synchronising algorithm for heteregenously competent processor architectures”

“A manager, eh?” I mumbled, failing at my feeble effort at feigning comprehension, “Random allocation? Heteregenous competence? What on earth are you taking about?”. Sounded vaguely like our management to be fair.

“LISTEN,” frustration bringing out a maniacal demon in the otherwise mild- mannered Nik, “Suppose we have a number of jobs to do, let’s say 4. Suppose each job has any arbitrary number of component operations, say 13. Operations are completed by processors. A system with multiple mixed hardware resources each with different processing power have to handle these operations , each with different processing needs and priorities. My manager randomly rearranges all the operations of all the jobs, and distributes them to available hardware processing resources. The processors have no way of knowing in advance what the computational needs or priorities are of any set of operations that will be allocated to them. Operations may depend on other operations, but in the end all jobs have to be completed, each with their component operations completed in order”

“Ingenious,”, I felt obliged to say, “and you have an algorithm that does this?”

“Well it does get stuck sometimes, and whole process randomisation and redistribution has to start again, but hey this is emerging technology!”

“Replace ‘jobs’ with ‘suits’, ‘operations’ with ‘cards’ and you have a computer that can play Solitaire”, as the realisation of my imminent redundancy hit me; the cruft that I am will soon be replaced by an algorithm.

Perl already has modules that can represent Games::Cards in a very comprehensive manner, play and analyse solitaire , in its various forms. Tk Interfaces are available. It would be nice to do so as part of the PerlayStation Games Console, as I continue to learn modern Perl OOP myself. So once again I am trying out Object::Pad, in developing a simple set of modules that will allow Decks and Cards to be handled and displayed, possibly animated interactively in a Terminal Window. This will not enter CPAN as there are already the well established and mature modules mentioned above but merely be a path to more experiments. Shlomi Fish comments that “a solver ( … ) is too CPU intensive to be adequately done using perl5”. But hey, if Nik the Greek can do it…

The sculpture shapes the sculptor.

Parenting aint easy. Certainly it is often something your kids teach you. Even worse, it often starts with “<INSERT_KIDS_FRIENDS_NAME>’s dad lets him do <INSERT_CURRENTLY_PROHIBITED_ACTIVITY>”. In this constant battle to shape your offspring into a model citizen, with the values you value, and turning him/her into a self-sustaining organism, one applies tools that enhance particular features, remove the superfluous or the undesirable.

Yet every action, it is said, has an opposite and equal reaction. So it is unsurprising that when one tells a child *not* to do “something”, the natural neural triggers in the child’s brain ensure that that “something” will be done; if one encourages a particular activity for personal development, that task is instantly seen as boring and burdensome, and there is an immediate reflex deployment of many avoidance strategies. The situation is actually worse than it appears. For while you may have some illusion of power to manipulate your child’s development, there is at the same time, a stealthy manipulation of your own choices by your child. While trainers from one store may look, feel and work exactly the same as in another while costing an order of magnitude more, these manipulations transiently distort your own understanding of value, in favour of your child’s.

Suffice to say, I am a cheapskate: won’t pay money for CAD tools, (or trainers) and use only Linux. I am constrained in my ability to accept change: won’t use Python and FreeCAD. I try and bend my life to my will. Yet in trying to do so, I change, I waste time, and life goes on as before, impervious to my efforts. Rather than using available tools for developing 3D objects using a GUI, I thought it may be possible to sculpt 3D objects using Perl. I have taken great deal of inspiration for EWILHELM and NERDVANA who have made efforts to bring CAD to Perl programmers. My own recent efforts attempting to twist OpenSCAD (“The Programmers Solid 3D CAD Modeller”) to work with me using Perl are ongoing. I can use Perl to create OpenSCAD scripts fairly easily: CAD::OpenSCAD is the result. This module can generate said scripts and do almost everything that basic OpenSCAD scripts can do, with some Perlish enhancements.

It is helpful for me: I now able to generate complex gears more easily than in my old CAD tools using Perl by leveraging OpenSCAD’s ability to do all the heavy work. But most of these might have been possible using the OpenSCAD scripting language alone, without Perl.

But I needed it to be better. OpenSCAD has limitations. The shapes it uses are not “self-aware”. I can change an object’s shape, location and orientation, but can not query that location and orientation. The points and facets of the shape are not accessible. It is also slow for complex tasks. But the programmer might be able to create an object that allows these parameters to be accessible. To mould CAD::OpenSCAD into something more useful, I could use Perl to create all the points and facets of an 3D object, in the form of a Perl Object. These points can then be manipulated to sculpt the polyhedron, poking dents into that shape, or pulling part of its surface outwards. The Perl Object can then generate the 3D script with these modified parameters, for consumption by the hardworking OpenSCAD backend.ScadHead.png

But as I do this I find myself learning about 3D coordinates, facets, structures and their manipulations. The difficulties of the past are replaced by new ones, deviating me from my original goals. Talking about which, can I just ask, will designer trainers really help improve grades? Asking for a friend’s parent.

3D Object Scripting using OpenSCAD and Perl

Control. That’s what we all desire and very rarely acquire. The natural restlessness that occurs when you watch one of your offspring flicking from one movie title to the next, barely glancing at the summary before rejecting it, is one of the reasons I don’t like family movie night. My daughter’s grip on the remote is as strong as her decision making skills are weak; I struggle silently to hold back any outburst that would expose my failing parenting abilities once again. I have to distract myself with thoughts of the good old days when the TV had only 4 channels and Teletext was the closest thing to internet. Desiring such regression is now getting much of a habit for me. But we change what we can, accept what we can’t and trust, often foolishly, that those blessed with control do the best for all of us. Ah, look. Another teen fantasy horror romance movie. Thanks a heap, Netflix.

It is no surprise that we seek this control in many things, in work, in politics, in family life, in code. Other people satisfy this need, making powerful tools that does everything one might want; thank you guys, you are legends. But even so, this appears not enough. I occasionally try 3D design and use cleverly engineered CAD tools to make useful shapes with my clumsy gestures on a mouse and clicks on a keyboard. Occasionally I try my hand at coding in Perl. Perhaps I could blend the two. Both Perl and OpenSCAD are scripted tools which themselves can produce textual yields. Python is already used to enhance OpenSCAD, and there is perhaps no reason for Perl to match or even exceed this capability. It should be possible to generate .scad files and even post-process the STL files that follow.

CAD::OpenSCAD is a module I started recently. A simple tool that can generate .scad files in a Perlish way. I also used this to learn Object::Pad but in way that will be open to criticism I am sure. I avoid signatures to allow for polymorphism. I avoid multiple classes for for now simplicity until it is more clear what a final class structure should be. Experimenting with this has been interesting. What has been fascinating is is how easy it is to generate scripts that can let another program do all the heavy lifting. But this is a project in its infancy; I have barely scratched the surface of OpenSCAD can do.

image

OpenCASCADE is another interesting project being explored, this time by Michael Conrad, introduced to me in a Reddit post. His work has just demonstrated to me how little I know. OpenCASCADE has many features not available to OpenSCAD. Indeed, there are many CAD tools that are more capable; I am hoping that its scriptabilty, and a hybridisation with Perl would allow more sophisticated features for programmatic object generation and data visualisation.