简体   繁体   中英

How to change CPLEX parameters in oplrun?

Is there a way to let oplrun take a specific CPLEX parameter, such as CPX_PARAM_LPMETHOD (Linear Programming method). In the reference here , it is called by various names for different languages:

C Name: CPX_PARAM_LPMETHOD

C++ Name: RootAlg

Java Name: RootAlg

.NET Name: RootAlg

InteractiveOptimizer: lpmethod 

But there is no reference about the OPL or oplrun.

Is it possible to change this parameter in an oplrun session? Or do I have to use these other languages/interfaces?

In the .mod you may write:

execute
{
  cplex.lpmethod=4;
}

and then you will see in the log:

CPXPARAM_LPMethod                                4

if you just have a specific parameter you would like to change, in the .mod file you can have something like:

int myParameter = …;

In the same .mod file you can also use

execute
{
  cplex.lpmethod=myParameter;
}

And then you have some default value in your .dat file.

To change that parameter from run to run when using oplrun, you can call it with the following command line arguments:

oplrun myModel.mod myData.dat -D myParameter=4

It's not possible to do this (directly) using oplrun command line options . You can, however, use oplrun to execute a specific run configuration that has an associated settings file (a .ops file). For example:

oplrun [options] -p project-dir [run-configuration ...]

When you use the IDE to set individual parameters, the OPL names for the parameters are stored in the .ops file. For example, the CPLEX parameter CPX_PARAM_TILIMIT is named tiLimit in OPL (see here for more).

Alternately, you could export your OPL model using the -e oplrun option. Then, you could run that using the CPLEX interactive and use a parameter file or set them in the command line itself (see here for the syntax).

Lastly, you can surely use one of the programming language APIs available in CPLEX to accomplish the same thing. This would provide the most control, but may take more time (depending on how comfortable you are with programming).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM