Matrix constraint

322 views
Skip to first unread message

bl...@ncsu.edu

unread,
Nov 13, 2018, 11:04:20 PM11/13/18
to Pyomo Forum
Hi everyone,

I have a LP problem involving a constraint of -b <= A*x <= b, where A is a large dense matrix and b is a column vector. Now the problem is that Pyomo can only build one row each time, which is super slow, since the A matrix has several thousand of rows. Building this constraint takes over 90% of the model instantiation time in my case. So I am wondering if there is a more efficient way to do this. 

I notice there is a module called matrix_constraint in Pyomo, but there is few examples showing how to use it. Does anyone know anything about it?

Thanks,

Binghui Li

Salvador Pineda

unread,
May 31, 2021, 10:39:52 AM5/31/21
to Pyomo Forum
You can do that with pyomo.core.kernel (https://pyomo.readthedocs.io/en/stable/library_reference/kernel/constraint.html) but not with pyomo.enviroment (as far as I understand). Did you find something useful?

David Woodruff

unread,
May 31, 2021, 11:42:59 AM5/31/21
to pyomo...@googlegroups.com
Maybe using the LinearExpression component would be helpful:

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/804d6e92-2a70-4a99-8d70-c3a690c5a55fn%40googlegroups.com.

Binghui Li

unread,
Jun 5, 2021, 12:03:27 AM6/5/21
to pyomo...@googlegroups.com
Thanks to both of you. The model has been completed using the old-fashioned way, i.e., building the constraints row by row, but I will give it a try to see how much improvement I can have. 

Interestingly, the original discussion was posted almost 3 years ago and I didn't remember if Pyomo had LinearExpression that time. 

Best,
Binghui

You received this message because you are subscribed to a topic in the Google Groups "Pyomo Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyomo-forum/5ptgjmrKsnw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/CAERj1nUnBV43JWR-Du3dt0YSSMGpsZn%2BtWD_idHxnTS0%3De60kw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages