use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LpVariable {
pub name: String,
#[serde(with = "crate::serde_util::f64_inf")]
pub lb: f64,
#[serde(with = "crate::serde_util::f64_inf")]
pub ub: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LpTerm {
pub var: String,
pub coeff: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LpConstraint {
pub name: String,
#[serde(with = "crate::serde_util::f64_inf")]
pub lb: f64,
#[serde(with = "crate::serde_util::f64_inf")]
pub ub: f64,
pub terms: Vec<LpTerm>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LpObjective {
pub terms: Vec<LpTerm>,
pub maximize: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LpRequest {
pub id: String,
pub variables: Vec<LpVariable>,
pub constraints: Vec<LpConstraint>,
pub objective: LpObjective,
pub time_limit_seconds: Option<f64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LpPlan {
pub request_id: String,
pub status: String,
pub values: Vec<(String, f64)>,
pub objective_value: f64,
pub solver: String,
}