Skip to content

Commit 675e306

Browse files
committed
Hiding a test for the simplified output of one polynomial
1 parent 5055e98 commit 675e306

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

problem/optimization_problem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

testing/problem/optimization_problem_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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
/*

0 commit comments

Comments
 (0)