Skip to main content

Spot rate curve

Awaiting user input

Comments

1 comment

  • Mario Ruthmair
    • Gurobi Staff

    Hi Daniel,

    Indeed, formulating this function in a Gurobi model is a bit involved.

    First, you do not need addGenConstrPow() for quadratic terms, those are directly supported in the constraint formulation. In your case, you can remove variable SS, just state "... = S * S" in your sum constraints, and minimize S.

    Regarding the fraction in the sum, as far as I can see from your code only the r(t) are variables, correct?
    If yes, then you could create additional helper variables x(i,t) that are equivalent to the fraction for i and t, variables y(t) that correspond to (1+r(t)), and variables z(t) that correspond to y(t) ^ t. This leads to constraints

    S*S = sum_{i=1 to N} [ P(0,i) - sum_{t=1 to T} x(i,t) ]
    x(i,t) * z(t) = F(t,i)
    z(t) = y(t)^t (implemented via addGenConstrPow())
    y(t) = 1 + r(t)

    Except for the 3rd constraints, you can write every constraint in a straightforward way with addConstr().

    Did I miss something?

    Best regards,
    Mario

    0

Please sign in to leave a comment.