Assemble data efficiently
Describes populating the problem with data.
As indicated in previous topics, CPLEX offers several ways of putting data into your problem or (more formally) populating the problem object. You must decide which approach is best adapted to your application, based on your knowledge of the problem data and application specifications. These considerations may enter into your decision:
If your Callable Library application builds the arrays of the problem in memory and then calls
CPXcopylp, it avoids time-consuming reads from disk files.In the Callable Library, using the routines
CPXnewcols,CPXnewrows,CPXaddcols,CPXaddrows, andCPXchgcoeflistmay help you build modular code that will be more easily modified and maintained than code that assembles all problem data in one step.An application that reads an MPS or LP file may reduce the coding effort but, on the other hand, may increase runtime and disk space requirements.
Keep in mind that if an application using the CPLEX Component Libraries
reads an MPS or LP file, then some other program must generate that
formatted file. The data structures used to generate the file can
almost certainly be used directly to build the problem-populating
arrays for CPXcopylp or CPXaddrows,
a choice resulting in less coding and a faster, more efficient application.
In short, formatted files are useful for prototyping your application. For production purposes, assembly of data arrays in memory may be a better enhancement.