Reusing existing files and projects

Describes the various ways of opening existing projects and reusing them in other projects.

In some cases, it is quicker to create an OPL project by opening and editing an existing one. IBM® ILOG® CPLEX® Studio comes with many code samples and industry models that you can reuse as a starting point for your own projects. The Language and Interfaces Examples manual provides a detailed description of the optimization issues they express, as well as a quick access to the files.

The following procedures suggest how you can open and reuse either the examples supplied with CPLEX Studio, or your own existing projects.

To reuse an existing project, first you should open and copy it:

  1. From the IDE, choose File > Import > Existing OPL 6.x projects, or right-click in the OPL Projects Navigator and choose Import > Existing OPL 6.x projects from the menu.
  2. To select one of the distributed examples for copying and reuse, navigate to the folder under <Install_dir>\opl\examples that contains the model you want to reuse, and open it in CPLEX Studio.

    To select one of your own projects for copying and reuse, navigate to the folder that contains it and open it.

    Note:

    This procedure is only for OPL 6.x projects. For importing projects from previous releases of OPL, see the OPL Migration Guide.

  3. In the OPL Projects Navigator, right-click on the project name and choose Copy from the menu:

    You could also select the project name and press Ctrl + C.

  4. Right-click again and choose Paste from the menu, or press Ctrl + V.
  5. A Copy Project popup window appears. Change the Project name to something other than the original project name or one of the other project names currently open in OPL, change the Location if necessary, and click OK.

    The new project appears in the OPL Projects Navigator.

  6. Right-click the original project (the one you just copied) and choose Delete from the menu. When the popup asks you if you want to delete all contents, choose Do not delete contents.

You can now modify the copied project as you want.

Note:

You can use the File > Copy Files to Project menu command to open a dialog box that allows you to open files and import them into an existing project.

You can also drag existing files from a Windows Explorer window and drop them onto the project folder in your OPL Projects Navigator. This is always a copy operation, not a move.