Bind ValidateCpModel and SolutionIsFeasible from cp_model_checker.h

Fixes #22
This commit is contained in:
Guillaume Pinot
2021-09-22 10:07:28 +02:00
committed by Guillaume P
parent 609149dc12
commit 7ecf0c3fc2
5 changed files with 108 additions and 1 deletions
+19
View File
@@ -715,6 +715,25 @@ impl CpModelBuilder {
ffi::cp_model_stats(self.proto())
}
/// Verifies that the given model satisfies all the properties
/// described in the proto comments. Returns an empty string if it is
/// the case, otherwise fails at the first error and returns a
/// human-readable description of the issue.
///
/// # Example
///
/// ```
/// # use cp_sat::builder::CpModelBuilder;
/// # use cp_sat::proto::CpSolverStatus;
/// let mut model = CpModelBuilder::default();
/// let x = model.new_int_var([(0, -1)]);
/// model.maximize(x);
/// assert!(!model.validate_cp_model().is_empty());
/// ```
pub fn validate_cp_model(&self) -> String {
ffi::validate_cp_model(self.proto())
}
/// Solves the model, and returns the corresponding [proto::CpSolverResponse].
///
/// # Example