Index: /branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/OptimizableView.cs
===================================================================
--- /branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/OptimizableView.cs	(revision 8647)
+++ /branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/OptimizableView.cs	(revision 8648)
@@ -58,7 +58,7 @@
         Invoke(new EventHandler(Content_OptimizeChanged), sender, e);
       } else {
-        this.optimizeCheckBox.Checked = Content.Optimize;
+        optimizeCheckBox.Checked = Content.Optimize;
         if (Content.Optimize) {
-          this.viewHost.ViewType = null;
+          viewHost.ViewType = null;
 
           var pc = Content as IParameterConfiguration;
@@ -67,7 +67,7 @@
           if (pc != null) {
             if (pc is SingleValuedParameterConfiguration) {
-              this.viewHost.Content = ((ParameterizedValueConfiguration)pc.ValueConfigurations.Single()).ParameterConfigurations;
+              viewHost.Content = ((ParameterizedValueConfiguration)pc.ValueConfigurations.Single()).ParameterConfigurations;
             } else {
-              this.viewHost.Content = pc.ValueConfigurations;
+              viewHost.Content = pc.ValueConfigurations;
             }
           } else if (vc != null) {
@@ -77,8 +77,8 @@
                 Content.ActualValue.ValueDataType == typeof(DoubleValue) ||
                 Content.ActualValue.ValueDataType == typeof(PercentValue)) {
-                this.viewHost.ViewsLabelVisible = true;
-                this.viewHost.Content = rvc.RangeConstraint;
+                viewHost.ViewsLabelVisible = true;
+                viewHost.Content = rvc.RangeConstraint;
               } else if (Content.ActualValue.ValueDataType == typeof(BoolValue)) {
-                this.viewHost.Content = null; // no configuration required
+                viewHost.Content = null; // no configuration required
               }
             }
@@ -86,6 +86,6 @@
             var pvc = Content as ParameterizedValueConfiguration;
             if (pvc != null) {
-              this.viewHost.ViewsLabelVisible = false;
-              this.viewHost.Content = pvc.ParameterConfigurations;
+              viewHost.ViewsLabelVisible = false;
+              viewHost.Content = pvc.ParameterConfigurations;
             }
           } else {
@@ -93,9 +93,19 @@
           }
         } else {
-          this.viewHost.ViewsLabelVisible = false;
+          viewHost.ViewsLabelVisible = false;
           if (Content.ValuesReadOnly) {
-            this.viewHost.Content = new MessageItem("Cannot modify value directly. Please modify the value in the list of problems.");
+            viewHost.Content = new MessageItem("Cannot modify value directly. Please modify the value in the list of problems.");
           } else {
-            this.viewHost.Content = Content.ActualValue;
+            // the content's valid values get lost after optimize is set to true because the constrained value
+            // does not contain the earlier valid values; therefore, the same constrained value with the correct
+            // set of valid values is created before the assignment below
+            var configuration = viewHost.Content as CheckedValueConfigurationList;
+            if (configuration != null) {
+              Content.ActualValue = new ConstrainedValue(Content.ActualValue.Value,
+                Content.ActualValue.ValueDataType,
+                configuration.ValidValues,
+                Content.ActualValue.IsNullable);
+            }
+            viewHost.Content = Content.ActualValue;
           }
         }
@@ -117,5 +127,5 @@
         Content_OptimizeChanged(this, EventArgs.Empty);
       } else {
-        this.viewHost.Content = null;
+        viewHost.Content = null;
       }
     }
@@ -124,5 +134,5 @@
       base.SetEnabledStateOfControls();
       if (Content != null) {
-        this.optimizeCheckBox.Enabled = !this.ReadOnly && Content.IsOptimizable;
+        optimizeCheckBox.Enabled = !ReadOnly && Content.IsOptimizable;
       }
     }
Index: /branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/ValueConfigurationViews/ValueView.cs
===================================================================
--- /branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/ValueConfigurationViews/ValueView.cs	(revision 8647)
+++ /branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding.Views/3.3/ValueConfigurationViews/ValueView.cs	(revision 8648)
@@ -65,5 +65,4 @@
 
     private void setValueButton_Click(object sender, EventArgs e) {
-      // TODO: valid values get lost if the value was set to be optimized before
       var withoutNullValue = Content.ValidValues.Where(x => x != null && !(x is NullValue));
       var typeSelectorDialog = new TypeSelectorDialog();
