Decision Optimization

 View Only
  • 1.  Variable indexer size not allowed for a generic array

    Posted Tue April 02, 2024 04:43 AM

    Hello, 

    I would like to create arrays as small in size as possible to decrease the number of variables and parameters and, as a result, computation time.

    In one of my matrixes, the number of columns depend on the row index... I have the following code in my .mod file:

    range J      = 1..n_jobs; 

    range R      = 1..n_recipe;

    int j0[set1] = [1];

    int jIt[set1] = [n_jobs];

    range Jit    = j0[1]..jIt[1];

    int rs[R,0..2] = ...;

    int rJ[J] = ...; 

    dvar float+ t[j in Jit, i in 1..rs[rJ[j],2]];

    where rs and rJ are defined on a .dat file.

    I get the following error: Variable indexer size not allowed for a generic array

    What am I doing wrong?

    This used to work fine in AMPL (I recently switched to OPL)...

    Thank you

    Sam



    ------------------------------
    Samuele Viaro
    ------------------------------


  • 2.  RE: Variable indexer size not allowed for a generic array

    Posted Tue April 02, 2024 07:04 AM

    In

    https://www.linkedin.com/pulse/making-decision-optimization-simple-alex-fleischer/



    array variable indexer size - 3 ways : union , tuple set, decision expression



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 3.  RE: Variable indexer size not allowed for a generic array

    Posted Wed April 03, 2024 02:49 AM

    Thank you...

    Is there a problem with the link "union"...it seems to be the same as "tuple set"...



    ------------------------------
    Samuele Viaro
    ------------------------------



  • 4.  RE: Variable indexer size not allowed for a generic array

    Posted Wed April 03, 2024 08:11 AM

    Hi,

    I updated the file for union

    regards



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 5.  RE: Variable indexer size not allowed for a generic array

    Posted Wed April 03, 2024 08:15 AM

    Thank you Alex!! 



    ------------------------------
    Samuele Viaro
    ------------------------------



  • 6.  RE: Variable indexer size not allowed for a generic array

    Posted Wed April 03, 2024 09:05 AM

    You re welcome

    https://medium.com/ibm-data-ai/optimization-simply-do-more-with-less-zoo-buses-and-kids-66940178db6



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------