public CpSolverStatus SolveWithSolutionCallback(CpModel model, SolutionCallback cb) { // Setup search. CreateSolveWrapper(); if (string_parameters_ != null) { solve_wrapper_.SetStringParameters(string_parameters_); } if (log_callback_ != null) { solve_wrapper_.AddLogCallbackFromClass(log_callback_); } if (cb != null) { solve_wrapper_.AddSolutionCallback(cb); } response_ = solve_wrapper_.Solve(model.Model); // Cleanup search. if (cb != null) { solve_wrapper_.ClearSolutionCallback(cb); } ReleaseSolveWrapper(); return(response_.Status); }
public CpSolverStatus SearchAllSolutions(CpModel model, SolutionCallback cb) { string old_parameters = string_parameters_; string_parameters_ += " enumerate_all_solutions:true"; Solve(model, cb); string_parameters_ = old_parameters; return(response_.Status); }
public CpSolverStatus Solve(CpModel model) { if (string_parameters_ != null) { response_ = SatHelper.SolveWithStringParameters(model.Model, string_parameters_); } else { response_ = SatHelper.Solve(model.Model); } return(response_.Status); }
public CpSolverStatus SolveWithSolutionCallback(CpModel model, SolutionCallback cb) { if (string_parameters_ != null) { response_ = SatHelper.SolveWithStringParametersAndSolutionCallback(model.Model, string_parameters_, cb); } else { response_ = SatHelper.SolveWithStringParametersAndSolutionCallback(model.Model, "", cb); } return(response_.Status); }
public CpSolverStatus SearchAllSolutions(CpModel model, SolutionCallback cb) { if (string_parameters_ != null) { string extra_parameters = " enumerate_all_solutions:true"; response_ = SatHelper.SolveWithStringParametersAndSolutionCallback( model.Model, string_parameters_ + extra_parameters, cb); } else { string parameters = "enumerate_all_solutions:true"; response_ = SatHelper.SolveWithStringParametersAndSolutionCallback(model.Model, parameters, cb); } return(response_.Status); }
public CumulativeConstraint(CpModel cp_model, CpModelProto model) : base(model) { this.cp_model_ = cp_model; }
public ReservoirConstraint(CpModel cp_model, CpModelProto model) : base(model) { this.cp_model_ = cp_model; }
public CpSolverStatus SolveWithSolutionCallback(CpModel model, SolutionCallback cb) { return(Solve(model, cb)); }
public CpSolverStatus Solve(CpModel model) { SolveWithSolutionCallback(model, null); return(response_.Status); }