Rapid-Design-of-Systems-Laboratory / beluga

General purpose indirect trajectory optimization
Other
25 stars 6 forks source link

Error with using direct methods #170

Open SeanMatthewNolan opened 5 years ago

SeanMatthewNolan commented 5 years ago

I got this error when I tried to solve the brachisto example with direct and shooting:

Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm 2018.2.2\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "C:\Program Files\JetBrains\PyCharm 2018.2.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:/Users/SeanM/Documents/Purdue/beluga/examples/2-brachistochrone/brachisto.py", line 62, in <module> guess_generator=guess_maker, autoscale=True) File "D:\Users\SeanM\Documents\Purdue\beluga\beluga\beluga.py", line 319, in solve out = run_continuation_set(bvp.raw, bvp_algorithm, steps, solinit, bvp, pool, autoscale) File "D:\Users\SeanM\Documents\Purdue\beluga\beluga\beluga.py", line 177, in run_continuation_set sol = bvp_algo.solve(sol_guess, pool=pool) File "D:\Users\SeanM\Documents\Purdue\beluga\beluga\bvpsol\Shooting.py", line 474, in solve opt = minimize(cost, Xinit, method=self.algorithm, tol=self.tolerance, constraints=[constraint], options={'maxiter': self.max_iterations}) File "C:\Users\SeanM\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\_minimize.py", line 609, in minimize constraints, callback=callback, **options) File "C:\Users\SeanM\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\slsqp.py", line 313, in _minimize_slsqp for c in cons['eq']])) File "C:\Users\SeanM\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\slsqp.py", line 313, in <listcomp> for c in cons['eq']])) File "D:\Users\SeanM\Documents\Purdue\beluga\beluga\bvpsol\Shooting.py", line 406, in _constraint_function_wrapper return _constraint_function(X, pick_deriv, pick_quad, n_odes, n_quads, n_dynparams, self.num_arcs, sol.const) File "D:\Users\SeanM\Documents\Purdue\beluga\beluga\bvpsol\Shooting.py", line 402, in _constraint_function g = _gamma_maker(deriv_func, quad_func, g, _params, sol, prop, pool, n_quads) File "D:\Users\SeanM\Documents\Purdue\beluga\beluga\bvpsol\Shooting.py", line 144, in _make_gammas

SeanMatthewNolan commented 5 years ago

I found that this occurs with collocation and psuedospectral methods

msparapa commented 5 years ago

Weird. It should fail with shooting because I never wrote a direct shooting method, but pseudospectral and collocation should be good to go. I'll look into this.

msparapa commented 5 years ago

So I tried this w/ collocation and pseudospectral methods and both fail, but not in the way you describe. They run, but don't converge to anything useful. Sometimes pseudospectral fails inside of npnlp where I wrote the decomposition.

Shooting on the other hand should already have a raise NotImplementedError when you have a problem that contains control variables.