use snake case in knapsack_solver

This commit is contained in:
Laurent Perron
2023-07-01 06:08:49 +02:00
parent c22933c1b9
commit 91c1adc3e1
5 changed files with 15 additions and 20 deletions

View File

@@ -28,12 +28,12 @@ using ::py::arg;
PYBIND11_MODULE(pywrapknapsack_solver, m) {
py::class_<KnapsackSolver>(m, "KnapsackSolver")
.def(py::init<KnapsackSolver::SolverType, const std::string&>())
.def("Init", &KnapsackSolver::Init, arg("profits"), arg("weights"),
.def("init", &KnapsackSolver::Init, arg("profits"), arg("weights"),
arg("capacities"))
.def("Solve", &KnapsackSolver::Solve)
.def("BestSolutionContains", &KnapsackSolver::BestSolutionContains,
.def("solve", &KnapsackSolver::Solve)
.def("best_solution_contains", &KnapsackSolver::BestSolutionContains,
arg("item_id"))
.def("IsSolutionOptimal", &KnapsackSolver::IsSolutionOptimal)
.def("is_solution_optimal", &KnapsackSolver::IsSolutionOptimal)
.def("set_time_limit", &KnapsackSolver::set_time_limit,
arg("time_limit_seconds"))
.def("set_use_reduction", &KnapsackSolver::set_use_reduction,

View File

@@ -27,8 +27,8 @@ class PyWrapAlgorithmsKnapsackSolverTest(unittest.TestCase):
def RealSolve(self, profits, weights, capacities, solver_type, use_reduction):
solver = pywrapknapsack_solver.KnapsackSolver(solver_type, "solver")
solver.set_use_reduction(use_reduction)
solver.Init(profits, weights, capacities)
profit = solver.Solve()
solver.init(profits, weights, capacities)
profit = solver.solve()
return profit