Forum Discussion

FICO's avatar
FICO
Community Manager
5 years ago

Error 101: Incompatible types in assignment (robustctr := uncertainctr not defined)

I know that this is not possible in its current form, as it fails, but this is what I am trying to do.

I am trying to take an uncertain pricing variable (DAUNC) and multiply it by an uncertain load variable (LOADUNC).

LOADUNC: array(PER) of uncertain

DAUNC: array(PER) of uncertain

RobustDA: robustctr

forall(p in PER) LOADUNC(p) >= LOAD(p) - LOAD(p) * .25

forall(p in PER) LOADUNC(p) <= LOAD(p) + LOAD(p) * .25

forall(p in PER) DAUNC(p) >= DAFCST(p) - DASTD(p) * 2

forall(p in PER) DAUNC(p) <= DAFCST(p) + DASTD(p) * 2

RobustDA := sum(p in PER) LOADUNC(p) * DAUNC(p)

maximize(RobustDA)

Any help would be appreciated to try and get to the ultimate goal of the code.

Thanks!

1 Reply

  • FICO's avatar
    FICO
    Community Manager

    I'm not entirely sure about the meaning of the quantities LOAD, DAFCST, DASTD, and the uncertains LOADUNC and DAUNC. I will assume that the first three are mpvars. This way, the four constraints are robust constraints (i.e. the variables are constrained with coefficients or, as in this case, a right-hand side that is unknown) while the objective function is a function of uncertain parameters.

    The first trouble with the model is precisely in the objective function. LOADUNC and DAUNC are uncertain parameters, i.e., they are not known at the time of solving the problem but, most importantly, they are not decision variables, as you declared them as uncertains. In other words, they are input parameters which are simply unknown, and in addition we do not control them. This is a fundamental notion of robust optimization, and is outlined in the manual on the robust optimization module; it is also explained in much better ways in the robust optimization literature.

    Maximizing a function of only uncertain parameters does not have any effect on any of the decision, simply because the objective function does not contain any decision variable, i.e., any mpvars, which are the actual decision variables of the problem, which are unknown but are decisions under our control.

    The reason of the error is that Mosel does not accept objective functions that contain uncertain parameters but not mpvars. In general, in order to formulate your model correctly we need to understand the following:

    1) are LOAD, DAFCST, and DASTD actual mpvars? In other words, once the problem is solved, do their value correspond to a decision? Does the system you're trying to optimize have a configuration that depends on LOAD, DAFCST, and DASTD, which you can set yourself? Or are these input parameters? In the last case, are they known?

    2) most importantly: what are DAUNC and LOADUNC? Are they known before the solve (but I guess they are not)? If they are not known, are they decided by someone else (market, a competitor, supplier, customer)? If so, they are effectively uncertain parameters, but then it doesn't make any sense to maximize their product because they are simply not in our control.

    Hope this helps.