Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Note: This is the main Changelog file for the Rust solver. The Changelog file fo

- Rust solver supports generic float types
- Expanded Rust constraint test coverage with constructor validation, boundary/idempotence checks, and additional `BallP` / epigraph projection cases

- Swap the cross-platform timer dependency to web-time, remove instant-specific wasm feature wiring, update optimizer timing call sites to use `web_time::Instant`, keep existing native and wasm timing behavior without stdweb risk

<!-- ---------------------
v0.11.1
Expand Down
9 changes: 2 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ num = "0.4"
# Our own stuff - L-BFGS: limited-memory BFGS directions
lbfgs = "0.3"

# Instant is a generic timer that works on Wasm (with wasm-bindgen)
instant = { version = "0.1" }
# Cross-platform time primitives with WebAssembly support
web-time = "1"

# Wasm-bindgen is only activated if OpEn is compiled with `--features wasm`
wasm-bindgen = { version = "0.2", optional = true }

# sc-allocator provides an implementation of a bump allocator
rpmalloc = { version = "0.2", features = [
Expand Down Expand Up @@ -116,9 +114,6 @@ jem = ["jemallocator"]
# RPMalloc
rp = ["rpmalloc"]

# WebAssembly
wasm = ["wasm-bindgen", "instant/wasm-bindgen", "instant/inaccurate"]

# --------------------------------------------------------------------------
# T.E.S.T. D.E.P.E.N.D.E.N.C.I.E.S
# --------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions docs/openrust-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ You cannot use both `rp` and `jem`.

### WebAssembly Support

:::warning
In version 0.12.0 of OpEn, wasm was replaced by [`web-time`](https://crates.io/crates/web-time),
so this feature is not supported any more. OpEn can still be used in WebAssembly without
the need to specify any features.
:::

If you intend to use OpEn in WebAssembly you need to use the feature `wasm`.

```.toml
Expand Down
2 changes: 1 addition & 1 deletion src/alm/alm_optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ where
pub fn solve(&mut self, u: &mut [T]) -> Result<AlmOptimizerStatus<T>, SolverError> {
let mut num_outer_iterations = 0;
// let tic = std::time::Instant::now();
let tic = instant::Instant::now();
let tic = web_time::Instant::now();
let mut exit_status = ExitStatus::Converged;
self.alm_cache.reset(); // first, reset the cache
self.alm_cache.available_time = self.max_duration;
Expand Down
2 changes: 1 addition & 1 deletion src/core/fbs/fbs_optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ where

/// Solves the optimization problem for decision variables of scalar type `T`.
pub fn solve(&mut self, u: &mut [T]) -> Result<SolverStatus<T>, SolverError> {
let now = instant::Instant::now();
let now = web_time::Instant::now();

self.fbs_engine.init(u)?;

Expand Down
4 changes: 2 additions & 2 deletions src/core/panoc/panoc_optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ where

/// Solves the optimization problem for decision variables of scalar type `T`.
pub fn solve(&mut self, u: &mut [T]) -> Result<SolverStatus<T>, SolverError> {
let now = instant::Instant::now();
let now = web_time::Instant::now();

/*
* Initialise [call panoc_engine.init()]
Expand Down Expand Up @@ -244,7 +244,7 @@ mod tests {
let mut panoc_cache = PANOCCache::new(n_dimension, tolerance, lbfgs_memory);
let problem = Problem::new(&bounds, cost_gradient, cost_function);
let mut panoc = PANOCOptimizer::new(problem, &mut panoc_cache).with_max_iter(max_iters);
let now = instant::Instant::now();
let now = web_time::Instant::now();
let status = panoc.solve(&mut u_solution).unwrap();

println!("{} iterations", status.iterations());
Expand Down