# Evaluate the value of polyvars in SOSModel

**URL:** <https://discourse.julialang.org/t/evaluate-the-value-of-polyvars-in-sosmodel/41836>\
**Category:** General Usage\
**Tags:** package, jump, optimization\
**Created:** [June 22, 2020, 3:21am UTC](https://discourse.julialang.org/t/evaluate-the-value-of-polyvars-in-sosmodel/41836 "2020-06-22T03:21:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aliceee](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@aliceee](https://discourse.julialang.org/u/aliceee)\
**Post date:** [June 22, 2020, 3:21am UTC](https://discourse.julialang.org/t/evaluate-the-value-of-polyvars-in-sosmodel/41836/1 "2020-06-22T03:21:19Z")

</div>

Hi, I have a question about how to evaluate the values of polyvars in SOSModel. In the following example, there is only one regular JuMP decision variable γ and γ can be evaluated by value(γ). But when I want to check the values of x1 and x2, value(x1) does not work. How should I check the current value of polyvar x1 and x2? Thanks for your help in advance!

```julia
using SumOfSquares
using DynamicPolynomials
using MosekTools

# Create symbolic variables (not JuMP decision variables)
@polyvar x1 x2

# Create a Sum of Squares JuMP model with the Mosek solver
model = SOSModel(with_optimizer(Mosek.Optimizer))

# Create a JuMP decision variable for the lower bound
@variable(model, γ)

# f(x) is the Goldstein-Price function
f1 = x1+x2+1
f2 = 19-14*x1+3*x1^2-14*x2+6*x1*x2+3*x2^2
f3 = 2*x1-3*x2
f4 = 18-32*x1+12*x1^2+48*x2-36*x1*x2+27*x2^2

f = (1+f1^2*f2)*(30+f3^2*f4)

# Constraints f(x) - γ to be sum of squares
@constraint(model, f >= γ)

@objective(model, Max, γ)

optimize!(model)

# The lower bound found is 3
println(objective_value(model))

```
