Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  A problem with post processing

    Posted 11/10/11 07:45 AM

    Originally posted by: GACNEU


    hi all,
    thanks for your advise firstly.
    i wanna run a model with some data filee, and output results in .txt files. i modified the example, \opl\examples\opl\examples_suite\examples_suite.mod. In line 65, my model is added as such, "AddModel(models, "../A", "A.mod", "A.dat",null);". the post processing codes are written in execute block. but these codes seems have never run and output result i want.
    please tell me how can i make the post processing codes run.
    My simplied A.mod is as following:

    //file A.mod
    float A1 = ...;
    float A2 = ...;

    dvar boolean B1;
    dvar boolean B2;

    maximize A1*B1 + A2*B2;
    subject to{
    B1 + B2 ==1;
    }
    execute POST_PROCESS{
    writeln("B1=",B1);
    writeln("B2=",B2);
    }
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: A problem with post processing

    Posted 11/10/11 12:07 PM

    Originally posted by: SystemAdmin


    In the sample, the code that triggers post processing instructions to be executed is the following block:
    if (isNearEqual(result,expectedResult)) {
                 writeln(allName, " is OK");
                 theModel.postProcess();
               }
    


    Since you don't check the expected result (null as a 3rd argument when calling AddModel), then theModel.postProcess() is not called. You could move that call right after result = algo.getObjValue();
    so the script would look like
    if ( algo.solve() ) {
            result = algo.getObjValue();
            theModel.postProcess();
            if (expectedResult != null) {
               ...
    

    #DecisionOptimization
    #OPLusingCPLEXOptimizer