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

setObjectiveN() doesn't accept priority

回答済み

コメント

2件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Riley Clement
    • Gurobi Staff

    Hi Sonia,

    You should be able to set the priority through the setObjectiveN method.

    If your IDE is suggesting otherwise then this may be a limitation of the IDE.

    If you're using an interactive Python session then you can use

    import gurobipy as gp
    print(gp.Model.setObjectiveN)

    to print the documentation to your screen:

    setObjectiveN(self, expr, index, priority=0, weight=1.0, abstol=1e-06, reltol=0.0, name='')
        ROUTINE:
          setObjectiveN(expr, index)
        
        PURPOSE:
          Set the model objective equal to a LinExpr or QuadExpr
        
        ARGUMENTS:
          expr:     The desired objective function.  The objective can be
                    a linear expression (LinExpr) a variable (Var) or a constant.
                    This routine will replace the 'ObjNVal' attribute on model variables
                    with the corresponding values from the supplied expression for
                    multi-objective 'index'
          index:    Identify which multi-objective to set
          priority: Set the ObjNPriority attribute for this multi-objective (default is zero)
          weight:   Set the ObjNWeight attribute for this multi-objective (default is 1.0)
          abstol:   Set the ObjNAbsTol  attribute for this multi-objective (default is 1e-6)
          reltol:   Set the ObjNRelTol  attribute for this multi-objective (default is zero)
          name:     multi-objective name (default is no name)
        
        RETURN VALUE:
          None.
        
        EXAMPLE:
          model.setObjectiveN(x + y, 1)
          model.setObjectiveN(x + y + 2*z, 2)

    - Riley

    0

投稿コメントは受け付けていません。