Topic
4 replies Latest Post - ‏2013-03-30T09:28:53Z by SystemAdmin
JorisK
JorisK
42 Posts
ACCEPTED ANSWER

Pinned topic Exporting MIP model

‏2013-03-29T09:10:33Z |
Dear,

Normally, when I export a Mixed Integer Programming file (generated using cplex 12.4+java), I get a neatly ordered file like this:

===============================================
Minimize
obj: 12 x_v0,c1 + 19 x_v0,c2 + 31 x_v0,c3 + 22 x_v0,c4 + 17 x_v0,c5
+ 23 x_v0,c6 + 12 x_v0,c7 + 24 x_v0,c8 + 34 x_v0,c9 + 12 x_v0,c10
Subject To
custLinking(c1): x_v0,c1 + x_c1,c2 + x_c1,c3 + x_c1,c4 + x_c1,c5
+ x_c1,c6 + x_c1,c7 + x_c1,c8 + x_c1,c9 + x_c1,c10
+ x_c1,c11 + x_c1,c12 + x_c1,w13 + x_c1,w14 + x_c1,w15
+ x_c1,w16 + x_c1,w17 + x_c1,w18 + x_c1,w19 + x_c1,w20
+ x_c1,w21 + x_c1,w22 + x_c1,w23 + x_c1,w24 + x_c1,w25
+ x_c1,v26 - 2 z_c1,c1 = 0
===============================================
This looks nice and is very readable. Now I created a new MIP model, but for some unknown reason, it adds a "#counter" after every constraint, and after every term:

===============================================
Maximize
obj: 20 y1#0 + 35 y2#1 + 15 y3#2
Subject To
leaveDepot.k0#0: x(v0,c0(0),0)#3 + x(v0,c0(1),0)#4
+ x(v0,c0(2),0)#5 + x(v0,c0(3),0)#6
+ x(v0,c1(0),0)#7 + x(v0,c1(1),0)#8
+ x(v0,c1(2),0)#9 + x(v0,c1(3),0)#10
+ x(v0,c1(4),0)#11 + x(v0,c1(5),0)#12
+ x(v0,c1(6),0)#13 + x(v0,c2(0),0)#14
+ x(v0,c2(1),0)#15 + x(v0,c2(2),0)#16
+ x(v0,v10)#17 = 1
===============================================

Any clue why this happens? How can I get rid of the '#counter' prefix? Each constraint and each variable has its own unique name already, so I don't know why '#counter' is added?
Updated on 2013-03-30T09:28:53Z at 2013-03-30T09:28:53Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    7929 Posts
    ACCEPTED ANSWER

    Re: Exporting MIP model

    ‏2013-03-29T11:05:21Z  in response to JorisK
    Hello,

    I think it's because of "(" and ")" in the names. If you replace them with "_", then it should go away.

    Regards,
    Vivek.
    • SystemAdmin
      SystemAdmin
      7929 Posts
      ACCEPTED ANSWER

      Re: Exporting MIP model

      ‏2013-03-29T13:50:14Z  in response to SystemAdmin
      I think "(" and ")" shouldn't be the problem but...

      I have observed this counters appearing when I use 'CPXNETwriteprob()' even though the names are unique. I haven't observed them in 'CPXwriteprob()'.

      Regards,
      Vivek.
  • SystemAdmin
    SystemAdmin
    7929 Posts
    ACCEPTED ANSWER

    Re: Exporting MIP model

    ‏2013-03-29T16:53:07Z  in response to JorisK
    Hello,

    In the LP file format, the following characters are allowed in the names:

    ! " # $ % & ( ) / , . ; ? @ _ ` ' { } | ~

    Do you by any chance have a character which is not the above, in the string (or char *) that copies the names from your program to the CPLEX data structures? Even 'space' is not allowed.

    For example, if I have the following, it works:

    sprintf(arcnamesid, "(%s)_(%s%d)", "source", "s", i+1);

    But the following results in the counters: (I replaced _ with a space)

    sprintf(arcnamesid, "(%s) (%s%d)", "source", "s", i+1);

    Regards,
    Vivek.
  • SystemAdmin
    SystemAdmin
    7929 Posts
    ACCEPTED ANSWER

    Re: Exporting MIP model

    ‏2013-03-30T09:28:53Z  in response to JorisK
    If at least one of the row/column names in your model contains non-conformant characters and must be changed for output then these counters are appended to all names.
    Please check the LP file specification to see whether any of your names does not conform to that specification. One thing that is often overlooked is that names starting with 'e' or 'E' may need to changed for output.