I coded an Opl project in IBM ILOG CPLEX Optimization Studio. I have more than 300 number of files and I get my data from each of them in each attempt. Instead of importing one by one, I want to define an automatic way to import each file, get its related result and then choose the next file. For defining a folder, which contains all the files, I need to use c++ or java codes. When I use these codes the program gives me an error of " These functions are not defined" and I think I should import a c++ or java library somehow. i want to know is it possible to do such things? Or is there any solution for this problem?
Asked
Active
Viewed 308 times
2 Answers
0
Do you know you can call OPL from C++ and Java ?
Many examples in:
CPLEX_Studio129\opl\examples\opl_interfaces
Do you know you can call models not only from the studio but with oplrun ?
Finally, you may call Java from OPL, see:
CPLEX_Studio129\opl\examples\opl_interfaces\java\javaknapsack
You may also call any executable from OPL with IloOplExec.

halfer
- 19,824
- 17
- 99
- 186

Alex Fleischer
- 9,276
- 2
- 12
- 15
0
CPLEX comes with many examples that show how to use it from Java or C++. Just check the user manual and the tutorials there.
However, if you already have your model in OPL and the issue is just this loop over the files, then notice that there is an IloOplCallJava functions that allows you to call arbitrary Java code from an OPL execute
block. You could use this to call Java file system functions and implement your loop in an OPL scripting block.

Daniel Junglas
- 5,830
- 1
- 5
- 22