Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  help with objective function (operator not available for string +int)

    Posted 03/25/13 09:20 PM

    Originally posted by: SystemAdmin


    Hello,

    I am not used with CPLEX thus in other softwares this problem never happened to me, let me see if you might know how i can do this:

    I am using a objective function that uses a binary decision variable lets say Y[i][j]
    My objective function (maximization) will calculate a price if there Y exists in [i][j], this is Y[i][j] * Price, but will discount a penalty if Y exists in i+1[j], this is Yi+1[j] * Penalty. In the end the function would be something like:

    maximize sum (i in days, j in years) Y[i][j] * Price - Yi+1[j] * Penalty

    But this brings an error: operator not available for string +int

    if I use Y[i][j] * Price - Y[i][j] * Penalty (no i+1) the optimization runs smoothly.

    days is defined as a string, {string} Days =...; and is associated with a excel table something like this C2:E2 (monday, tuesday, sunday). Might this be the problem, to have the index as a string and therefore not possible to calculate the i+1?
    How can I implement this?

    Also I was told about a next() function that might help me on this. Can I implement it inside the objective/decision function?

    Thank you for the help.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: help with objective function (operator not available for string +int)

    Posted 03/26/13 04:02 AM
    Hi,

    indeed next could help you, it will give you the next one in a string set like the days in the week.
    But you may also use the function ord that will turn Monday into its rank in the set. To do the opposite, ie turn a rank in an element you may then use item.
    All those keywords are in the documentation.
    I hope this helps.

    Regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: help with objective function (operator not available for string +int)

    Posted 03/26/13 07:17 AM

    Originally posted by: SystemAdmin


    I will check on these and Will get back to let you know if I could manage my problem with.

    Thank you.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: help with objective function (operator not available for string +int)

    Posted 03/27/13 07:42 AM

    Originally posted by: SystemAdmin


    Ok, I used the next and was able to solve the problem (i checked the solution on excel and the objective function values match thus they are beeing well calculated).

    I will open a new question thread with some futher questions with a better subject so other people might find it.
    I hope you can check this threat I will create since it regards your suggested functions.

    Best regards,
    Marco Amorim
    #DecisionOptimization
    #OPLusingCPLEXOptimizer