Thank you for your response. As you recommended, it worked with the additional parentheses. I think the error without the additional parentheses is my grammar error or it might be a error from the parsing code of the AMPL. I can’t know the reason why the equation does not work without the parentheses. Anyway, thank you for letting me know it!
I’m currently studying this paper (https://hhoppe.com/proj/meshopt/). The problem I want to solve is
The code I wrote before is the version of solving the problem in the local context of mesh vertices, which means you get only one vertex to solve the energy function. I’m trying to solve this in the global context too by considering all of the vertices at once with the ampl solvers. So, the AMPL code might be different for the global context, but they are similar.
I guess that I could solve this problem for each axis (x-axis, y-axis, z-axis) to simplify the codes. The meaning of simplifying the code is that I think the readability will be better if I can use something like get_vector(index) -> return vector from the row i of a matrix
, length_vector(vector) -> return the length of the vector
, dist(vector_1, vector2) -> return the distance between two vectors
. But currently what I know is just to write all the functions manually to do this. So I just wish that I can use a custom user function in the minimization function.
I also added another question to solve the linear least squares problem in here (How to solve a linear least squares problem in a dense/sparse format). I think it’s not easy to write a code to solve this problem.