Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  submodel connection

    Posted 04/20/12 11:32 AM

    Originally posted by: S3PU_Yaqing_Tan


    hi,

    Here is my code to connect with a submodel:

    main{
    var status = 0;
    // Preparing sub-model source, definition and engine, data
    var subSource = new IloOplModelSource("sched_batch.mod");
    var subDef = new IloOplModelDefinition(subSource);
    var subCp = new IloCP();
    var subData = new IloOplDataElements(subSource);

    // Ceating the sub model
    var subOpl = new IloOplModel(subDef,subCp);
    subOpl.addDataSource(subData);
    subOpl.generate();
    }

    It is said that "IloOplDataElements" has too many arguements, and it also seemed that I cannot use "main" here. Could you help me to solve the problem and create a submodel?
    Thanks very much.

    Yatsing
    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: submodel connection

    Posted 04/23/12 03:49 AM

    Originally posted by: S3PU_Yaqing_Tan


    Hi,

    From the scripting log, it is said that "Script execution failed with status -1".
    What does this mean?
    #ConstraintProgramming-General
    #DecisionOptimization


  • 3.  Re: submodel connection

    Posted 04/23/12 02:21 PM

    Originally posted by: SystemAdmin


    Hi,

    the issue in your code extract is in the declaration of "subData"
    If you look for IloOplDataElements in the reference manual , you will notice that the constructor takes no parameter, so in your script, replace
    
    var subData = 
    
    new IloOplDataElements(subSource);
    

    by
    
    var subData = 
    
    new IloOplDataElements(); subData.<yourData>=<the data value>;
    

    As for the error message you get, it is expected, since there is an error in the main script, the execution fails.
    In the documentation for main, it says "A return value >=0 means that the execution was correct. A return value <0 means that an error occurred during the execution."

    Hope this helps
    #ConstraintProgramming-General
    #DecisionOptimization


  • 4.  Re: submodel connection

    Posted 04/25/12 10:15 AM

    Originally posted by: S3PU_Yaqing_Tan


    thank you very much. I solved the problems
    #ConstraintProgramming-General
    #DecisionOptimization