7 votes

What programming/technical projects have you been working on?

This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's interesting about it? Are you having trouble with anything?

6 comments

  1. [3]
    DataWraith
    Link
    In keeping with my usual modus operandi of trying a thousand different projects without sticking to any of them, this week I've implemented a Hayek Machine (PDF) in Python. Named after an...

    In keeping with my usual modus operandi of trying a thousand different projects without sticking to any of them, this week I've implemented a Hayek Machine (PDF) in Python.

    Named after an Economist, the Hayek machine is an evolutionary algorithm that can be applied to what the authors call "ultracomplex environments", though it is known to be somewhat difficult to make it work.

    Mine doesn't seem to work very well so far, but the concept is interesting, so I thought I'd post about it.

    As far as I can tell, the Hayek machine was introduced in a paper called "Toward a Model of Mind as a Laissez-Faire Economy of Idiots", and contrary to normal genetic programming systems that are modelled after natural evolution, the Hayek machine is patterned after an economy where corporations create and invest in other corporations, and receive a share of their profits in return.
    The machine mainly consists of a marketplace, where programs bid for the right to act in the world. At each step, the winner of the auction pays the previous 'owner' of the world and can then act in the world (and collect its rewards) for as long as it deems it profitable to do so. Then it auctions off the right to act to a different program.

    Whenever an agent crosses a wealth threshold, it is allowed to create a new agent (through mutation of its program) that it endows with an initial balance from its own coffers. One important property of the Hayek machine is that wealth is conserved -- money does not enter or leave the system during normal operation, with only two exceptions: rewards from the environment increase the overall wealth of the system, while taxes on computation have to be paid for every CPU instruction an agent executes in order to encourage parsimonious use of resources. Ideally those two forces should balance out over time to keep the system in a steady state.

    In theory, the society of agents/corporations/idiots should eventually self-organize and specialize through the bidding process to solve the problem the environment poses. In order to do that, agents need to evolve to bid accurately; if they bid too low, they are outbid by someone else (and eventually starve due to the small tax on computation), and if they bid more than the interaction with the world is worth, they lose money and may eventually go broke. Agents that go broke are, of course, removed from the economy and are thus no longer part of the gene pool.

    My Python implementation uses Linear Genetic Programming to represent the agents' bidding strategies (actions are fixed at 'birth'), and I set it to work on the LunarLander-v2 environment.

    Unfortunately, in all of my attempts of fiddling with the hyperparameters so far, the economy imploded eventually.
    Practically all agents die off because the environment can and does dispense negative rewards that decrease the amount of money in the system, which is contrary to the original design; I'll have to figure out how to limit the damage done by negative rewards (naively clipping them doesn't seem to work), or try to find a different environment that simply does not have negative rewards.

    4 votes
    1. [2]
      joplin
      Link Parent
      That sounds really cool! I never thought of making a program work that way. Now it makes me wonder what other ways we could make evolutionary programs that aren't genetic or economically-based?

      contrary to normal genetic programming systems that are modelled after natural evolution, the Hayek machine is patterned after an economy where corporations create and invest in other corporations, and receive a share of their profits in return.

      That sounds really cool! I never thought of making a program work that way. Now it makes me wonder what other ways we could make evolutionary programs that aren't genetic or economically-based?

      3 votes
      1. DataWraith
        Link Parent
        One interesting one I'm aware of is Ant Colony Optimization, which is based on the way foraging ants find paths from their colony to a food source and back. Honestly, there is a bit of a joke...

        One interesting one I'm aware of is Ant Colony Optimization, which is based on the way foraging ants find paths from their colony to a food source and back.

        Honestly, there is a bit of a joke about metaphor inspired meta-heuristics like that and how it seems like a new one is invented every other month...

        4 votes
  2. joplin
    Link
    As mentioned in another thread, after seeing this post on Myriahedral Projections, I decided to implement a few of them myself. I'm starting with a cube, since it's one of the easier projections....

    As mentioned in another thread, after seeing this post on Myriahedral Projections, I decided to implement a few of them myself. I'm starting with a cube, since it's one of the easier projections. I have it basically working, but I think some of my faces are coming out backwards. So I'll need to figure out why that's happening. I may implement some other non-polyhedral projections at some point, too.

    3 votes
  3. admicos
    Link
    I just started working on an idea I had for quite a while now, which is essentially a web thing with a "wall" you can stick text or drawings or lines or whatever on. I've so far just finished an...

    I just started working on an idea I had for quite a while now, which is essentially a web thing with a "wall" you can stick text or drawings or lines or whatever on. I've so far just finished an initial "prototype" of the client part (video).

    The server part should be easier, especially considering I am not planning on any authentication or multi-user things and all it needs to do is save a simple list of "things" (I might even use something NoSQL, haven't decided yet), and the client does the heavy lifting of positioning and rendering the stuff.

    I am eventually planning to open-source it, so maybe look out for that if I don't abandon it halfway through like everything else I have done so far.

    3 votes
  4. hamstergeddon
    Link
    I recently bought a 16x2 character LCD screen kit for the raspberry pi so I've been having fun coming up with ideas for it. I don't have much familiarity with Python, but its approachability means...

    I recently bought a 16x2 character LCD screen kit for the raspberry pi so I've been having fun coming up with ideas for it. I don't have much familiarity with Python, but its approachability means I'm not having too much trouble cranking out simple stuff. My first project was to use the PokeAPI to randomly select a pokemon and display its name on the screen. My next/current project is to use PiHole's API to display stats about ads blocked on my home network.

    The problem I ran into is that the screen is too small and the data is too big (a classic problem from my TI-83+ programming days). Fortunately there's a scroll function to move text across the screen. So I created a list of dictionaries ("An array of assoc arrays!!" screams my PHP brain), defining different message types. Theres "static" which just displays the message and theres "scroll" which scrolls the messages on the LCD. But even that's not ideal because it tries to spread the message across both rows of the screen so it's not really readable. Also the character LCD API is super basic and I don't have the knowledge to improve on it, unfortunately.

    I think ultimately I need to just buy a proper LCD kit for the pi so I don't need to mess with character limitations.

    2 votes