Skip to content

Commit b8dc17f

Browse files
committed
Catch any known numeric types when generating standard repn
1 parent fea22da commit b8dc17f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pyomo/repn/standard_repn.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,6 @@ def _collect_external_fn(exp, multiplier, idMap, compute_values, verbose, quadra
913913
_GeneralObjectiveData : _collect_identity,
914914
SimpleObjective : _collect_identity,
915915
objective : _collect_identity,
916-
float : _collect_const,
917-
int : _collect_const,
918916
}
919917

920918

@@ -924,6 +922,12 @@ def _collect_standard_repn(exp, multiplier, idMap,
924922
if fn is not None:
925923
return fn(exp, multiplier, idMap, compute_values, verbose, quadratic)
926924
#
925+
# Catch any known numeric constants
926+
#
927+
if exp.__class__ in native_numeric_types:
928+
return _collect_const(exp, multiplier, idMap, compute_values,
929+
verbose, quadratic)
930+
#
927931
# These are types that might be extended using duck typing.
928932
#
929933
try:

0 commit comments

Comments
 (0)