Topic
1 reply Latest Post - ‏2013-07-02T16:31:18Z by AlexFleischer
Matl_P
Matl_P
1 Post
ACCEPTED ANSWER

Pinned topic dexpr circular dependency

‏2013-06-15T14:47:29Z |

Hello! I'm somewhat new to CPLEX so please excuse me if this is a stupid question, but I hope you can help me. I'm trying to model a problem of the form:

yk = decision var

x0 = some starting value

xk = x(k-1) + yk

Of course there are further constraints on Y and so on, but this is the general form of the model. It runs a particular set of expression a certain number of times (cycles), whereby the results of the previous cycles are used to determine the constraints of the current cycle. I've tried the following in CPLEX, but I get a circular dependency error for the dexpr:

range R = 1..cycles;

dvar int+ Y[R];

dexpr int X[c in R] = X[c-1] + Y[c];

 

How can I model something like this? I've gotten the model to work by making the X a decision variable and re-expressing some of the content, but this increases the number of variables too much to be of practical use, because the actual model has very many such constraints and the number of cycles is large (almost 300).

Updated on 2013-06-15T14:51:22Z at 2013-06-15T14:51:22Z by Matl_P
  • AlexFleischer
    AlexFleischer
    1076 Posts
    ACCEPTED ANSWER

    Re: dexpr circular dependency

    ‏2013-07-02T16:31:18Z  in response to Matl_P

    Hi

     

    have you tried to rewrite into

     

    dvar int X[R]
    dexpr int y[c in R diff first(R)]=X[c]-X[c-1];

     

    ?

     

    regards