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

Adding Constraints to variables in Excel sheet

回答済み

コメント

4件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three 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.
  • Jaromił Najman
    • Gurobi Staff

    What is your question?

    Are you asking how to read Excel Sheet data? If yes, then you can use pandas for this, see How to Import an Excel File into Pyhton using Pandas?

    0
  • Aadav Srimushnam Sundaranathan
    • Gurobi-versary
    • First Comment
    • First Question

    No. As I look to add constraints to variables in a table (with i rows and j columns), I am getting an error for the following syntax: 

    m.add_constr(Supply[i][j].value <= 400 for i in range(dem_r) for j in range(dem_c))

    Can you please suggest the right method to add constraints to variables in a table.

     

    0
  • Jaromił Najman
    • Gurobi Staff

    It is hard to help here, because you did neither provide a reproducible example nor the error message you get.

    My guess would be that you are using a wrong method. Instead of \(\texttt{add_constr}\), you should probably use the addConstrs method.

    0

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