pub struct DiscreteCensus {
pub binary: usize,
pub integer: usize,
pub nl_both: usize,
pub nl_cons: usize,
pub nl_objs: usize,
}Expand description
Header line 7: nbv niv nlvbi nlvci nlvoi (gh#987).
In AMPL’s convention nbv and niv count only the discrete variables
that appear linearly; a discrete variable that appears nonlinearly is
counted in nlvbi / nlvci / nlvoi instead, not in nbv + niv. So a
MINLP whose integers all appear nonlinearly has nbv = niv = 0 — reading
only those two fields reports it as continuous.
Fields§
§binary: usizenbv: binary variables appearing only linearly.
integer: usizeniv: other integer variables appearing only linearly.
nl_both: usizenlvbi: integer variables nonlinear in both constraints and objectives.
nl_cons: usizenlvci: integer variables nonlinear in constraints only.
nl_objs: usizenlvoi: integer variables nonlinear in objectives only.
Implementations§
Source§impl DiscreteCensus
impl DiscreteCensus
Sourcepub fn total(&self) -> usize
pub fn total(&self) -> usize
Total declared discrete variables, linear and nonlinear
(nbv + niv + nlvbi + nlvci + nlvoi).
Sourcepub fn nonlinear_discrete(&self) -> usize
pub fn nonlinear_discrete(&self) -> usize
Discrete variables that appear nonlinearly (nlvbi + nlvci + nlvoi).
Sourcepub fn integer_columns(
&self,
n: usize,
counts: Option<NlCounts>,
) -> Option<Vec<usize>>
pub fn integer_columns( &self, n: usize, counts: Option<NlCounts>, ) -> Option<Vec<usize>>
The 0-based columns of every discrete variable, from Gay’s variable ordering (“Writing .nl Files”, table 4):
- nonlinear in both constraints and objectives —
nlvbcolumns, the lastnlvbiof them integer; - nonlinear in constraints only —
nlvc − nlvbcolumns, the lastnlvciinteger; - nonlinear in objectives only —
nlvo − nlvccolumns (when positive), the lastnlvoiinteger; - linear variables, ending in
nbvbinary thennivinteger, which are therefore the lastnbv + nivcolumns of the model.
None when the columns cannot be identified: a nonlinear integer
count is non-zero but the header’s line-5 census is missing, or the
counts are inconsistent with the block sizes. Callers must report that
as not checked, never as passed.
Trait Implementations§
Source§impl Clone for DiscreteCensus
impl Clone for DiscreteCensus
Source§fn clone(&self) -> DiscreteCensus
fn clone(&self) -> DiscreteCensus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DiscreteCensus
Source§impl Debug for DiscreteCensus
impl Debug for DiscreteCensus
Source§impl Default for DiscreteCensus
impl Default for DiscreteCensus
Source§fn default() -> DiscreteCensus
fn default() -> DiscreteCensus
impl Eq for DiscreteCensus
Source§impl PartialEq for DiscreteCensus
impl PartialEq for DiscreteCensus
impl StructuralPartialEq for DiscreteCensus
Auto Trait Implementations§
impl Freeze for DiscreteCensus
impl RefUnwindSafe for DiscreteCensus
impl Send for DiscreteCensus
impl Sync for DiscreteCensus
impl Unpin for DiscreteCensus
impl UnsafeUnpin for DiscreteCensus
impl UnwindSafe for DiscreteCensus
Blanket Implementations§
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more