Wednesday, August 31, 2016

Perkun in C++ notation

You may think that the Perkun/Perkun2 syntax is rather odd. I was thinking about a comparison - for example with C++. And I came up with the following example:

variables
{
input variable a:{false,true},b:{false,true},c:{false,true};
output variable action:{false,true};
hidden variable d:{false,true},e:{false,true},f:{false,true};
}

Now imagine the following class in C++-like pseudocode:

class x
{
private:
class hidden { bool d,e,f; };
std::map<hidden,double> distribution;
public:
bool get_decision(bool a, bool b, bool c) const;
};

In other words we have a class with a probability distribution over a cartesian product of the hidden variables and a single function mapping the input variables into (one) output variable. Note that if there were no hidden variables then our distribution would disappear and we would have a stateless class (or simply a function) get_decision.

You might ask what is the benefit of using Perkun rather then simply hard code the function mapping input to output. I think that in simple cases it may be obviously simple to hard code it. But it is a trap. By hard coding it we do not explain the machine WHY the mapping looks so, we only provide it with the end result. We might end up with the hard coded solutions for myriads of different input sets. It might be even so that the idea of telling the machine how to derive the result from simple components (payoff,model) will be treated as highly experimental. Well, Perkun/Perkun2 are highly experimental. In spite of that I think they open intriguing possibilities as new technologies of programming.

BTW. The fact I usually only use a single output variable is a convention. You are free to use multiple output variables.




No comments:

Post a Comment