pub fn add_sos(
        &mut self,
        row_starts: &[c_int],
        col_indices: &[c_int],
        weights: &[f64],
        sos_type: SOSConstraintType,
    ) {
        let num_rows = row_starts.len().checked_sub(1).unwrap();
        let last_idx: usize = row_starts[num_rows].try_into().unwrap();
        assert_eq!(last_idx, col_indices.len());
        for starts in row_starts.windows(2) {
            assert!(starts[0] <= starts[1]);
            let idx: usize = starts[0].try_into().unwrap();
            assert!(idx < weights.len());
            let col_idx: usize = col_indices[idx].try_into().unwrap();
            assert!(col_idx <= self.num_cols());
        }
        unsafe {
            Cbc_addSOS(
                self.m,
                num_rows.try_into().unwrap(),
                row_starts.as_ptr(),
                col_indices.as_ptr(),
                weights.as_ptr(),
                sos_type as c_int,
            )
        }
    }
/// Adds multiple SOS constraints
/// num_rows: the number of SOS constraints to add
/// row_starts: The indices at which each new constraint starts in the col_indices array,
/// plus one last element that indicates the size of col_indices array.
/// col_indices: The index of each variable to include in the constraints.
/// You create this array by concatenating the indices of the columns in each constraint.
Adds multiple SOS constraints
num_rows: the number of SOS constraints to add
row_starts: The indices at which each new constraint starts in the col_indices array,
plus one last element that indicates the size of col_indices array.
col_indices: The index of each variable to include in the constraints.
You create this array by concatenating the indices of the columns in each constraint.
Adds multiple SOS constraints num_rows : the number of SOS constraints to add row_starts : The indices at which each new constraint starts in the col_indices array plus one last element that indicates the size of col_indices array . col_indices : The index of each variable to include in the constraints . You create this array by concatenating the indices of the columns in each constraint .
pub fn add_sos(
        &mut self,
        row_starts: &[c_int],
        col_indices: &[c_int],
        weights: &[f64],
        sos_type: SOSConstraintType,
    ) {
        let num_rows = row_starts.len().checked_sub(1).unwrap();
        let last_idx: usize = row_starts[num_rows].try_into().unwrap();
        assert_eq!(last_idx, col_indices.len());
        for starts in row_starts.windows(2) {
            assert!(starts[0] <= starts[1]);
            let idx: usize = starts[0].try_into().unwrap();
            assert!(idx < weights.len());
            let col_idx: usize = col_indices[idx].try_into().unwrap();
            assert!(col_idx <= self.num_cols());
        }
        unsafe {
            Cbc_addSOS(
                self.m,
                num_rows.try_into().unwrap(),
                row_starts.as_ptr(),
                col_indices.as_ptr(),
                weights.as_ptr(),
                sos_type as c_int,
            )
        }
    }
pub fn add_sos ( & mut self , row_starts : & [ c_int ] , col_indices : & [ c_int ] , weights : & [ f64 ] , sos_type : SOSConstraintType , ) { let num_rows = row_starts . len ( ) . checked_sub ( 1 ) . unwrap ( ) ; let last_idx : usize = row_starts [ num_rows ] . try_into ( ) . unwrap ( ) ; assert_eq ! ( last_idx col_indices len ( ) ) ; for starts in row_starts . windows ( 2 ) { assert ! ( starts [ 0 ] starts [ 1 ] ) ; let idx : usize = starts [ 0 ] . try_into ( ) . unwrap ( ) ; assert ! ( idx weights len ( ) ) ; let col_idx : usize = col_indices [ idx ] . try_into ( ) . unwrap ( ) ; assert ! ( col_idx self num_cols ( ) ) ; } unsafe { Cbc_addSOS ( self . m , num_rows . try_into ( ) . unwrap ( ) , row_starts . as_ptr ( ) , col_indices . as_ptr ( ) , weights . as_ptr ( ) , sos_type as c_int , ) } }
Adds multiple SOS constraints
num_rows: the number of SOS constraints to add
row_starts: The indices at which each new constraint starts in the col_indices array,
plus one last element that indicates the size of col_indices array.
Adds multiple SOS constraints num_rows : the number of SOS constraints to add row_starts : The indices at which each new constraint starts in the col_indices array plus one last element that indicates the size of col_indices array .
&mut self
row_starts
&[c_int]
col_indices
&[c_int]
weights
&[f64]
sos_type
SOSConstraintType