12.07.2015 Views

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Initialization and memory allocationIn <strong>OPL</strong>, the initialization mode you choose affects memory allocation. Namely, externalinitialization from a .dat file, while enabling a more modular design, may have a significantimpact on memory usage.Internal initializationInternal data (directly from the model file) is initialized when first used. This is also called“lazy initialization”. Unused internal data elements are not allocated any memory. In otherwords, internal data is “pulled” from <strong>OPL</strong> as needed.Example of lazy initializationint a=2;int b=2;int a2=2*a;int b2=2*b;execute{a2;a++;b++;writeln(a2);writeln(b2);}assert a2==4;assert b2==6;External initializationIn contrast, data from a data file is initialized while the .dat file is parsed and is allocatedmemory whether it is used by the model or not. In other words, external data is “pushed” to<strong>OPL</strong>.I L O G O P L D E V E L O P M E N T S T U D I O L A N G U A G ER E F E R E N C E M A N U A L53

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!