Replies: 3 comments 7 replies
-
Any comment? I cannot really understand what is wrong with this example. |
Beta Was this translation helpful? Give feedback.
-
Can you detail the problem you have ? opti = cas.Opti()
n = 101
x1 = np.linspace(0, 2, n).tolist()
y1 = [non_casadi_function_1(i) for i in x1]
x2 = np.linspace(-1, 1, n).tolist()
y2 = [non_casadi_function_2(i) for i in x2]
m = 10
x1_opt = opti.variable(m)
x2_opt = opti.variable(m)
F1_interp= cas.interpolant('cs_interp','linear',[n],1,{"inline": True})
F1 = F1_interp(x1_opt,x1,y1)
F2_interp= cas.interpolant('cs_interp','linear',[n],1,{"inline": True})
F2 = F2_interp(x2_opt,x2,y2) |
Beta Was this translation helpful? Give feedback.
-
Hi all, I created a working example with real data; please find it here: https://github.com/mrrezaie/testCASADI. I would be greatly grateful if you could take a look and let me know what is wrong with the interpolant functions. The formulation can be changed in the lines 5-6. Everything is well with mathematical functions. When running interpolants, pay attention to the memory usage. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying to use non-casadi functions to write my constraints, and I already know that
Callback
should be used, but I cannot handle the derivatives as I posted this earlier: #3580Indeed, the non-casadi functions create non-linear curves and my formulation with somehow equivalent exponential and polynomial functions works very well (converged very efficiently), but not good enough and I want to use the exact curves generated by the non-casadi functions. I was wondering if it's possible to do this with
interpolant
instead:Does this example make sense? I don't get any error, but my objective is being maximized (never converged) which means something is wrong with my formulation.
Any help is greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions