#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum NlFormat {
#[default]
Ascii,
Binary,
}
#[derive(Clone, Debug)]
pub struct WriteOptions {
pub format: NlFormat,
pub precision: Option<u32>,
pub comments: bool,
pub nonfinite_strings: bool,
pub aux_files: bool,
pub functions: Vec<ImportedFunction>,
pub suffixes: Vec<SuffixData>,
pub defined_vars: Vec<DefinedVar>,
pub dual_init: Vec<(u32, f64)>,
pub complementarity: Vec<(usize, Complementarity)>,
}
impl Default for WriteOptions {
fn default() -> Self {
Self {
format: NlFormat::Ascii,
precision: None,
comments: true,
nonfinite_strings: false,
aux_files: false,
functions: Vec::new(),
suffixes: Vec::new(),
defined_vars: Vec::new(),
dual_init: Vec::new(),
complementarity: Vec::new(),
}
}
}
impl WriteOptions {
pub fn ascii() -> Self {
Self::default()
}
pub fn ascii_lean() -> Self {
Self { comments: false, ..Self::default() }
}
pub fn binary() -> Self {
Self { format: NlFormat::Binary, comments: false, ..Self::default() }
}
}
#[derive(Clone, Debug)]
pub struct ImportedFunction {
pub name: String,
pub allow_string_args: u8,
pub n_args: i32,
}
#[derive(Clone, Debug)]
pub struct SuffixData {
pub name: String,
pub kind: SuffixKind,
pub flavour: SuffixFlavour,
pub values: Vec<(u32, f64)>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum SuffixKind {
Variable = 0,
Constraint = 1,
Objective = 2,
Problem = 3,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum SuffixFlavour {
Int,
Real,
}
#[derive(Clone, Debug)]
pub struct DefinedVar {
pub nl_index: u32,
pub linear: Vec<(u32, f64)>,
pub appearance: u32,
pub nonlinear_polish: String,
}
#[derive(Copy, Clone, Debug)]
pub struct Complementarity {
pub k: u8,
pub i: u32,
}