Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Status

    Posted 12/22/10 09:53 AM

    Originally posted by: MatteoFabr


    I write a file main and Cplex write this error message:
    "Script execution failed with status -2"
    What's thew meaning^
    Thanks.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Status

    Posted 12/22/10 10:15 AM
    Hello,

    I think you may be trying to access a solution value for a model that was infeasible.

    For example

    dvar int x in 0..2;
     
    subject to
    {
     x==4; 
    }  
     
    main
    {
      thisOplModel.generate();
      cplex.solve();
      writeln(thisOplModel.x.solutionValue);
    }
    


    gives

    // Script execution failed with status -2

    If I change x==4; into x==2; in the subject to block then I do not get this error any more
    Regards

    Alex
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Status

    Posted 12/22/10 10:41 AM

    Originally posted by: MatteoFabr


    Thanks for your reply.

    In particular I have this code:

    var src = new IloOplModelSource("DiffAss.mod");
    var def = new IloOplModelDefinition(src);
    var fixedData = new IloOplDataSource("fixedData.dat")
    for (var i=1;i<=20;i++) {
    var opl = new IloOplModel(def,cplex);
    opl.addDataSource(fixedData);
    var dataElt = new IloOplDataElements();
    dataElt.sheetName = "Dati.xlsx";
    dataElt.sheetRange=i+"Dati!A1:J10";
    opl.addDataSource(dataElt);
    var dataSource=new IloOplDataSource("RangeExceldata.dat");
    opl.addDataSource(dataSource);
    opl.generate();

    if ( cplex.solve() ) {
    writeln();
    writeln("X = ",cplex.getObjValue());

    }
    else {
    writeln("solve failed");
    }

    var srcd = new IloOplModelSource("MaxDistVinc.mod");
    var defd = new IloOplModelDefinition(srcd);
    var fixedDatad = new IloOplDataSource("fixedData.dat")
    var opld = new IloOplModel(defd,cplex);
    opld.addDataSource(fixedDatad);
    var dataEltd = new IloOplDataElements();
    dataElt.sheetName = "DatiErkut.xlsx";
    dataElt.sheetRange=i+"Erkut!A1:J10";
    opld.addDataSource(dataElt);
    var dataSourced=new IloOplDataSource("RangeExceldata.dat");
    opld.addDataSource(dataSource);

    opld.generate();

    var vectors = new IloOplCplexVectors();

    for ( var t =1;t<11;t++){
    vectors.attach(opld.OpenWarehouse[t],opl.OpenWarehouse[t].solutionValue);
    vectors.getVectors(cplex);
    }

    if ( cplex.solve() ) {
    writeln();
    writeln("Xd = ",cplex.getObjValue());
    else {
    ofile.writeln("solve failed");
    }
    opl.end();
    opld.end

    }
    }

    The variable array openWarehouse have the same size in the two different model, and also the datas are the same. I want to fix this variables for founding th values of the other.
    Can you help me?
    THANKS!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer