Decision Optimization

Decision Optimization

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


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

CPLEX first integer solution

  • 1.  CPLEX first integer solution

    Posted 10/12/18 01:12 PM

    Originally posted by: open_ball


    Hi,

     

    If I create cplex, set intsollim parameter as 1, and call cplex.solve() function twice, does cplex respond in the following way?

     

    1) Start solving the problem, find the first integer solution.

    2) Continue the branch and cut tree and find the second integer solution.

     

    So basically, would that be the same with setting intsollim=2 and calling  cplex.solve() only once?

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: CPLEX first integer solution

    Posted 10/12/18 04:21 PM

    Hi

    you re right and let me give you an example out of the warehouse example in OPL:


    int Fixed        = 100;
    int NbWarehouses = 200;
    int NbStores     = 600;


    assert( NbStores > NbWarehouses );

    range Warehouses = 1..NbWarehouses;
    range Stores     = 1..NbStores;
    int Capacity[w in Warehouses] =
      NbStores div NbWarehouses +
      w % ( NbStores div NbWarehouses );
    int SupplyCost[s in Stores][w in Warehouses] =
      1 + ( ( s + 10 * w ) % 100 );
    dvar int Open[Warehouses] in 0..1;
    dvar float Supply[Stores][Warehouses] in 0..1;
    dexpr int TotalFixedCost = sum( w in Warehouses ) Fixed * Open[w];
    dexpr float TotalSupplyCost = sum( w in Warehouses, s in Stores )  SupplyCost[s][w] * Supply[s][w];
    minimize TotalFixedCost + TotalSupplyCost;

    subject to {

     

      forall( s in Stores )
        ctStoreHasOneWarehouse:
          sum( w in Warehouses )
            Supply[s][w] == 1;
      forall( w in Warehouses )
        ctOpen:
          sum( s in Stores )
            Supply[s][w] <= Open[w] * Capacity[w];
    }

    execute
    {
    writeln("Obj=",TotalFixedCost + TotalSupplyCost);
    writeln("cplex.status=",cplex.status);
    }

    main
    {
    thisOplModel.generate();
    cplex.intsollim=2;
    cplex.solve();
    thisOplModel.postProcess();
    }

    gives

     

    Obj=16890
    cplex.status=104

    but if for the main block you write

    main
    {
    thisOplModel.generate();
    cplex.intsollim=1;
    cplex.solve();
    thisOplModel.postProcess();
    cplex.solve();
    thisOplModel.postProcess();
    }

    then you ll get

     

    Obj=17300
    cplex.status=104
    Obj=16890
    cplex.status=104

    regards


    #CPLEXOptimizers
    #DecisionOptimization