Speed up sol[UnaryExpr] via C-level math and refactor UnaryExpr - #1224
Conversation
…r unary expressions Remove Python math module and use libc.math for C-level functions (fabs, exp, log, sqrt, sin, cos). Refactor unary expression evaluation by introducing specific subclasses (AbsExpr, ExpExpr, LogExpr, SqrtExpr, SinExpr, CosExpr) with dedicated evaluate methods using C functions, replacing the generic UnaryExpr implementation.
Update UnaryExpr type stubs to include concrete expression subclasses for more precise type annotations. This change refines the return type of __abs__ and introduces new expression classes. - Change __abs__ return type from GenExpr to AbsExpr - Add AbsExpr, ExpExpr, LogExpr, SqrtExpr, SinExpr, and CosExpr classes - All new classes inherit from UnaryExpr
UnaryExpr
UnaryExprUnaryExpr
UnaryExprsol[UnaryExpr] via C-level math and refactor UnaryExpr
|
By the way, @Zeroto521 , out of curiosity. Are you also using PySCIPOpt for your work, or are you just speeding things up for fun? |
|
80% of the OR problems I encounter use commercial solvers or our closure algorithms for large-scale, speed-critical cases, while the rest use open-source ones for small tasks and research. |
|
I see @Zeroto521 , thank you! We're actually in the process of collecting users of SCIP "in the wild", particularly in industry. Would it be possible for us to reference the work you're doing? We can talk via email, if you prefer: joao.goncalves.dionisio@gmail.com |
|
Hey @Zeroto521 , just wanted to let you know that I'm going to be quite busy until the end of August, but by then I will be able to take a proper look at the repo. Are there other changes you're planning on making? |
Yeah, I've already finished the basic version (drop |
Updated mypy output to reflect changes in type assertions and unused comments.
Co-authored-by: João Dionísio <57299939+Joao-Dionisio@users.noreply.github.com>
Joao-Dionisio
left a comment
There was a problem hiding this comment.
Thank you once again @Zeroto521 ! Very happy to see that #1074 is nearly finished, great job!
This branch is 1.45x faster than master.