Show the loss history from the last realization
This introduces a dependency on the Charming crate, which we use to plot the loss history, and the ECharts JavaScript library, which Charming depends on. Now that there's more than one canvas on the page, we have to pick out the display by ID rather than by element type in our style sheet.
This commit is contained in:
parent
679c421d04
commit
0b333ac00d
10 changed files with 660 additions and 11 deletions
|
@ -25,6 +25,7 @@ use crate::{
|
|||
sphere,
|
||||
ConfigSubspace,
|
||||
ConstraintProblem,
|
||||
DescentHistory,
|
||||
Realization,
|
||||
RealizationResult
|
||||
},
|
||||
|
@ -549,7 +550,10 @@ pub struct Assembly {
|
|||
pub tangent: Signal<ConfigSubspace>,
|
||||
|
||||
// indexing
|
||||
pub elements_by_id: Signal<BTreeMap<String, Rc<dyn Element>>>
|
||||
pub elements_by_id: Signal<BTreeMap<String, Rc<dyn Element>>>,
|
||||
|
||||
// realization diagnostics
|
||||
pub descent_history: Signal<DescentHistory>
|
||||
}
|
||||
|
||||
impl Assembly {
|
||||
|
@ -558,7 +562,8 @@ impl Assembly {
|
|||
elements: create_signal(BTreeSet::new()),
|
||||
regulators: create_signal(BTreeSet::new()),
|
||||
tangent: create_signal(ConfigSubspace::zero(0)),
|
||||
elements_by_id: create_signal(BTreeMap::default())
|
||||
elements_by_id: create_signal(BTreeMap::default()),
|
||||
descent_history: create_signal(DescentHistory::new())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -703,6 +708,9 @@ impl Assembly {
|
|||
console_log!("Steps: {}", history.scaled_loss.len() - 1);
|
||||
console_log!("Loss: {}", history.scaled_loss.last().unwrap());
|
||||
|
||||
// record realization diagnostics
|
||||
self.descent_history.set(history);
|
||||
|
||||
if let Ok(Realization { config, tangent }) = result {
|
||||
/* DEBUG */
|
||||
// report the tangent dimension
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue