~/bend-docscommunity

individual.bend checks

raw source on the hub · import 0xa2f9d6ef8c474468bf1de15ebe70c512/individual.bend as Individual

Individual — C# Unsga3.Algorithm.Individual. Objectives + decision variables + evaluated + tournament bookkeeping (rank / niche / associated ref / perp distance). Constraints are g ≤ 0. cv is the sum of the positive parts (RefreshConstraintViolation). Feasible iff cv ≤ 0. Empty g is cv 0, so unconstrained ZDT / DTLZ stay on the Pareto path.

1 import
import Base

Types

type Individual source · line 10 · raw

Data

Definitions

def pos_part source · line 23 · raw

@+x:F32 -> F32

def sum_pos source · line 27 · raw

@xs:List<&2, F32> -> F32

Sum of g_i where g_i > 0. Non-positive parts add nothing.

def from_objectives source · line 36 · raw

@+f:List<&2, F32> -> Individual

v0 / A/B path: objectives already known; no decision vector. No constraints → cv 0 (feasible).

def from_variables source · line 41 · raw

@+x:List<&2, F32> -> @n_obj:Nat -> Individual

Unevaluated candidate: variables set, objectives zeroed (C# ctor). Constraints empty until a problem writes them.

def variables source · line 44 · raw

@ind:Individual -> List<&2, F32>

def objectives source · line 49 · raw

@ind:Individual -> List<&2, F32>

def constraints source · line 54 · raw

@ind:Individual -> List<&2, F32>

def constraint_violation source · line 59 · raw

@ind:Individual -> F32

def feasible source · line 65 · raw

@ind:Individual -> Bool

C# IsFeasible: ConstraintViolation <= 0.

def rank source · line 68 · raw

@ind:Individual -> Nat

def evaluated source · line 73 · raw

@ind:Individual -> Bool

def n_obj source · line 78 · raw

@ind:Individual -> Nat

def n_var source · line 81 · raw

@ind:Individual -> Nat

def var_at source · line 84 · raw

@ind:Individual -> @i:Nat -> F32

def set_var_at source · line 87 · raw

@ind:Individual -> @i:Nat -> @v:F32 -> Individual

def set_evaluated source · line 92 · raw

@ind:Individual -> @ev2:Bool -> Individual

def niche source · line 97 · raw

@ind:Individual -> Nat

def associated_ref source · line 102 · raw

@ind:Individual -> Nat

def perp_dist source · line 107 · raw

@ind:Individual -> F32

def set_objectives source · line 112 · raw

@ind:Individual -> @+f2:List<&2, F32> -> Individual

def set_constraints source · line 118 · raw

@ind:Individual -> @+g2:List<&2, F32> -> Individual

Replace g and recompute cv (sum of positive parts).

def set_rank source · line 123 · raw

@ind:Individual -> @rnk2:Nat -> Individual

def stamp source · line 128 · raw

@ind:Individual -> @+rnk2:Nat -> @+nic2:Nat -> @+aref2:Nat -> @+dist2:F32 -> Individual