No video

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

  Рет қаралды 40,467

INFORMS Student Chapter - UT Austin

INFORMS Student Chapter - UT Austin

3 жыл бұрын

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...

Пікірлер: 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!
@siyavashfilom9120
@siyavashfilom9120 2 жыл бұрын
Extremely helpful tutorial, many thanks for sharing
@ershibahuasheng2121
@ershibahuasheng2121 2 жыл бұрын
Thanks for sharing. Seems Helen also from my country.
@abramswee
@abramswee 2 жыл бұрын
thanks for sharing!
@tigabuabebe3261
@tigabuabebe3261 Жыл бұрын
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👍🏻
@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
@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.
@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).
@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
@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.
@tigabuabebe3261
@tigabuabebe3261 Жыл бұрын
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 Жыл бұрын
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.
Optimization in Python: Intermediate Pyomo Workshop - Brent Austgen - UT Austin INFORMS
59:57
INFORMS Student Chapter - UT Austin
Рет қаралды 13 М.
Gentle Intro to Pyomo Concrete Models
24:08
Dr. Katie
Рет қаралды 7 М.
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 94 МЛН
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 139 МЛН
小宇宙竟然尿裤子!#小丑#家庭#搞笑
00:26
家庭搞笑日记
Рет қаралды 20 МЛН
SciPy Tutorial (2022): For Physicists, Engineers, and Mathematicians
1:33:29
Webinar: Building Gurobi Models from Pandas Dataframes
55:48
Gurobi Optimization
Рет қаралды 3 М.
The Tragedy of systemd
47:18
linux.conf.au
Рет қаралды 1,1 МЛН
Imperative vs Declarative Programming
4:44
uidotdev
Рет қаралды 296 М.
The Art of Linear Programming
18:56
Tom S
Рет қаралды 646 М.
Optimization with Python: The Pyomo Approach by Dr. Carlos Zetina on February 25, 2022
1:02:04
MORSC - Montreal OR Student Chapter
Рет қаралды 9 М.
What Is Kotlin Multiplatform And How Does It Work? - KMP for Beginners
10:17
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 94 МЛН