Sunday, March 5, 2017


What is the purpose of an optimizer? It attempts to maximize the expected value of the so-called payoff function. In this example we are finally implementing a method specifying the payoff function. First we have to tell zubr about it:

%option getpayoff own // method getPayoff

Then in the definition section we provide the implementation:

protected float getPayoff(VisibleState vs) {

    switch (vs.getVariableValue("alpha"))
        case FALSE:
            return 0.0f;
        case TRUE:
            return 100.0f; // TRUE is "better" than FALSE
    return 0.0f;

This way we make our optimizer to prefer alpha=TRUE and dislike alpha=FALSE. The example can be executed as usually, with zubr:

zubr example19_get_payoff.zubr >

There are two possible decisions: MOVE and DONT_MOVE. The Perkun section in the zubr specification looks as follows:

    value FALSE, TRUE;
    value MOVE, DONT_MOVE;

    input variable alpha:{FALSE, TRUE}; // alpha may have value FALSE or TRUE   
    output variable beta:{MOVE, DONT_MOVE};

You can execute the final program directly from my server:

As is easy to anticipate the optimizer will do MOVE after FALSE, while he would do DONT_MOVE after TRUE. We still don't have the hidden variables here, but the example is sufficient to introduce the getPayoff method.

An interesting observation - if there are no hidden variables then the optimizer could be replaced by a simple function. Only then. The optimizers with hidden variables can be much better than any function mapping input to output, as was shown previously. 

The next example will be based on hidden variables, which is what makes zubr interesting.

No comments:

Post a Comment