Index: /Code/ModelTranslator/src/de/uni_hildesheim/sse/trans/convert/ModelOptimizer.java
===================================================================
--- /Code/ModelTranslator/src/de/uni_hildesheim/sse/trans/convert/ModelOptimizer.java	(revision 101)
+++ /Code/ModelTranslator/src/de/uni_hildesheim/sse/trans/convert/ModelOptimizer.java	(revision 102)
@@ -6,4 +6,5 @@
 import java.util.Set;
 
+import de.uni_hildesheim.sse.model.cst.CSTSemanticException;
 import de.uni_hildesheim.sse.model.cst.ConstraintSyntaxTree;
 import de.uni_hildesheim.sse.model.cst.OCLFeatureCall;
@@ -83,20 +84,5 @@
         
         // 1) Go through all constraints and find variables that always have to be true or false
-        for (int i = 0, n = constraints.size(); i < n; i++) {
-            ConstraintSyntaxTree tree = constraints.get(i).getConsSyntax();
-            // TODO: check if there is only 1 variable and use EvaluationVistor instead?
-            
-            if (tree instanceof Variable) {
-                Variable var = (Variable) tree;
-                alwaysTrueVariables.add(var.getVariable());
-                // TODO remove constraint and variable?
-            } else if (tree instanceof OCLFeatureCall) {
-                OCLFeatureCall call = (OCLFeatureCall) tree;
-                if (call.getOperation().equals(OclKeyWords.NOT) && call.getOperand() instanceof Variable) {
-                    Variable var = (Variable) call.getOperand();
-                    alwaysFalseVariables.add(var.getVariable());
-                }
-            }
-        }
+        findConstantVariables(constraints, alwaysTrueVariables, alwaysFalseVariables);
         
         // 2) Remove all constraints that contain a not negated alwaysTrueVariable or contain a negated
@@ -119,13 +105,23 @@
                     if (isVariableNegated(tree, var)) {
                         tree = null;
-                        break;
+                    } else {
+                        try {
+                            constraint.setConsSyntax(removeVariable(tree, var));
+                        } catch (CSTSemanticException e) {
+                            LOGGER.exception(e);
+                        }
                     }
-                    // TODO: remove variable from constraint in else branch (since it's always false)
+                    break;
                 } else if (alwaysTrueVariables.contains(var)) {
                     if (!isVariableNegated(tree, var)) {
                         tree = null;
-                        break;
+                    } else {
+                        try {
+                            constraint.setConsSyntax(removeVariable(tree, var));
+                        } catch (CSTSemanticException e) {
+                            LOGGER.exception(e);
+                        }
                     }
-                    // TODO: remove variable from constraint in else branch (since it's always false)
+                    break;
                 }
             }
@@ -134,11 +130,11 @@
                 model.removeElement(constraint);
                 numRemoved++;
-            }
-            
-            /*
-             *  Release constraint to deallocate memory.
-             *  set(index, null) avoids Array.copy
-             */
-            constraints.set(i, null);
+
+                /*
+                 *  Release constraint to deallocate memory.
+                 *  set(index, null) avoids Array.copy
+                 */
+                constraints.set(i, null);
+            }
         }
         
@@ -210,4 +206,30 @@
     
     /**
+     * Finds all constant variables in the given list of constraints.
+     * @param constraints The list of constraints to search
+     * @param alwaysTrueVariables A set where all variables that always have to be true will be stored
+     * @param alwaysFalseVariables A set where all variables that always have to be false will be stored
+     */
+    private void findConstantVariables(List<Constraint> constraints, Set<AbstractVariable> alwaysTrueVariables,
+            Set<AbstractVariable> alwaysFalseVariables) {
+        
+        for (int i = 0, n = constraints.size(); i < n; i++) {
+            ConstraintSyntaxTree tree = constraints.get(i).getConsSyntax();
+            // TODO: check if there is only 1 variable and use EvaluationVistor instead?
+            
+            if (tree instanceof Variable) {
+                Variable var = (Variable) tree;
+                alwaysTrueVariables.add(var.getVariable());
+            } else if (tree instanceof OCLFeatureCall) {
+                OCLFeatureCall call = (OCLFeatureCall) tree;
+                if (call.getOperation().equals(OclKeyWords.NOT) && call.getOperand() instanceof Variable) {
+                    Variable var = (Variable) call.getOperand();
+                    alwaysFalseVariables.add(var.getVariable());
+                }
+            }
+        }
+    }
+    
+    /**
      * Split all constraints of the project into equivalence classes according to their length.
      * @return An array of lists with constraint that all have the same length.
@@ -302,3 +324,49 @@
     }
     
+    /**
+     * Removes the given variable from the {@link ConstraintSyntaxTree}.
+     * @param tree The {@link ConstraintSyntaxTree} that contains the variable
+     * @param variable The variable to be removed
+     * @return The {@link ConstraintSyntaxTree} without the variable
+     */
+    private ConstraintSyntaxTree removeVariable(ConstraintSyntaxTree tree, AbstractVariable variable) {
+        
+        ConstraintSyntaxTree result = null;
+        
+        if (tree instanceof OCLFeatureCall) {
+            OCLFeatureCall call = (OCLFeatureCall) tree;
+            if (call.getOperation().equals(OclKeyWords.NOT)) {
+                ConstraintSyntaxTree operand = removeVariable(call.getOperand(), variable);
+                if (operand != null) {
+                    result = new OCLFeatureCall(operand, OclKeyWords.NOT);
+                }
+            } else {
+                ConstraintSyntaxTree operand = removeVariable(call.getOperand(), variable);
+                ConstraintSyntaxTree parameter = removeVariable(call.getParameter(0), variable);
+                if (operand == null && parameter == null) {
+                    result = null;
+                } else if (parameter != null) {
+                    result = parameter;
+                } else if (operand != null) {
+                    result = operand;
+                } else {
+                    result = call;
+                }
+            }
+        } else if (tree instanceof Variable) {
+            Variable var = (Variable) tree;
+            if (!var.getVariable().equals(variable)) {
+                result = var;
+            }
+        } else if (tree instanceof Parenthesis) {
+            Parenthesis parenthesis = (Parenthesis) tree;
+            result = removeVariable(parenthesis.getExpr(), variable);
+        } else {
+            // TODO
+            LOGGER.error("Unexpected ConstraintSyntaxTree in CNF formula.");
+        }
+        
+        return result;
+    }
+    
 }
