Is it possible to impose an optimisation constraint using the derivatives computed by StiffnessModule.js?
It’s not currently possible, but could be achieved – see below. However, I’m not that confident even if it was configured to do that it would be successful. Stiffnesses are computed by making small perturbations in a converged solution. During an optimisation, derivatives of the constraints with respect to solution parameters are required. So, if stiffness outputs were used as constraints, the solver would be computing the numerical derivative of a numerical derivative – and the numerical accuracy here could prove a challenge for the optimiser.
Currently the constraints can only be set from block outputs from type “Constraint”. With a JavaScript runtime change, it’s actually not that hard to achieve. Model instantiates “Goal” which iterates through the blocks to find the constraints. It then sets up the structure to send the constraints to the solver. It would be possible to change it to take module outputs as well. It doesn’t need a C++ code change, but would probably need some support from SumToZero.