汉涛 田

  • Gurobi-versary
  • First Comment
  • First Question
  • Total activity 12
  • Last activity
  • Member since
  • Following 0 users
  • Followed by 0 users
  • Votes 0
  • Subscriptions 4

Activity overview

Latest activity by 汉涛 田
  • 汉涛 田 created a post,

    Issue with Adding Constraints in Gurobi Using Data from Excel

    Answered

    Hello, I'm currently working on an optimization model using Gurobi and I have encountered an issue when trying to add constraints. My model involves reading data from an Excel file and using it to ...

  • 汉涛 田 commented,

    thank you for your help. But I still met a problem. ⬇ ⬇ ⬇ def gurobi(time, ESS): buy_prices = [0.27, 0.27, 0.27, 0.27, 0.27, 0.27, 0.27, 0.49, 0.49, 0.49, 0.83, 0.83, 0.83, 0.49, 0.49, 0.49, 0....

  • 汉涛 田 commented,

    Thank you for your reply, but I still feel some confusion. "X=m. addVars (hours, ub=8, vtype=GRB. CONTANUOUS, name=" storage ")" The upper limit of storage has been set to 8 in the formula, So ho...

  • 汉涛 田 commented,

    Why would the result be 0? If I buy 5 at moment 0 and sell 5 at moment 2, then I can earn 3 * 5-2 * 5=5. Is it the result of a logical error in the code that caused the error

  • 汉涛 田 commented,

    thank you for your help. But the code met one error in constraints 2.“ gurobipy.GurobiError: Constraint has no bool value (are you trying "lb <= expr <= ub"?) ”

  • 汉涛 田 created a post,

    to solve an optimal solution for a time period

    Answered

    What should I do if I want to solve an optimal solution for a time period? Let's say there are variables - energy storage x, constants - electricity price (buy/sell). Over a period of 5 hours, the ...

  • 汉涛 田 created a post,

    something problems in Python code

    Answered

    How can I express this problem in the language of gurobi 11 (python code), my own code always gives errors: variable x when x>=0,objective=2*x whenx<0,objective=-3*|x| -10

  • 汉涛 田 created a post,

    something problems in Python code

    import gurobipy from gurobipy import * m = Model("mip1") # 创建常量 pbuy = 0.27 psold = 0.13 gsold = 0.2 gbuy = 0.4 pload = 56.079715030976004 hload = 40.37739482230272 gload = 43.768518510060744 ppv =...