From 1d08a919e3d7715c1bf4894e679a63062edf2e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sun, 26 Jul 2026 10:10:10 +0200 Subject: [PATCH] Add docstrings to Model and Solution --- README.md | 5 ++++- src/model.jl | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b86c53c..30d90d9 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,10 @@ MOI.set(model, PolyJuMP.MultiplierMaxdegree(), con, 2) The `SumOfSquares.Optimizer` of [SumOfSquares.jl](https://github.com/jump-dev/SumOfSquares.jl) is the analogous solver certifying the nonnegativity of the Lagrangian with the SOS cone instead; increasing the `PolyJuMP.MultiplierMaxdegree` attributes -then gives the higher levels of the Lasserre hierarchy. +then gives the higher levels of the Lasserre hierarchy and the candidate +solutions are recovered from the atoms of the moment matrix given by the dual +of the SOS constraint, using +[MultivariateMoments](https://github.com/JuliaAlgebra/MultivariateMoments.jl). [CP16] Chandrasekaran, Venkat, and Parikshit Shah. *Relative entropy relaxations for signomial optimization.* diff --git a/src/model.jl b/src/model.jl index 96499c4..f74485d 100644 --- a/src/model.jl +++ b/src/model.jl @@ -1,3 +1,10 @@ +""" + mutable struct Model{T} <: MOI.ModelLike + +Model representing a polynomial optimization problem with objective +`objective_sense` of the polynomial `objective_function` over the +basic semialgebraic `set`. +""" mutable struct Model{T} <: MOI.ModelLike variables::Dict{MOI.VariableIndex,VarType} objective_sense::MOI.OptimizationSense @@ -17,6 +24,14 @@ function MP.variables(model::Model) return sort!(collect(values(model.variables)), rev = true) end +""" + struct Solution{T} + +Candidate solution of `values` for the variables of a [`Model`](@ref) with +corresponding `objective_value` and `max_constraint_violation`. +The `status` classifies its feasibility given the tolerance that was used +to compare the maximum constraint violation. +""" struct Solution{T} values::Vector{T} objective_value::T