Beginner's Guide to Pyomo for Abstract Linear Programs - Sets Parameters and Data Files (Part 1)

Поділитися
Вставка
  • Опубліковано 22 гру 2024

КОМЕНТАРІ • 15

  • @Md.MishkatulAnwar
    @Md.MishkatulAnwar 15 днів тому

    Very helpful, thank you so much!

  • @davidavornyo128
    @davidavornyo128 2 роки тому +1

    Just what I've been looking for. This is awesome. Thanks

  • @hoangdinh9595
    @hoangdinh9595 Рік тому +1

    Thank you for this video! It really helps!

  • @baturaykus4438
    @baturaykus4438 Рік тому

    Thank you Dr. Katie. You're the best.

  • @roehlanobriones3179
    @roehlanobriones3179 Рік тому

    Thank you for this Dr. Katie. Maximally helpful.

  • @TiGGowich
    @TiGGowich Місяць тому

    Can you use this approach when your source file is .xlsx so excel files?

  • @boruicui8213
    @boruicui8213 6 місяців тому

    Hi Katie. Thanks a lot for your kind lectures. I have a question about the 'set' in .dat file. In your case, 'month' is simple which is sort of a list just including 5 elements. But how about I tend to use/introduce timeindex (e.g., Pandaframe index) values to be a set variable 'time'? It could be very long since there will be 1440 elements if the time interval is one minute for one day (24*60). how could I realize that? do I need to type them into a .dat file manually?

    • @DrKatieRIT
      @DrKatieRIT  6 місяців тому

      I would recommend within your model file using a range set. So you could do something like: model.MONTHS = RangeSet(1,timeindex.length(),1) This would create a set with the numbers 1 through the length of the number of elements in your panda data frame, then just leave the set definition out of the data file.

  • @jamesong6208
    @jamesong6208 Рік тому

    This is beautiful. Any chance a copy of the files can be provided as it just shortens definition time and avoids syntax errors

    • @DrKatieRIT
      @DrKatieRIT  Рік тому +2

      Hi James! Making those syntax mistakes and fixing them is part of the learning process. If you ever get too stuck just reach out and I'd be happy to help.

  • @MuhammadWAQAS-pq5jb
    @MuhammadWAQAS-pq5jb 2 роки тому

    Content like this is highly appreciated. Thank You, Professor Katie.
    I am trying to reproduce the same and
    With
    data=DataPortal()
    data.load(filename='abstractmodelcreation.dat', model=model)
    instance = model.create_instance(data)
    the error is:
    AttributeError: 'DataPortal' object has no attribute 'is_constructed'
    while with,
    data=DataPortal()
    data.load(filename='abstractmodelcreation.dat', set=model.MONTHS)
    instance = model.create_instance(data)
    the error is
    ValueError: Parameter 'salaryExp' defined with '1' dimensions, but data has '1' values: [2000]. Are you missing a value for a 1-dimensional index?

    • @katiemcconky938
      @katiemcconky938 2 роки тому +1

      Errors in these models can be finicky and hard to find. The error messages are often not particularly helpful either. Check the parameter for salaryExp matches in both your model and data file. Make sure salaryExp has no sets listed in its declaration. Finally, I’d be happy to take a look at your files if you use Google colab and share them with me.

    • @DrKatieRIT
      @DrKatieRIT  2 роки тому +1

      All set! You were missing the () after model = AbstractModel, is should say model=AbstractModel(). Assuming your data file is correct (I had to use my own), everything will work fine once you add in those (). If it doesn't work, take a look at your data file.

    • @MuhammadWAQAS-pq5jb
      @MuhammadWAQAS-pq5jb 2 роки тому

      @@DrKatieRIT I really appreciate your prompt solution. Yeah, it is working now. You are awesome.