Skip to content

Commit

Permalink
Merge pull request #383 from lukaslueken/develop-nlp-diff
Browse files Browse the repository at this point in the history
Develop nlp diff
  • Loading branch information
4flixt committed May 24, 2023
2 parents ddc0a0e + 456b004 commit 585bbbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions do_mpc/differentiator/_nlpdifferentiator.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,13 @@ def differentiate(self, nlp_sol: dict, p_num: ca.DM) -> Tuple[ca.DM, ca.DM]:
else:
raise ValueError('p_num must be a float, int, np.ndarray or DM object. You have {}'.format(type(p_num)))

if not p_num.shape == (self.n_p, 1):
raise ValueError('p_num must have length {}.'.format(self.n_p))

# reduce NLP solution if necessary
if self.status.reduced_nlp:
nlp_sol, p_num = self._reduce_nlp_solution_to_determined(nlp_sol, p_num)

if not p_num.shape == (self.n_p, 1):
raise ValueError('p_num must have length {}.'.format(self.n_p))

# extract active primal and dual solution
z_num, where_cons_active = self._extract_active_primal_dual_solution(nlp_sol)

Expand Down
2 changes: 1 addition & 1 deletion examples/batch_reactor_differentiator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
class ASMPC:
def __init__(self, mpc):
self.mpc = mpc
self.nlp_diff = do_mpc.differentiator.DoMPCDifferentiatior(mpc)
self.nlp_diff = do_mpc.differentiator.DoMPCDifferentiator(mpc)
self.nlp_diff.settings.check_LICQ = False
self.nlp_diff.settings.check_rank = False
self.nlp_diff.settings.lin_solver = 'scipy'
Expand Down

0 comments on commit 585bbbd

Please sign in to comment.