Commit 7f976979 authored by Jorn Baayen's avatar Jorn Baayen

We don't need mark parameters as being 'dynamic' any longer.

Dynamic parameters were not substituted into the model prior to collocation, so that they
could be re-inserted into the cached collocated model at a later stage.  Now that we use
external functions as models, we no longer pre-substitute any parameters into the model
prior to collocation any longer.
parent 852267b3
......@@ -148,10 +148,6 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass = A
collocation_times = self.times()
n_collocation_times = len(collocation_times)
# Dynamic parameters
dynamic_parameters = self.dynamic_parameters()
dynamic_parameter_names = set()
# Create a store of all ensemble-member-specific data for all ensemble members
ensemble_store = [{} for i in range(self.ensemble_size)] # N.B. Don't use n * [{}], as it creates n refs to the same dict.
for ensemble_member in range(self.ensemble_size):
......@@ -167,12 +163,6 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass = A
except KeyError:
raise Exception("No value specified for parameter {}".format(variable))
if len(dynamic_parameters) > 0:
jac = jacobian(vertcat(*parameter_values), vertcat(*dynamic_parameters))
for i, symbol in enumerate(self.dae_variables['parameters']):
if jac[i, :].nnz() > 0:
dynamic_parameter_names.add(symbol.name())
if np.any([isinstance(value, MX) and not value.is_constant() for value in parameter_values]):
parameter_values = substitute_in_external(parameter_values, self.dae_variables['parameters'], parameter_values)
......
......@@ -44,17 +44,6 @@ class HomotopyMixin(OptimizationProblem):
return parameters
def dynamic_parameters(self):
dynamic_parameters = super(HomotopyMixin, self).dynamic_parameters()
if self._theta > 0:
# For theta = 0, we don't mark the homotopy parameter as being dynamic,
# so that the correct sparsity structure is obtained for the linear model.
options = self.homotopy_options()
dynamic_parameters.append(self.variable(options['homotopy_parameter']))
return dynamic_parameters
def homotopy_options(self):
"""
Returns a dictionary of options controlling the homotopy process.
......
......@@ -339,15 +339,6 @@ class OptimizationProblem(metaclass = ABCMeta):
"""
return AliasDict(self.alias_relation)
def dynamic_parameters(self):
"""
Returns a list of parameter symbols that may vary from run to run. The values
of these parameters are not cached.
:returns: A list of parameter symbols.
"""
return []
def constant_inputs(self, ensemble_member):
"""
Returns a dictionary of constant inputs.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment