Decision Optimization

 View Only
  • 1.  ilog cplex warning, Data item unexpected

    Posted Thu July 02, 2020 09:58 AM


    I generated a .dat file from a .json using something like this. I slightly modified the code for my purpose.
    I have another .dat file (that I will call original) to use as a comparison for the output from my script.
    The generated .dat is very similar to the original, except for some line breaks/spaces that shouldn't effect the code (or at least I tried removing or adding random spaces to the original and cplex can still run it).
    The model for the two .dat is the same.

    My problem is cplex can't run the model with the generated .dat and returns me this error

    Data item "0" unexpected for "int[][*parameter_name*]". 

    Where *parameter_name* is the name of one of the parameter, formatted like this in the .dat:
    parameter_name = {
    < 1, "name1", [0-1 vector], [0-1 vector], [float vector], [0-1 vector] >,
    < 2, "name2", ...>,
    and in the model is specified this way:
    tuple param {
      key int id;
      string name;
      int vec1[param_m];
      float vec2[param_d];
      float vec3[param_f];
      int vec4[param_r];
    ordered {param} parameter_name = ...;

    There is only one big difference I could spot between generated and original .dat, that is: following parameters are matrices of this format
    and the generated .dat has no line breaks between vectors while the original has them.

    Changing this would require a lot of time, but removing some line breaks on the original didn't make it stop working. So I'm also worried it would be useless and that I'm not finding the real problem.

    But these .dat files are very big and I can't open them on the editor to see which line has the problem.

    Can someone help me?


  • 2.  RE: ilog cplex warning, Data item unexpected

    Posted Thu July 02, 2020 10:05 AM
    Sorry, from your description it is hard to tell what the problem is. I think you should reduce this to a smaller example and show us the full .mod and the two .dat files for this reduced example.

    The error message seems to say that you are trying to initialize a parameter with an invalid value. For example, you are trying to initialize an array (or an array of arrays) with the plain number 0.

    The amount of whitespace between tokens should make no difference.

    Daniel Junglas

  • 3.  RE: ilog cplex warning, Data item unexpected

    Posted Thu July 02, 2020 10:45 AM

    Hi, thank you for your help. In the end the problem was the next parameter (and not the one in the warning), that wanted integers and had a float in it. I was able to solve it.

    Have a nice day!

    Davide Angioni