Sun, 11 Dec 2022 23:25:53 +0200
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
* Fixes the conditional gradient methods that were incorrectly solving
positivity constrained subproblems although the infinite-dimensional
versions do not include such constraints.
* Introduces the `ExperimentV2` struct that has `regularisation` in place
of `α`. The `Experiment` struct is now deprecated.
* The L^2-squared experiments were switch to be unconstrained, as the
Franke-Wolfe implementations do not support constraints. (This would
be easy to add for the “fully corrective” variant, but is not
immediate for the “relaxed” variant.)
use std::env; use regex::{Regex, Captures}; fn proc<A : AsRef<str>>(re : &str, str : A) -> String { let need_to_escape = Regex::new(r"([_*\\])").unwrap(); Regex::new(re).unwrap().replace_all(str.as_ref(), |caps : &Captures| { format!("{}{}{}", caps.get(1).unwrap().as_str(), need_to_escape.replace_all(caps.get(2).unwrap().as_str(), "\\$1"), caps.get(3).unwrap().as_str() ) }).to_string() } fn main() { let out_dir = env::var("OUT_DIR").unwrap(); // Since rust is stuck in 80's 7-bit gringo ASCII world, so that rustdoc does not support // markdown KaTeX mathematics, we have to process the README to include horrible horrible // horrible escapes for the math, and then use an vomit-inducingly ugly javasccript // workaround to process the math on the fly. println!("cargo:rerun-if-changed=README.md"); let readme = std::fs::read_to_string("README.md") .expect("Error reading README"); // Escape _, *, and \ in equations. let readme_uglified = proc(r"(?m)([^$]\$)([^$]+)(\$[^$])", proc(r"([^$]\$\$)([^$]+)(\$\$[^$])", readme)); // Remove the instructions for building the documentation let readme_cut = Regex::new("## Internals(.*|\n)*") .unwrap() .replace_all(&readme_uglified, ""); std::fs::write(out_dir + "/README_uglified.md", readme_cut.as_bytes()) .expect("Error saving uglified README"); }