Assemble the data
To populate the model with data, CPLEX offers alternative routines.
You must decide which approach to populating the problem object
is best for your application. Reading an MPS or LP file may reduce
the coding effort but can increase the run-time and disk-space requirements
of the program. Building the problem in memory and then calling CPXcopylp avoids
time consuming disk-file reading. Using the routines CPXnewcols, CPXnewrows, CPXaddcols, CPXaddrows,
and CPXchgcoeflist can
lead to modular code that may be more easily maintained than if you
assemble all model data in one step.
Another consideration is that if the Callable Library application
reads an MPS or LP formatted file, usually another application is
required to generate that file. Particularly in the case of MPS files,
the data structures used to generate the file could almost certainly
be used to build the problem-defining arrays for CPXcopylp directly.
The result would be less coding and a faster, more efficient application.
These observations suggest that formatted files may be useful when
prototyping your application, while assembling the arrays in memory
may be a useful enhancement for a production application.