Variable names in LP file format
CPLEX conforms to these rules about variable names in the LP file format.
Variables can be named anything in LP format provided that the name does not exceed 255 characters, all of which must be alphanumeric (a-z, A-Z, 0-9) or one of these symbols: ! " # $ % & ( ) , . ; ? @ _ ‘ ’ { } ~. Longer names are truncated to 255 characters. A variable name can not begin with a number or a period.
The letter E
or e
, alone or followed by other valid
symbols, or followed by another E
or e
,
should be avoided as this notation is reserved
for exponential entries. Thus, variables can not be named e9
,
E-24
, E8cats
,
or other names that could be interpreted as an exponent. Even variable
names such as eels
or example
can cause a read error, depending on their placement in an input line.
Good Practice: Variable names begin with a letter (other than E or e) or with an underscore.
Multi-dimensional arrays of variables from OPL
LP format does not support the square brackets [ and ] in variable names. This convention imposes special considerations about multi-dimensional arrays in OPL.
When CPLEX translates your algebraic OPL model to the LP format, it must transform all multi-dimensional arrays of variables into scalar variables. This transformation assigns a different name to each element of each such array. In renaming the elements of arrays of variables, CPLEX does not simply concatenate the indices of an element to approximate a new multi-digit index because simply concatenating the indices of elements as they are does not rename the elements unambiguously. For example, consider a two-dimensional array named myarray with elements such as myarray[1][23] and myarray[12][3]. Simple concatenation produces one ambiguous name, myarray[123], for both of those distinct elements. Consequently, to avoid such ambiguity in renaming the elements of a multi-dimensional array of variables, the transformation to LP format introduces a separator (#). In this example, myarray[1][23] is renamed as myarray#1#23 and myarray[12][3] is renamed as myarray#12#3.
Conversion of names in LP files generated by CPLEX applications
Warning: Output names have been modified to conform to LP format.