メインコンテンツへスキップ

Approximation of non-linear functions

ユーザーの入力を待っています。

コメント

2件のコメント

  • Riley Clement
    • Gurobi Staff

    Hi Lasse,

    You can actually get Gurobi to use a static PWL approximation using the FuncNonLinear parameter.

    Can you try this first?

    - Riley

     

    0
  • Jaromił Najman
    • Gurobi Staff

    Hi Lasse,

    If you are using version 12+ then you should try using Gurobi's nonlinear expressions to write your constraints.

    For your particular function this would be something like

    import gurobipy as gp
    from gurobipy import nlfunc
    
    resultvar = model.addVar(lb=-gp.GRB.INFINITY)
    model.addConstr(resultvar == base + (1 + base)*(1 - gp.nlfunc.exp(-k*r))

    Note that every nonlinear constraint has to be an equality constraint and be equal to an optimization variable.

    If this still does not solve your problem, then you can follow Riley's recommendation about the PWL approximation.

    Best regards, 
    Jaromił

    0

サインインしてコメントを残してください。