Commit 27aa1984 authored by Jorn Baayen's avatar Jorn Baayen

Fix a unit test.

parent b1cfaa99
......@@ -4,6 +4,7 @@ from test_case import TestCase
from rtctools.optimization.collocated_integrated_optimization_problem import CollocatedIntegratedOptimizationProblem
from rtctools.optimization.modelica_mixin import ModelicaMixin
from rtctools.optimization.timeseries import Timeseries
from rtctools.optimization.alias_tools import AliasDict
from casadi import MX, vertcat
from unittest import expectedFailure
import numpy as np
......@@ -38,7 +39,7 @@ class TestProblem(ModelicaMixin, CollocatedIntegratedOptimizationProblem):
def constant_inputs(self, ensemble_member):
# Constant inputs
return {'constant_input': Timeseries(self.times(), 1 - self.times())}
return AliasDict({'constant_input': Timeseries(self.times(), 1 - self.times())})
def seed(self, ensemble_member):
# No particular seeding
......@@ -80,14 +81,13 @@ class TestProblemNonConvex(TestProblem):
def initial_residual(self):
# Set the initial state for 'x' to the neutral point.
residual = []
for state in self.dae_variables['states']:
return vertcat(*residual)
return self.state('x')
def seed(self, ensemble_member):
# Seed the controls.
return {'u': Timeseries(self.times(), self.u_seed)}
seed = super().seed(ensemble_member)
seed['u'] = Timeseries(self.times(), self.u_seed)
return seed
class TestProblemScaled(TestProblem):
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