Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

What about implementing universal numeric solver/optimizer?

konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
edited January 2018 in FeatureScript
From time to time there appear tasks that requare finding numeric solutions and optimization of some numeric dependences, like for example finding minimum box body of geometry or finding length of an arc of the curve given by arbitary length parameter (which was obtained without arc length parametrization). So the general solution could be implementing in FS some kind of "numeric optimizator" function that would take lambda, range of arguments, initial guess and requared accuracy and return extremum point in parameter space (or a number of points). How do you concider the value of such functionality?

Comments

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    ok, now i found out that nobody likes numeric optimization :'(
    but at least what about spline interpolation of numeric arrays?
    and more general question - what is FS developers policy in the area of geometry related numeric calculations? from what i have seen on forum FS is not supposed to be used for implementing advanced numeric tasks.
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,212
    edited March 2018
    I like numerical optimization (used it all the time in my days as a graphics researcher), but it's not like sorting or even linear equation solving -- there's no one algorithm for nonlinear optimization that gives the "right" result.  Algorithms vary widely in terms of their performance on different kinds of problems, structure (sparsity/symmetry/bandedness/etc) support, inequality constraint support, derivative requirements (keep in mind that even with automatic differentiation, we cannot compute the derivative of a Parasolid operation), convergence rates, etc.  And without a good initial guess, nonlinear algorithms won't work.  We'd rather implement special solutions for things like arc length from parameter than to try to bring in a catch-all optimization or solving method.

    We do expose a little linear algebra, including basic matrix operations and singular value decomposition, which could be used for linear solving and linearly-constrained least squares (i.e., minimize |Ax-b|^2 subject to Cx=d), though not with amazing efficiency.  Depending on the kind of spline interpolation of numeric arrays that you're talking about, this may help.  The simplest way I can think of (Catmull-Rom) is relatively easy to do in raw FS and should be quick.

    In general, we don't have a "policy" on numeric calculations but rather the current performance constraints of FS as an interpreted language imply that if what you're doing involves a lot of large loops, nested function calls, etc. (rather than the bulk of the work being done in builtin functions), there may be other faster ways of doing it.  It's a little bit like working with Matlab -- as long as what you're doing is vectorized, you're ok, but as soon as you have to iterate over a large matrix it slows down a lot.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    Thanks @ilya_baran, once i'll make an attempt to implement interpolation
Sign In or Register to comment.