Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bqpd committed Aug 6, 2020
1 parent b7fa5b3 commit 8cb9f0c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gpkit/constraints/prog_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,14 @@ def run_sweep(genfunction, self, solution, skipsweepfailures,
if var in ksweep:
solution["sweepvariables"][var] = val
del solution["constants"][var]
elif (val[0] == val[1:]).all():
elif linked: # if any variables are linked, we check all of them
if hasattr(val[0], "shape"):
differences = ((l != val[0]).any() for l in val[1:])
else:
differences = (l != val[0] for l in val[1:])
if not any(differences):
solution["constants"][var] = [val[0]]
else:
solution["constants"][var] = [val[0]]

if verbosity > 0:
Expand Down

0 comments on commit 8cb9f0c

Please sign in to comment.