You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letmut problem = Problem::new(OptimizationDirection::Maximize);let x = problem.add_var(50.0,(2.0, f64::INFINITY));let y = problem.add_var(40.0,(0.0,7.0));let z = problem.add_var(45.0,(0.0, f64::MAX));//<----- here
problem.add_constraint(&[(x,3.0),(y,2.0),(z,1.0)],ComparisonOp::Le,20.0);
problem.add_constraint(&[(x,2.0),(y,1.0),(z,3.0)],ComparisonOp::Le,15.0);let sol = problem.solve().unwrap();
For example this gives solution [2.0, 0.0, 0.0]
while using f64::INFINITY gives [2.0, 6.2, 1.6]
and f32::MAX gives [2.0, 7.0, 0.0]
the correct value is [2.0, 6.2, 1.6]
The text was updated successfully, but these errors were encountered:
@lovasoa should the f64::INFINITY vs f64::MAX difference be considered a bug?
Specy
changed the title
Using large values like i64::MAX or f64::MAX causes non optimal values
Using large values like i64::MAX or f64::MAX causes non optimal solutions
Nov 5, 2024
For example this gives solution
[2.0, 0.0, 0.0]
while using f64::INFINITY gives
[2.0, 6.2, 1.6]
and f32::MAX gives
[2.0, 7.0, 0.0]
the correct value is
[2.0, 6.2, 1.6]
The text was updated successfully, but these errors were encountered: