Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Cplex with .NET

    Posted 11/23/13 07:03 AM

    Originally posted by: mino_901


    I'm new with CPLEX and I want to write this function : 

    maximize
        (sum(j in 1..n) (sum (t in 1..T)r[t][j]) * x[j]/T) ;

    Please i need your help :) Thank you at advance 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Cplex with .NET

    Posted 11/24/13 03:53 AM

    Please take a look at the C# examples that are shipped with CPLEX. They teach you how to use CPLEX in C#.NET.

    Also look at this tutorial in the user manual.

    Coding up your objective function would be something like this:

    INumVar[] x = ...;
    double[][] T = ...;
    ILinearNumExpr expr = cplex.LinearNumExpr();
    for (int j = 1; j <= n; ++j)
       for (int t = t; t <= T; ++t)
          expr.AddTerm(x[j], r[t][j] / T);
    cplex.AddMaximize(expr);

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Cplex with .NET

    Posted 11/24/13 05:30 AM

    Originally posted by: mino_901


    Ok :) thank you very match for your help. I'll take look at this tutorial. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Cplex with .NET

    Posted 11/24/13 07:38 AM

    Originally posted by: mino_901


    Hi it's me again :$ 

    I'm justing trying to make a decision variabe : y{0,1} (it can take just 0 or 1)

    so i did this instruction : 

    for (int t=0;t<T;t++)
                        cplex.Or(cplex.Eq(y[t],0),cplex.Eq(y[t],1));

    but it does not work :( 

    Thank you for you help :) 


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Cplex with .NET

    Posted 11/24/13 07:59 AM

    Decision variables are instances of INumVar. The fact that variables can only take integral or binary values is not expressed as a constraint but as the decision variable type.

    In order to create a binary variable (that can take only values 0 and 1) use

    INumVar var = cplex.BoolVar()

    You may also want to take a look at these functions that create decision variables: BoolVarArray, IntVar, IntVarArray, NumVar, NumVarArray. All the above should be pretty obvious from the examples shipped with CPLEX. Did you read those examples and it still was not clear how to create decision variables?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Cplex with .NET

    Posted 11/24/13 12:03 PM

    Originally posted by: mino_901


    oooh thank you it's so clear now :) thank you very match ^^ 


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Cplex with .NET

    Posted 11/24/13 12:03 PM

    Originally posted by: mino_901


    hi, i just have another question and i wish it will be the last :) 

    i want to find a relax solution for my problem (because it's a very big probleme so cplex can't find the optimal solution) so i think that i should change cplex.solve(); but i don"t know what i have to use. 

    thank you :) 


    #CPLEXOptimizers
    #DecisionOptimization