pub struct SwapSpec {Show 18 fields
pub slots: Vec<Slot>,
pub vars: Vec<VarSpec>,
pub merit: SwapMerit,
pub reference: SwapRef,
pub rings: usize,
pub iters: usize,
pub efl: Option<f64>,
pub state: Option<String>,
pub max_count: usize,
pub terms: Vec<Value>,
pub starts: Vec<BTreeMap<String, f64>>,
pub states: Vec<String>,
pub state_vars: Vec<VarSpec>,
pub clear_aperture: bool,
pub jac: SwapJac,
pub prescreen: Option<Prescreen>,
pub beam: Option<Beam>,
pub paraxial: Option<Paraxial>,
}Expand description
差し替え探索の設定(CLI の –spec の JSON)
Fields§
§slots: Vec<Slot>§vars: Vec<VarSpec>組ごとに最適化する変数(“d1.t”・“d1.t=0.5:40”・“G2.shift”、または {"name": "d1.t", "min": 0.5, "max": 40})
merit: SwapMerit評価関数
reference: SwapRef基準
rings: usize§iters: usize組ごとの反復の上限
efl: Option<f64>系の焦点距離の目標(省けば目標なし)。重みは像の項の重みの合計の 10 倍(TermKind::Paraxial)
state: Option<String>状態(None なら変更なし)
max_count: usize組の数の上限(大きすぎる探索を誤って始めないため。ビーム探索では評価する組の数の見込み)
terms: Vec<Value>評価関数に足す項(optimize --term と同じ JSON。片側の条件 min・max も)。
例: {"type": "paraxial", "q": "efl", "min": 351}
starts: Vec<BTreeMap<String, f64>>出発点(変数の名前 → 初期値。書かない変数はプロジェクトの値)。組ごとにすべての出発点から最適化し、 評価関数の最も小さい解を採る(空なら プロジェクトの値から 1 回)
states: Vec<String>状態をまたいだ探索(ズーム位置など): プロジェクトの状態の名前の並び。組ごとに全状態を同時に
最適化する(評価関数は全状態の像の項)。state とは同時に使えない。terms の config は
この並びの番号(1 始まり)
state_vars: Vec<VarSpec>状態ごとに別の値で解く変数(states のとき。群の移動 G2.shift など、書き方は vars と同じ)。
vars は全状態で共通の 1 つの値
clear_aperture: bool有効径の条件: 差し替える玉の各面で、各視野の瞳の縁の実光線(主波長、瞳の上下左右)が面の半径 (カタログの玉の半直径)の内側にあることを片側の条件の項として足す(重みは像の項の重みの合計の 1e6 倍)
jac: SwapJacヤコビアン: “forward”(すべて前進差分、既定)・“fd”(すべて中心差分)・“auto”(解析的に求められる列が 16 個以上の項は解析的に、少ない項は中心差分)。 差し替え探索の変数(間隔・群の移動など少数)では差分の方が速い(実カタログ 7 万組で fd は auto の 4.3 倍)。 forward は差分の追跡が中心差分の半分で済み、fd よりさらに約 1.4 倍速い(実カタログ 3,000 組で上位 300 組の顔ぶれ・順位は fd と同じ、評価関数の差は相対 3e-7 以下)
prescreen: Option<Prescreen>粗いふるい(省けばなし): 全組を光線の少ない評価関数で最適化し、評価関数の小さい組だけを今の評価で 最適化し直す。残した組の結果はふるいなしと同じ。残さなかった組は結果に出ない
beam: Option<Beam>所ごとのビーム探索(省けば全組の総当たり): 全組でなく、所を 1 つずつ候補を全部試して評価関数の小さい
width 通りを残しながら進む。評価する組の数は全組の積でなく、およそ width × 候補の数の和 × 巡回の数。
総当たりの最良を見落とすことがある。prescreen とは同時に使えない
paraxial: Option<Paraxial>近軸の前ふるい(省けばなし、efl があるときだけ): 変数(範囲つきの厚さだけ)の範囲の角で系の屈折力を求め、
efl の目標に届かない組を光線を追わずに落とす(その組は誤り「…misses the target…」の結果になる)。
屈折力は厚さのそれぞれについて 1 次なので、範囲の中の最大・最小は角にあり、落とした組はどの値でも目標に届かない。
ピックアップ・ソルブ・マクロのある状態や屈折率分布の媒質の厚さを動かす状態は 1 次とは限らないので確かめない
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SwapSpec
impl<'de> Deserialize<'de> for SwapSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for SwapSpec
impl JsonSchema for SwapSpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for SwapSpec
impl RefUnwindSafe for SwapSpec
impl Send for SwapSpec
impl Sync for SwapSpec
impl Unpin for SwapSpec
impl UnsafeUnpin for SwapSpec
impl UnwindSafe for SwapSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more