Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  A question of array when using Cplex.net

    Posted 01/03/12 08:22 AM

    Originally posted by: SystemAdmin


    Hi,everyone.my question is like this:
    I want to do something like the this:
    decide[i]j+1 + ... + decide[i]j + dur_time == dur_time

    maybe you could write code as following:
    INumExpr sum = cplex.NumExpr();
    for (int k = 1; k <= dur_time; ++k)
    sum = cplex.Sum(sum, decide[i]j + k;
    // sum is now decide[i]j+1 + ... + decide[i]j + dur_time
    cplex.AddEq(sum, dur_time);

    Is there some method in Cplex.net that make the sum directly? just like @sum using in Lingo
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: A question of array when using Cplex.net

    Posted 01/03/12 08:25 AM

    Originally posted by: SystemAdmin


    Hi,everyone.my question is like this:
    I want to do something like the this:
    decide[i]j+1 + ... + decide[i]j + dur_time == dur_time

    maybe you could write code as following:
    INumExpr sum = cplex.NumExpr();
    for (int k = 1; k <= dur_time; ++k)
    sum = cplex.Sum(sum, decide[i]j + k);
    // sum is now decide[i]j+1 + ... + decide[i]j + dur_time
    cplex.AddEq(sum, dur_time);

    Is there some method in Cplex.net that make the sum directly? just like @sum using in Lingo
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: A question of array when using Cplex.net

    Posted 01/03/12 11:52 AM

    Originally posted by: SystemAdmin


    Try Cplex.ScalProd. This allows you to build the scalar product of two vectors and may be helpful here.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: A question of array when using Cplex.net

    Posted 01/06/12 03:34 AM

    Originally posted by: SystemAdmin


    Thanks a lot!
    System.Console.WriteLine(" Minimun cost= " + cplex.ObjValue);
    In this way,you can print the result of the ObjValue.
    If i want to print the product of the ObjValue and 1000,which method can i use??

    I try it like following,but it is wrong.
    System.Console.WriteLine(" Minimun cost= " +cplex.scal(cplex.ObjValue,1000));
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: A question of array when using Cplex.net

    Posted 01/06/12 07:28 PM

    Originally posted by: SystemAdmin


    > If i want to print the product of the ObjValue and 1000,which method
    > can i use??
    > I try it like following,but it is wrong.
    > System.Console.WriteLine(" Minimun cost= "
    > +cplex.scal(cplex.ObjValue,1000));

    You could simply multiply the 1000 and cplex.ObjValue (which returns a double value) as such:

    System.Console.WriteLine("Minimum cost = " + cplex.ObjValue * 1000);
    


    The cplex.ScalProd methods and such are useful for creating expressions during model building. Once the model is built and solved, simple multiplication would work.
    #CPLEXOptimizers
    #DecisionOptimization