Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Decision variable (or expression) "x" not allowed error in cplex

  • 1.  Decision variable (or expression) "x" not allowed error in cplex

    Posted 07/24/21 09:11 AM

    I am building a CPLEX OPL model. I found error: Decision variable (or expression) "x" not allowed.

    Here x is a decision variable and shown below:

    dvar boolean x[N][CR];

    and the Constraint is

    forall(i in N, j in CR :x[i][j]==1) {

    (j%2 == 0) => r[i] == 1;

    (j%2 == 1) => r[i] == 0;

    }

    How I write this constraint correctly. Thanks in advance






    #DecisionOptimization
    #Support
    #SupportMigration


  • 2.  RE: Decision variable (or expression) "x" not allowed error in cplex

    Posted 07/27/21 03:25 PM

    Decision variables can't be used for slicing, as their values are unknown during model generation. The below is for illustration purpose (untested and probably not an efficient formulation):

    forall(i in N, j in CR) {

    (x[i][j]==1) => (r[i] == 1-j%2);

    }






    #DecisionOptimization
    #Support
    #SupportMigration