cplex_rs/parameters/preprocessing/
mod.rs

1use ffi::{CPXPARAM_Preprocessing_Aggregator, CPXPARAM_Preprocessing_Fill};
2
3use crate::parameters::{private, Parameter, ParameterValue};
4
5impl private::Parameter for Fill {}
6impl private::Parameter for Aggregator {}
7
8/// Preprocessing aggregator fill.
9/// <https://www.ibm.com/docs/en/icos/22.1.1?topic=parameters-preprocessing-aggregator-fill>
10#[derive(Copy, Clone, Debug)]
11pub struct Fill(pub u32);
12
13impl Parameter for Fill {
14    fn value(&self) -> ParameterValue {
15        ParameterValue::Integer(self.0 as i32)
16    }
17
18    fn id(&self) -> u32 {
19        CPXPARAM_Preprocessing_Fill
20    }
21}
22
23/// Preprocessing aggregator application limit
24/// <https://www.ibm.com/docs/en/icos/22.1.1?topic=parameters-preprocessing-aggregator-application-limit>
25#[derive(Copy, Clone, Debug)]
26pub enum Aggregator {
27    Automatic,
28    NbOfTimesToApply(u32),
29}
30
31impl Parameter for Aggregator {
32    fn value(&self) -> ParameterValue {
33        ParameterValue::Integer(match self {
34            Self::Automatic => -1,
35            &Self::NbOfTimesToApply(times) => times as i32,
36        })
37    }
38
39    fn id(&self) -> u32 {
40        CPXPARAM_Preprocessing_Aggregator
41    }
42}