#2584: Added parameter in constant optimization that determines whether variable weights should be modified.