import cvxpy as cp

# min (x - y)^2  s.t. x + y = 1, x - y >= 1

x = cp.Variable()
y = cp.Variable()
constraints = [x + y == 1, x - y >= 1]
objective = cp.Minimize((x - y)**2)

prob = cp.Problem(objective, constraints)
prob.solve()

print(
    'available status:', cp.OPTIMAL, cp.INFEASIBLE, cp.UNBOUNDED, cp.OPTIMAL_INACCURATE, cp.INFEASIBLE_INACCURATE,
    cp.UNBOUNDED_INACCURATE
)
print("status:", prob.status)    # optimal tells us the problem was solved successfully
print("optimal value", prob.value)    # optimal value
print("optimal var", x.value, y.value)    # where to achieve the optimal objective

08c43a2f13047c32f878f8adaa24923e924e860e
<mask token>

<mask token>
prob.solve()
print('available status:', cp.OPTIMAL, cp.INFEASIBLE, cp.UNBOUNDED, cp.
    OPTIMAL_INACCURATE, cp.INFEASIBLE_INACCURATE, cp.UNBOUNDED_INACCURATE)
print('status:', prob.status)
print('optimal value', prob.value)
print('optimal var', x.value, y.value)

<mask token>
x = cp.Variable()
y = cp.Variable()
constraints = [x + y == 1, x - y >= 1]
objective = cp.Minimize((x - y) ** 2)
prob = cp.Problem(objective, constraints)
prob.solve()
print('available status:', cp.OPTIMAL, cp.INFEASIBLE, cp.UNBOUNDED, cp.
    OPTIMAL_INACCURATE, cp.INFEASIBLE_INACCURATE, cp.UNBOUNDED_INACCURATE)
print('status:', prob.status)
print('optimal value', prob.value)
print('optimal var', x.value, y.value)

import cvxpy as cp
x = cp.Variable()
y = cp.Variable()
constraints = [x + y == 1, x - y >= 1]
objective = cp.Minimize((x - y) ** 2)
prob = cp.Problem(objective, constraints)
prob.solve()
print('available status:', cp.OPTIMAL, cp.INFEASIBLE, cp.UNBOUNDED, cp.
    OPTIMAL_INACCURATE, cp.INFEASIBLE_INACCURATE, cp.UNBOUNDED_INACCURATE)
print('status:', prob.status)
print('optimal value', prob.value)
print('optimal var', x.value, y.value)

import cvxpy as cp

# min (x - y)^2  s.t. x + y = 1, x - y >= 1

x = cp.Variable()
y = cp.Variable()
constraints = [x + y == 1, x - y >= 1]
objective = cp.Minimize((x - y)**2)

prob = cp.Problem(objective, constraints)
prob.solve()

print(
    'available status:', cp.OPTIMAL, cp.INFEASIBLE, cp.UNBOUNDED, cp.OPTIMAL_INACCURATE, cp.INFEASIBLE_INACCURATE,
    cp.UNBOUNDED_INACCURATE
)
print("status:", prob.status)    # optimal tells us the problem was solved successfully
print("optimal value", prob.value)    # optimal value
print("optimal var", x.value, y.value)    # where to achieve the optimal objective
