Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Function operator/(dvar+,dvar+ float) not available in context CPLEX

    Posted Tue February 07, 2012 05:15 AM

    Originally posted by: james87


    Dear guys,

    Im trying to write a piece of code that optimize a ratio of two decision variables. apparently the division of variables is not allowed. I tried to linearised this fractional programming problem but apparently 1/dvar is also an invalid declaration in opl. Please help! im desperate.
    Heres part of the code that i had which did not work

    ********************************************************************************************************************
    int SampleN=5;
    int AssetN=3
    dvar float+ xhttp://1..AssetNhttp://1..PeriodNhttp://1..SampleN; // Investment Level
    dvar float+ w_endhttp://1..SampleN;
    dvar float+ float Bsumhttp://1..SampleN;

    Minimize
    sum(k in 1..SampleN) 1/SampleN*(w_end[k]/Bsum[k]);

    forall(k in 1..SampleN)
    Bsum[k] == sum(i in 1..AssetN)Beta[i]*(x[i]PeriodN[k]/sum( j in 1..AssetN)x[j]PeriodN[k]);

    ********************************************************************************************************************
    Thank you!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Function operator/(dvar+,dvar+ float) not available in context CPLEX

    Posted Tue February 07, 2012 05:17 AM

    Originally posted by: james87


    didnt know why the last code turned out like that
    Dear guys,

    Im trying to write a piece of code that optimize a ratio of two decision variables. apparently the division of variables is not allowed. I tried to linearised this fractional programming problem but apparently 1/dvar is also an invalid declaration in opl. Please help! im desperate.
    Heres part of the code that i had which did not work

    ********************************************************************************************************************
    int SampleN=5;
    int AssetN=3
    dvar float+ xhttp:// 1..AssetN http:// 1..PeriodN http:// 1..SampleN ; // Investment Level
    dvar float+ w_endhttp:// 1..SampleN ;
    dvar float+ float Bsumhttp:// 1..SampleN ;

    Minimize
    sum(k in 1..SampleN) 1/SampleN*(w_end[k]/Bsum[k]);

    forall(k in 1..SampleN)
    Bsum[k] == sum(i in 1..AssetN)Beta[i]*(x[i] PeriodN [k]/sum( j in 1..AssetN)x[j]PeriodN[k]);

    ********************************************************************************************************************
    Thank you!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Function operator/(dvar+,dvar+ float) not available in context CPLEX

    Posted Tue February 07, 2012 05:20 AM

    Originally posted by: james87


    sorry guys, really duno how to unhyperlink the brackets, so i changed some of the [] to () instead

    Im trying to write a piece of code that optimize a ratio of two decision variables. apparently the division of variables is not allowed. I tried to linearised this fractional programming problem but apparently 1/dvar is also an invalid declaration in opl. Please help! im desperate.
    Heres part of the code that i had which did not work

    ********************************************************************************************************************
    int SampleN=5;
    int AssetN=3
    dvar float+ x(1..AssetN)(1..PeriodN)(1..SampleN); // Investment Level
    dvar float+ w_end(1..SampleN);
    dvar float+ float Bsum(1..SampleN);

    Minimize
    sum(k in 1..SampleN) 1/SampleN*(w_end[k]/Bsum[k]);

    forall(k in 1..SampleN)
    Bsum[k] == sum(i in 1..AssetN)Beta[i]*(x[i](PeriodN)[k]/sum( j in 1..AssetN)x[j](PeriodN)[k]);

    ********************************************************************************************************************
    Thank you!
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Function operator/(dvar+,dvar+ float) not available in context CPLEX

    Posted Tue February 07, 2012 05:27 AM

    Originally posted by: SystemAdmin


    The answer to the easy part of your post is to bracket the
    code snippet with {code}

    {code}
    a[i]
    {code}

    will result in

    a[i]
    


    Hope this will help.

    Regards
    Norbert
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Function operator/(dvar+,dvar+ float) not available in context CPLEX

    Posted Tue February 07, 2012 05:57 AM

    Originally posted by: james87


    Thank nobert. i've repost the same question in a better format in a separate thread.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer