Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Providing initial solution

    Posted 03/17/15 10:18 AM

    Originally posted by: Helia


    Hi everyone,

    I am solving a quite large problem in OPL and to save time, I give an initial solution to the problem. What seems problematic is that the solution which is built upon my initial solution, has terrible quality. In the initial solution, I provide the value of all major decision variables in the model. Meaning that only those decision variables who are the summation of these major decision variables, are not given. However, the value of objective function of the initial solution is way larger than it should be. Any idea?

    To solve this issue, I have tried to provide the value of objective function and some of the non-major decision variables in the initial solution. Now the issue is that these decision variables are not arrays and it seems like I can not use the same procedure (of defining a variable, attaching it to the decision variable and setting the vector) for  these decision variables in main script, because I receive this error:

    Description Resource Path Location Type
    Scripting runtime error: Method attach() can only be used with arrays in this context..
     

    Here is a copy of a part of the main script:

    main{
     
        thisOplModel.generate();  
        var def = thisOplModel.modelDefinition;   
     
      //access data file
     
        var data = new IloOplDataSource("10 co-103.dat");
     
        var cplex1 = new IloCplex();
        var opl1 = new IloOplModel(def, cplex1);
        opl1.addDataSource(data);
        opl1.generate();
     
      // Setting initial solution
      
      writeln("Setting initial solution");
     
      var FinalDCvectors = new IloOplCplexVectors();// for this variable and teh next one, there is no error because they replace arrays 
      var LTLDCDCFlowVectors = new IloOplCplexVectors(); 
     
      var ObjFunVector=new IloOplCplexVectors(); // causing error
      var TotalDCCostVector =new IloOplCplexVectors(); // causing error
      var TotalFlowCostVector =new IloOplCplexVectors(); // causing error
     
    // We attach the FinalDCSolInitial (defined as data) as starting solution for the variables finalDC.
      
    FinalDCvectors.attach(opl1.JointDCOpen,opl1.FinalDCSolInitial );
      LTLDCDCFlowVectors.attach(opl1.LTLFlowDCDC,opl1.LTLCompanyDCDCFlowSolInitial );
     
    ObjFunVector.attach(opl1.TotalLogisticsCost,opl1.InitialObjFun);
    TotalDCCostVector.attache(opl1.TotalDCCost,opl1.InitialTotalDCCost) ;
    TotalFlowCostVector.attach(opl1.TotalFlowCost,opl1.InitialTotalFlowCost) ;
     
    FinalDCvectors.setVectors(cplex1); 
      LTLDCDCFlowVectors.setVectors(cplex1); 
     
      ObjFunVector.setVectors(cplex1);
      TotalDCCostVector.setVectors(cplex1);
      TotalFlowCostVector.setVectors(cplex1);
     
     
      writeln("Start problem solving");
      cplex1.solve();   
      opl1.postProcess();
     
     }

     

    Thanks for your insight

    Best,

    Helia


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Providing initial solution

    Posted 03/17/15 02:24 PM

    Hi

    why do not you change your scalar into an array with one element ?

    dvar int x;

    dvar int x2[1..1];

    subject to

    {

    x==x2[1];

    }

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Providing initial solution

    Posted 03/17/15 04:57 PM

    Originally posted by: Helia


    Great! It worked. I haven't added the new constraint and Decision variable to avoid increasing the current number of decision variables and constraints in the model. I simply declared the main decision variable as an array of one [1..1].  It was a very helpful advice!!

    Just the problem with the quality of the solution built upon the given initial solution remains unsolved! Even now that I have provided the value of more decision variables in the initial solution, still the quality of the solution built from it is very bad. Any idea?

    Thanks

    Best,

    Helia


    #DecisionOptimization
    #OPLusingCPLEXOptimizer