Linear Programming - Optimization in Python with Gurobi (Part 2)

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024

Комментарии • 9

  • @DS-uo1zy
    @DS-uo1zy Год назад +3

    Thanks so much for the help! = 8, name = 'c1')
    c2 = opt_mod.addConstr(2*x + y >= 10, name = 'c2')
    c3 = opt_mod.addConstr(x + 4*y >= 11, name = 'c3')
    #6
    opt_mod.optimize() #solve the model
    opt_mod.write("linear_model.lp") #output the LP file of the model
    #7
    print('Objective Function Value: %f' % opt_mod.objVal)
    #Get values of the decision variables
    for v in opt_mod.getVars():
    print('%s: %g' % (v.varName, v.x))

  • @harunaadoga
    @harunaadoga 3 года назад +3

    Thank you, first time using gurobi, thanks once again.

  • @rfatk687
    @rfatk687 3 года назад +3

    It's a useful video, thanks.

  • @ward3680
    @ward3680 Год назад

    thanks lad, this saved me a lot of research work

  • @aidenmann6190
    @aidenmann6190 2 месяца назад

    Thanks!

  • @zahranamazian5540
    @zahranamazian5540 2 года назад

    Hi,
    I have an optimisation model in a "for loop"using Python and Gurobi. For each iteration I need to record the decision variables and use them as an input of next "for loop".
    I was wondering if you advise me how I can record the decision variables in each loop.
    Thanks

    • @CodingPerspective
      @CodingPerspective  2 года назад

      Hi Zahra,
      You can store them in a list and then use that list as an input in your loop.
      Best,
      The Team

  • @chiru4969
    @chiru4969 Год назад

    Can u also provide the repository for the source code, please

  • @CodingPerspective
    @CodingPerspective  3 года назад +1

    0:34 - What is linear programming
    1:48 - A small example of linear model
    3:54 - Solving the linear model in Python