Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

make pyomo problem definition more efficient

$
0
0

I am defining a problem in pyomo a MINLP one.Let's say I have 1000 decision variables and in my problem, some of the decision variables can interact with each other (cross effects). I am defining the interaction thanks to a matrix then in Pyomo I am using pe. Param and giving it a dictionnary for this.

The assignation of this param is slow and the assignation of the objective function is also slow.Below a preview of this dictionary used a param:enter image description here

How can I make the assignation faster? It's worth mentioning that my matrix is sparse.

Below how the matrix is used :

model.obj = pe.Objective(        expr=sum(            (                self.model.decision_var[i]                * (                    pe.exp(                        sum(                            self.model.the_matrix[i, j]                            * pe.log(self.model.decision_var[j])                            for j in self.model.decision_id                        )+ self.model.intercept[i]                    )                )            )            for i in self.model.decision_id        ),        sense=pe.maximize,    )

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>