Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Cannot access values of decision variables when using CPLEX Enterprise Server

  • 1.  Cannot access values of decision variables when using CPLEX Enterprise Server

    Posted 08/20/14 06:16 AM

    Originally posted by: 6950_Stefan_Woerner


    Hello,

    we just installed a CPLEX Enterprise Server which seems to be running fine (dashboard is showing and we can connect from CPLEX studio).

    However, when using the Java API we face the following problem (following the example in the "Get Started"-Tutorial).

    The job is deployed and started on the server, however, when I try to access the value of the decision variables it returns null: 

                                Element a = solution.getElement("assignment"); // this is null, even though the variables exist
                                Map assignment = a.asMap();

    On the other hand request the objective value or data objects from the solution works fine.

    If I define a data array in the OPL model and assign the value of the decision variables to it in the OPL post-processing, I can get the values I want:

    OPL:

                               execute {
                                   for (...) {
                                    assignmentExport[...] = assignment[...]];
                                  }  
                               }

    Java:

                                Element a = solution.getElement("assignmentExport"); // now the values can be accessed!
                                Map assignment = a.asMap();

    What is it that I am doing wrong?

    Thanks a lot!

    Best regards,

    Stefan

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Cannot access values of decision variables when using CPLEX Enterprise Server

    Posted 08/25/14 03:53 AM

    Hi,

    instead of asMap have you tried asNumVarMap or asIntVarmap ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Cannot access values of decision variables when using CPLEX Enterprise Server

    Posted 08/27/14 03:53 AM

    Originally posted by: 6950_Stefan_Woerner


    HI Alex,

    the NullPointerException is thrown when I call asMap() because the element "a" is null.

    The element "assignment" is not there (I printed the list of all elements (solution.getElements()), and only data was included, no decision variables).

    If I add another data array (like "assignmentExport") and assign the decision variables value in the OPL post-processing to this data array, then I can access the values. But this step shouldn't be necessary.

    I try to create a small example that I can deploy here that reproduces the problem.

    Best,
    Stefan

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer