Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Set a time limit

    Posted 04/12/18 01:44 PM

    Originally posted by: scipiotc


    Is it possible to limit the computation time of opl? I have a computationally very expensive problem. Therefore, I would like to set a time limit and print the best feasible solution found in this time limit. Would it be possible?

     

    Thanks


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Set a time limit



  • 3.  Re: Set a time limit

    Posted 04/12/18 02:25 PM

    Originally posted by: scipiotc


    Hi,

    Is that in terms of seconds or minutes? Because, It has been 7 minutes and it is still running.

     

    Thanks


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Set a time limit

    Posted 04/12/18 02:50 PM

    Hi,

    in s

    but this is for solve

    Maybe you wrote some scripting that took time.

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Set a time limit

    Posted 04/12/18 03:13 PM

    Originally posted by: scipiotc


    Is there something wrong with this code?

     

    int n=...;
    int m=...;
    range observation = 1..n;
    range feature = 1..m;
    float x[observation][feature] = ...;
    float y[observation] = ...;
    float c = 1000000;
    int r = 4101;
    dvar float+ eps[observation];
    dvar float w[feature];
    dvar float+ alfa;
    dvar float b;
    dexpr float teps = sum(j in observation) eps[j];
    dexpr float l2norm = sum(i in feature) w[i] * w[i];
    dexpr float l1norm = sum(i in feature) abs(w[i]);
    minimize 0.5 * alfa + c * teps;
    subject to {
     forall(i in observation)
       y[i] * ((sum(j in feature) w[j] * x[i][j]) + b) >= 1 - eps[i];
     l2norm  <= alfa;
     l1norm  <= r * alfa;
    }

     

    execute {
     cplex.tilim = 120;
    }

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Set a time limit

    Posted 04/13/18 02:47 AM

    Hi,

    will depend on n and m

    For instance

    int n=1000;
    int m=1000;
    range observation = 1..n;
    range feature = 1..m;
    float x[o in observation][f in feature] = rand(10);
    float y[o in observation] = rand(10);
    float c = 1000000;
    int r = 4101;
    dvar float+ eps[observation];
    dvar float w[feature];
    dvar float+ alfa;
    dvar float b;
    dexpr float teps = sum(j in observation) eps[j];
    dexpr float l2norm = sum(i in feature) w[i] * w[i];
    dexpr float l1norm = sum(i in feature) abs(w[i]);
    minimize 0.5 * alfa + c * teps;
    subject to {
     forall(i in observation)
       y[i] * ((sum(j in feature) w[j] * x[i][j]) + b) >= 1 - eps[i];
     l2norm  <= alfa;
     l1norm  <= r * alfa;
    }

    runs in a few seconds

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer