Commit 8df537e9 authored by Philipp Arras's avatar Philipp Arras

Fix constant support of EnergyAdapter

Closes Issue 311
parent 69313966
Pipeline #78632 passed with stages
in 13 minutes and 23 seconds
......@@ -53,9 +53,10 @@ class EnergyAdapter(Energy):
super(EnergyAdapter, self).__init__(position)
self._op = op
if len(constants) > 0:
dom = makeDomain({kk: vv for kk, vv in position.domain.items()
if kk in constants})
_, self._op = op.simplify_for_constant_input(position.extract(dom))
cstpos = position.extract_by_keys(constants)
_, self._op = op.simplify_for_constant_input(cstpos)
varkeys = set(op.domain.keys()) - set(constants)
position = position.extract_by_keys(varkeys)
self._want_metric = want_metric
lin = Linearization.make_var(position, want_metric)
tmp = self._op(lin)
......
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