diff --git a/src/lib.rs b/src/lib.rs index d74898f..20d5d4f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -260,6 +260,16 @@ pub enum Sense { } impl Model { + /// Return pointer to underlying HiGHS model + pub fn as_ptr(&self) -> *const c_void{ + self.highs.ptr() + } + + /// Return mutable pointer to underlying HiGHS model + pub fn as_mut_ptr(&mut self) -> *mut c_void{ + self.highs.mut_ptr() + } + /// Set the optimization sense (minimize by default) pub fn set_sense(&mut self, sense: Sense) { let ret = unsafe { Highs_changeObjectiveSense(self.highs.mut_ptr(), sense as c_int) }; @@ -591,6 +601,16 @@ impl HighsPtr { } impl SolvedModel { + /// Return pointer to underlying HiGHS model + pub fn as_ptr(&self) -> *const c_void{ + self.highs.ptr() + } + + /// Return mutable pointer to underlying HiGHS model + pub fn as_mut_ptr(&mut self) -> *mut c_void{ + self.highs.mut_ptr() + } + /// The status of the solution. Should be Optimal if everything went well. pub fn status(&self) -> HighsModelStatus { let model_status = unsafe { Highs_getModelStatus(self.highs.unsafe_mut_ptr()) };