Skip to content

MathOpt LinearTerm v. LinearProduct #4678

Answered by rma350
DimitrisMantas asked this question in Q&A
Discussion options

You must be logged in to vote

For most users, how you build your model does not matter much. Write the simplest possible (often with operator overloads) that that is asymptotically optimal for model building and ignore constant factors. When you run the code, if you notice that model building time is a meaningful fraction of total time, and model build time + solving time is a meaningful fraction of application time (e.g. maybe reading the database to fetch you data is slower), then it is time to optimize (this is uncommon, but does happen).

Some specific tips on improving Python performance: Calling mathopt.fast_sum(), rather than the build in Python sum(), will result in fewer objects being created to represent the …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@DimitrisMantas
Comment options

@rma350
Comment options

rma350 Jun 11, 2025
Collaborator

Answer selected by DimitrisMantas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Solver: MathOpt MathOpt related issue
2 participants