Тёмный
No video :(

Optimization in Python: Pyomo and Gurobipy Workshop - Brent Austgen - UT Austin INFORMS 

INFORMS Student Chapter - UT Austin
Подписаться 578
Просмотров 41 тыс.
50% 1

Join UT INFORMS student chapter officer Brent Austgen for a tutorial in implementing math models with pyomo and gurobipy. The tutorial includes an overview of these frameworks, a walk-through of some examples, and Q&A.
The examples presented in this workshop are available at: github.com/brentertainer/pyom...
UT Austin INFORMS Student Chapter:
Twitter: / informs_ut
Website: connect.informs.org/universit...

Опубликовано:

 

11 фев 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 43   
@helenlu7518
@helenlu7518 3 года назад
Thanks Brent for tutoring! Looking forward to the next tutorial!
@Yosalsafiesta
@Yosalsafiesta 2 года назад
This is a wonderful tutorial!!! Thank you so much!
@Lux1431996
@Lux1431996 Год назад
Great explanation! Thank you very much. Greetings from Technical University Kaiserslautern, Germany :)
@helenlu7518
@helenlu7518 3 года назад
Excited!
@SiddharthDeo
@SiddharthDeo 3 года назад
Thanks for such nice explanation
@bosonglin7462
@bosonglin7462 Год назад
Great lesson!
@abramswee
@abramswee 2 года назад
thanks for sharing!
@ershibahuasheng2121
@ershibahuasheng2121 2 года назад
Thanks for sharing. Seems Helen also from my country.
@siyavashfilom9120
@siyavashfilom9120 2 года назад
Extremely helpful tutorial, many thanks for sharing
@tigabuabebe3261
@tigabuabebe3261 2 года назад
thank you. this is very helpul tutorial. please can you upload your tutorial about cost optimization from csv file?
@sabiqas
@sabiqas 3 года назад
Very helpful video. I wonder if it is possible to define multiple bounds for a variable in PYOMO. Eg: 1
@BrentAustgen
@BrentAustgen 3 года назад
It is possible. I think the most straightforward way is to pass a rule to the `bounds` keyword like below. >>> import pyomo.environ as pe >>> model = pe.ConcreteModel() >>> model.N = pe.RangeSet(2) >>> model.x_lbs = pe.Param(model.N, initialize={1: 1, 2: 4}) >>> model.x_ubs = pe.Param(model.N, initialize={1: 3, 2: 8}) >>> def generate_x_bounds(model, i): ... return (model.x_lbs[i], model.x_ubs[i]) ... >>> model.x = pe.Var(model.N, bounds=generate_x_bounds) >>> model.x.display() x : Size=2, Index=N Key : Lower : Value : Upper : Fixed : Stale : Domain 1 : 1 : None : 3 : False : True : Reals 2 : 4 : None : 8 : False : True : Reals
@robertaraujo347
@robertaraujo347 2 года назад
I found this tutorial very useful, now i know how to set n-dimensional parameters and decision variables according to the dimension of the dataframe. I wonder, what studies are coursing those students? is it sort of a master in operations research or it's just a course that contains oprimization topics?
@BrentAustgen
@BrentAustgen 2 года назад
Thank you, Robert. I (the presenter) am a PhD student in the Operations Research and Industrial Engineering program at UT-Austin. Most if not all of the attendees were also MS and PhD students in the same program. I was first introduced to Pyomo in 2013 while working on my undergraduate thesis, and I have built a working knowledge of it through various academic and industry projects. I know certain professors that favor this-or-that modeling or optimization tool, but they've never been the focus in any of my coursework. My intent for these tutorials is to bridge the gap between theory (classroom) and practice (research and industry).
@BB-kb8jd
@BB-kb8jd 2 года назад
Hello, Great example and video. Thank you. Could you also show how to import variable and parameter sets from an excel file to pyomo?
@BrentAustgen
@BrentAustgen 2 года назад
Sure, great idea!
@BrentAustgen
@BrentAustgen 2 года назад
I added an example to the repository linked in the description. It is in the directory labeled "loading_data".
@BB-kb8jd
@BB-kb8jd 2 года назад
Thank you Brent. I will be looking forward to new videos👍🏻
@MyChessGame98
@MyChessGame98 2 года назад
hello, i have one problem. I already build my model with the first method from pyomo. I tried to use gurobi as a solver but i take this error "GurobiDirect does not support expressions of degree None". I want to ask if i can use the gurobi only as a solver and if yes then what is the problem?
@BrentAustgen
@BrentAustgen 2 года назад
Without viewing the model implementation, it is difficult to say. My best guess is that the model includes a non-polynomial expression.
@dig4skullz
@dig4skullz 2 года назад
For the binary knapsack problem, what if you have two objectives?
@BrentAustgen
@BrentAustgen 2 года назад
Sorry for getting back to you so slowly. Would you please expand on how you mean this? Are you talking about vector-valued objectives? Or just multiple scalar-valued objectives that you can switch in and out as needed?
@wilsonmendes2649
@wilsonmendes2649 3 года назад
Thank you for this wonderful video. But I am not sure about the idea indexing a set with binary variable at 28:28 Could you please explain how it actually works? The word "Binary" is a bit misleading. I would appreciate if you could share some links/documents. Thank you once again!
@BrentAustgen
@BrentAustgen 3 года назад
In our first attempt at setting up the model, we created the variable objects one-by-one via model.x1, ... model.x5. This works, of course, but it is not scalable. Suppose we wanted to setup the same type of problem but with 1000 variables instead of 5. We would not want to write 1000 lines of code to set up model.x1, ..., model.x1000. So instead, we define an index set N = {1, ...., 1000} so that we can define all 1000 variables in a single line of code. In the line of code model.x = pe.Var(model.N, domain=pe.Binary), the positional argument model.N tells Pyomo to create a variable for each item in the set N. In other words, object model.x becomes indexed in model.N. So whereas before we had 5 different objects model.x1, ... model.x5, we now have one object model.x that is indexed and accessed as model.x[1], ..., model.x[5]. The keyword argument domain=pe.Binary tells Pyomo that each variable is only allowed to assume a value of 0 or 1. If the domain is not specified, Pyomo assumes by default that each variable is defined on the real number line (i.e., pe.Reals). The Pyomo documentation is reasonably well-written. I recommend you check out these links: 1. the Var class: pyomo.readthedocs.io/en/stable/library_reference/aml/index.html?highlight=pe.Var#pyomo.environ.Var 2. predefined virtual sets: pyomo.readthedocs.io/en/stable/pyomo_modeling_components/Sets.html#predefined-virtual-sets
@julatehmulbah
@julatehmulbah 3 года назад
is there a way to install the glpk solver in python
@BrentAustgen
@BrentAustgen 3 года назад
The glpk solver (sometimes called glpsol) is a piece of software that is installed separately from Python. There is also a glpk package for Python that serves as an alternative to pyomo. If you want to use glpk with pyomo, you first need to install the glpk package (for Windows/Linux/macOS), then just change SolverFactory('gurobi') to SolverFactory('glpk') in the Python code.
@BrentAustgen
@BrentAustgen 3 года назад
I recently learned a very simple way to setup GLPK for Python/Pyomo. If you use Anaconda to manage your Python environments, you can simply `conda install glpk` to install the glpsol binary to the active environment. As long as you are in that environment, you can invoke glpsol (e.g., from pyomo).
@raihanmasud3578
@raihanmasud3578 3 года назад
Nice and helpful video. However two commen errors in github codes. (1) graph.nodes or, graph.edges are not iterable. (2) module 'matplotlib.cbook' has no attribute 'is_string_like'. I am wondering if you could update the github codes. Thank you in advance.
@BrentAustgen
@BrentAustgen 3 года назад
Thanks for the notice. I just checked and all the notebooks run without these issues in my environment. Would you mind identifying which cells in which notebooks are failing? And also which version of networkx and matplotlib you are using? You are welcome to open an issue on GitHub.
@raihanmasud3578
@raihanmasud3578 3 года назад
@@BrentAustgen Thank you so much for your reply. I am not sure but it could be a version mismatch. I am using version '1.11' and '3.1.1' of 'networkx' and 'matplotlib' respectively. Would you like to share the versions that you used to run? Thank you in advance.
@BrentAustgen
@BrentAustgen 3 года назад
@@raihanmasud3578 Same for matplotlib, but I am using version 2.4 of networkx. I will check if that is the issue. If it is, I will reimplement to accommodate both versions.
@BrentAustgen
@BrentAustgen 3 года назад
@@raihanmasud3578 And come to think of it, this is a great consideration. I should include the list of what all libraries/versions are in my environment in the repository.
@raihanmasud3578
@raihanmasud3578 3 года назад
@@BrentAustgen Yes, It would be a nice idea if you could include all versions including python version also. Thank you.
@lwandilemarudulu7950
@lwandilemarudulu7950 3 года назад
Is it possible to solve multiple LPP's within pyomo?
@BrentAustgen
@BrentAustgen 3 года назад
I take LPP to mean linear programming problem, but correct me if you mean otherwise. Do you mean solving multiple problems in parallel?
@lwandilemarudulu7950
@lwandilemarudulu7950 2 года назад
Yes a linear programming problem where the parameters for a certain constraint change
@tigabuabebe3261
@tigabuabebe3261 2 года назад
model.n = pe.Var(domain=pe.Binary) model.m = pe.Var(domain=pe.Binary) model.k = pe.Var(domain=pe.Binary) ********* gives this error; what shall i do WARNING: Implicitly replacing the Component attribute n (type=) on block unknown with a new Component (type=). This is usually indicative of a modelling error. To avoid this warning, use block.del_component() and block.add_component(). WARNING: Implicitly replacing the Component attribute m (type=) on block unknown with a new Component (type=). This is usually indicative of a modelling error. To avoid this warning, use block.del_component() and block.add_component(). WARNING: Implicitly replacing the Component attribute k (type=) on block unknown with a new Component (type=). This is usually indicative of a modelling error. To avoid this warning, use block.del_component() and block.add_component().
@BrentAustgen
@BrentAustgen Год назад
It seems like model.n was already defined before you tried making it a Var.
@lwandilemarudulu7950
@lwandilemarudulu7950 2 года назад
Is it possible to get ur email @Brent, I have an DEA optimization model I'd like to implement in pyomo. But I'm struggling a bit.
@BrentAustgen
@BrentAustgen 2 года назад
My full name is the description of this video. If you search for that online, my website should be one of the top hits, and you can find my contact information there.
@lwandilemarudulu7950
@lwandilemarudulu7950 Год назад
I managed to solve my problem sir. Thank you.
Далее
skibidi toilet 77 (part 1)
03:51
Просмотров 14 млн
Python I webinar: Introduction to Modeling with Python
54:03
The Art of Linear Programming
18:56
Просмотров 648 тыс.
Gentle Intro to Pyomo Concrete Models
24:08
Просмотров 7 тыс.
Optimize with Python
38:59
Просмотров 13 тыс.
PuLP Tutorial: Linear Programming in Python
19:24
Просмотров 13 тыс.
Optimization in Python
38:08
Просмотров 11 тыс.
skibidi toilet 77 (part 1)
03:51
Просмотров 14 млн