Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Indexing array “Assign” with type dexpr int not supported by this algorithm

  • 1.  Indexing array “Assign” with type dexpr int not supported by this algorithm

    Posted Fri April 12, 2019 04:41 PM

    Originally posted by: GoheX


    Indexing array "Assign" with type dexpr int not supported by this algorithm

     

    Good evening,

    My question is similar to one already asked on Stackoverflow, but there was not an answer (at least not one accepted nor suitable).

    I am attempting to make a constraint, which I've simplified below:

    
    
    dexpr int startingWeekChanges[p in People] = 7 * y + 1; 
    
    

    ...

    
    
    for(p in People){
        Assign[startingWeekChanges[p]] == 1;
    }
    
    

    But I see this is not allowed (error message being "Indexing array "Assign" with type dexpr int not supported by this algorithm").

    I can't change over to constraint programming. Is there an alternative strategy to get by this?


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Indexing array “Assign” with type dexpr int not supported by this algorithm

    Posted Fri April 12, 2019 04:58 PM

    Hi,

    in https://www.linkedin.com/pulse/how-opl-alex-fleischer/

    How to use a decision variable as an index with CPLEX ?

    could help.

    If we want to use dexpr instead of dvar we can write

    range r=1..5;

        float value[r]=[2,3,4.5,1,0];
        dvar int i in 1..5;
        dexpr int j=6-i;

        maximize sum(k in r) value[k]*(k==j);
        subject to
        {

        }

        execute
        {
        writeln("i=",i);
        }

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Indexing array “Assign” with type dexpr int not supported by this algorithm

    Posted Sat April 13, 2019 11:48 AM

    Your question is not only 'similar to one posted on StackOverflow', but is cross-posted on StackOverflow at https://stackoverflow.com/questions/55658666/cplex-indexing-array-assign-with-type-dexpr-int-not-supported-by-this-algorit.  If you really think you have to cross-post, please at least mention it. Thanks.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Indexing array “Assign” with type dexpr int not supported by this algorithm

    Posted Sun April 14, 2019 02:01 PM

    I posted an answer to your question on stackoverflow.


    #CPLEXOptimizers
    #DecisionOptimization