Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Implementing objective function with product of two sums.

    Posted 06/18/14 03:03 PM

    Originally posted by: alfablac


    I need to code a product of two sum in my problem.

    The minimization function is

    I'm doing like this:

    IloExpr obj(env);

    IloExpr obj_part(env);
    for(int T = 0 ; T < 2; T++) {
    for(int i = 0 ; i < n; i++) {
    for(int j = 0 ; j < n; j++) {
    for(int K = 0 ; K < k; K++) {
    obj_part += x[T][k][i][j];
    }
    obj += c[T][i][j]*obj_part;
    }
    }

    }

    but CPLEX 12.4 (concert library) is stop working right in it.

     

    thanks in advace. Any help is appreciated

     

    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Implementing objective function with product of two sums.

    Posted 06/19/14 02:06 AM

    Originally posted by: Ibrahim_Capar


    You need to reset obj_part after each iteration.  So I think the code should be:

    IloExpr obj(env);
    
    for(int T = 0 ; T < 2; T++) {
        for(int i = 0 ; i < n; i++) {
            for(int j = 0 ; j < n; j++) {
                IloExpr obj_part(env);
                for(int K = 0 ; K < k; K++) {
                    obj_part += x[T][k][i][j];
                }
                obj += c[T][i][j]*obj_part;
                obj_part.end();
            }
        }
    }
    

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Implementing objective function with product of two sums.

    Posted 06/19/14 10:02 AM

    Ibrahim is correct about needing to reset obj_part. While that is definitely a bug, it may not be causing CPLEX to fail. You need to clarify what you mean by "stop working". Is CPLEX throwing an exception?


    #CPLEXOptimizers
    #DecisionOptimization