File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -620,7 +620,7 @@ func (op *OptimizationProblem) ToProblemWithAllPositiveVariables() (*Optimizatio
620620 }
621621
622622 // Set the original variable to be the difference of the two new variables
623- mapFromOriginalVariablesToNewExpressions [xII ] = expressionForReplacement
623+ mapFromOriginalVariablesToNewExpressions [xII ] = expressionForReplacement . AsSimplifiedExpression ()
624624 }
625625
626626 // Now, let's create the new constraints by replacing the variables in the
Original file line number Diff line number Diff line change @@ -2969,6 +2969,18 @@ func TestOptimizationProblem_ToLPStandardForm1_12(t *testing.T) {
29692969 t .Errorf ("expected the entry in the map to contain %v variables; received %v" ,
29702970 1 , len (v2Expr .Variables ()))
29712971 }
2972+
2973+ // TODO: Uncomment these checks once we have Polynomial's AsSimplifiedExpression method better tuned for polynomials.
2974+ // v2ExprAsMonomial, ok := v2Expr.(symbolic.Monomial)
2975+ // if !ok {
2976+ // t.Errorf("expected the entry in the map to be a Monomial; received %T", v2Expr)
2977+ // }
2978+
2979+ // coeff2 := v2ExprAsMonomial.LinearCoeff()
2980+ // if coeff2.AtVec(0) != -1.0 {
2981+ // t.Errorf("expected the entry in the map to have coefficient %v; received %v",
2982+ // -1.0, coeff2.AtVec(0))
2983+ // }
29722984}
29732985
29742986/*
You can’t perform that action at this time.
0 commit comments