Skip to main content

SwapSpec

Struct SwapSpec 

Source
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 Clone for SwapSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SwapSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SwapSpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for SwapSpec

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for SwapSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,