Maximum-weight independent set as an optimization problem
Lax263307.MaxWeightIndependentSet · concepts/Lax263307/MaxWeightIndependentSet.lean · lax-263307
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
An instance is a finite simple graph with rational vertex weights. A feasible solution is an independent vertex set in that graph. Its objective is the nonnegative part of its total weight, as required by lax-213208. This does not change the optimum: the empty set is feasible and has weight zero. The approximation proof also ensures that the returned set has nonnegative weight.
Membership in the input class means precisely that the instance graph belongs to ; all rational weight assignments are allowed. The separate concept fixes the standard representations used to measure running time. Feasibility, objective values, and class membership are defined directly on mathematical objects, without decoding machine words.
Concept map
Lean source view on GitHub
| 1 | import Lax263307.GraphClasses |
| 2 | import Lax263307.IndependentSetEncoding |
| 3 | import Lax213208.OptimizationProblem |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: Maximum-weight independent set as an optimization problem |
| 8 | type: definition |
| 9 | --- |
| 10 | An instance is a finite simple graph with rational vertex weights. A feasible |
| 11 | solution is an independent vertex set in that graph. Its objective is the |
| 12 | nonnegative part of its total weight, as required by lax-213208. This does not |
| 13 | change the optimum: the empty set is feasible and has weight zero. |
| 14 | The approximation proof also ensures that the returned set has nonnegative |
| 15 | weight. |
| 16 | |
| 17 | Membership in the input class means precisely that the instance graph belongs |
| 18 | to ; all rational weight assignments are allowed. The separate |
| 19 | `IndependentSetEncoding` concept fixes the standard representations used to |
| 20 | measure running time. Feasibility, objective values, and class membership are |
| 21 | defined directly on mathematical objects, without decoding machine words. |
| 22 | -/ |
| 23 | |
| 24 | namespace Lax263307 |
| 25 | |
| 26 | open GraphClasses WeightedIndependentSet |
| 27 | open Lax213208.OptimizationProblem |
| 28 | |
| 29 | namespace MaxWeightIndependentSet |
| 30 | |
| 31 | /-- A feasible solution is an independent set of the instance graph. -/ |
| 32 | def IsFeasible (x : Instance) (s : Solution) : Prop := |
| 33 | ∃ I : Finset (Fin x.order), s = ⟨x.order, I⟩ ∧ |
| 34 | x.graph.IsIndepSet (I : Set (Fin x.order)) |
| 35 | |
| 36 | /-- Total weight, clipped at zero to meet the nonnegative-objective convention. -/ |
| 37 | def objectiveValue (x : Instance) (s : Solution) : NNReal := |
| 38 | if h : s.1 = x.order then |
| 39 | Real.toNNReal (weight x.weights (h ▸ s.2)) |
| 40 | else 0 |
| 41 | |
| 42 | /-- Weighted graphs whose underlying graph belongs to the given class. -/ |
| 43 | def instancesOn (C : GraphClass) : Set Instance := |
| 44 | {x | x.graph ∈ C x.order} |
| 45 | |
| 46 | end MaxWeightIndependentSet |
| 47 | |
| 48 | /-- The mathematical optimization problem with its fixed canonical representations. -/ |
| 49 | noncomputable def MaxWeightIndependentSet : Problem Instance Solution where |
| 50 | direction := .maximize |
| 51 | feasible := MaxWeightIndependentSet.IsFeasible |
| 52 | value := MaxWeightIndependentSet.objectiveValue |
| 53 | input := IndependentSetEncoding.input |
| 54 | output := IndependentSetEncoding.output |
| 55 | input_faithful := IndependentSetEncoding.input_faithful |
| 56 | output_injective := IndependentSetEncoding.output_injective |
| 57 | |
| 58 | end Lax263307 |
| 59 |
Used by
From Mathlib
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments