1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Declarative constrained residual optimization.
//!
//! This crate models problems of the form
//!
//! ```text
//! minimize_x loss(Ax - b)
//! subject to linear equalities
//! linear inequalities
//! variable bounds
//! ```
//!
//! `resopt` focuses on a compact API for:
//!
//! - building residual optimization problems
//! - validating structure and dimensions
//! - classifying the problem form
//! - solving with an optional backend such as Clarabel
//!
//! # Example
//!
//! ```rust
//! use resopt::{ConstrainedResidualProblemBuilder, Loss, Matrix, SolveStatus};
//!
//! let a = Matrix::from_row_major(
//! 3,
//! 2,
//! vec![
//! 1.0, 0.0,
//! 0.0, 1.0,
//! 1.0, 1.0,
//! ],
//! )?;
//!
//! let problem = ConstrainedResidualProblemBuilder::new()
//! .matrix(a)
//! .target(vec![1.0, 2.0, 3.0])
//! .loss(Loss::L2Squared)
//! .build()?;
//!
//! let result = problem.solve()?;
//!
//! #[cfg(feature = "clarabel")]
//! assert_eq!(result.status(), SolveStatus::Solved);
//! #[cfg(not(feature = "clarabel"))]
//! assert_eq!(result.status(), SolveStatus::NotImplemented);
//! # Ok::<(), resopt::Error>(())
//! ```
//!
//! With the default `clarabel` feature enabled, `Loss::L2Squared` problems can be solved directly.
//! Other loss functions are accepted by the modeling API and return a solver status indicating
//! that backend support is not implemented yet.
pub use ;
pub use ;
pub use ClarabelSolver;