MCPcopy Create free account
hub / github.com/cvanaret/Uno / define_Result

Function define_Result

interfaces/Python/python_modules/Result.cpp:18–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16 }
17
18 void define_Result(py::module& module) {
19 py::class_<Result>(module, "Result")
20 // attributes
21 .def_readonly("optimization_status", &Result::optimization_status)
22 .def_readonly("solution_status", &Result::solution_status)
23 .def_readonly("solution_objective", &Result::solution_objective)
24 .def_readonly("solution_primal_feasibility", &Result::solution_primal_feasibility)
25 .def_readonly("solution_stationarity", &Result::solution_stationarity)
26 .def_readonly("solution_complementarity", &Result::solution_complementarity)
27 .def_property_readonly("primal_solution", [](const Result& result) {
28 return to_owned_array(result.primal_solution);
29 })
30 .def_property_readonly("constraint_dual_solution", [](const Result& result) {
31 return to_owned_array(result.constraint_dual_solution);
32 })
33 .def_property_readonly("lower_bound_dual_solution", [](const Result& result) {
34 return to_owned_array(result.lower_bound_dual_solution);
35 })
36 .def_property_readonly("upper_bound_dual_solution", [](const Result& result) {
37 return to_owned_array(result.upper_bound_dual_solution);
38 })
39 .def_property_readonly("solution_constraints", [](const Result& result) {
40 return to_owned_array(result.constraint_values);
41 })
42 .def_readonly("number_iterations", &Result::number_iterations)
43 .def_readonly("cpu_time", &Result::cpu_time)
44 .def_readonly("number_objective_evaluations", &Result::number_objective_evaluations)
45 .def_readonly("number_constraint_evaluations", &Result::number_constraint_evaluations)
46 .def_readonly("number_objective_gradient_evaluations", &Result::number_objective_gradient_evaluations)
47 .def_readonly("number_jacobian_evaluations", &Result::number_jacobian_evaluations)
48 .def_readonly("number_hessian_evaluations", &Result::number_hessian_evaluations)
49 .def_readonly("number_subproblems_solved", &Result::number_subproblems_solved);
50
51 py::enum_<OptimizationStatus>(module, "OptimizationStatus")
52 .value("SUCCESS", OptimizationStatus::SUCCESS)
53 .value("ITERATION_LIMIT", OptimizationStatus::ITERATION_LIMIT)
54 .value("TIME_LIMIT", OptimizationStatus::TIME_LIMIT)
55 .value("EVALUATION_ERROR", OptimizationStatus::EVALUATION_ERROR)
56 .value("ALGORITHMIC_ERROR", OptimizationStatus::ALGORITHMIC_ERROR);
57
58 py::enum_<SolutionStatus>(module, "SolutionStatus")
59 .value("NOT_OPTIMAL", SolutionStatus::NOT_OPTIMAL)
60 .value("FEASIBLE_KKT_POINT", SolutionStatus::FEASIBLE_KKT_POINT)
61 .value("FEASIBLE_FJ_POINT", SolutionStatus::FEASIBLE_FJ_POINT)
62 .value("INFEASIBLE_STATIONARY_POINT", SolutionStatus::INFEASIBLE_STATIONARY_POINT)
63 .value("FEASIBLE_SMALL_STEP", SolutionStatus::FEASIBLE_SMALL_STEP)
64 .value("INFEASIBLE_SMALL_STEP", SolutionStatus::INFEASIBLE_SMALL_STEP)
65 .value("UNBOUNDED", SolutionStatus::UNBOUNDED);
66 }
67} // namespace

Callers 1

PYBIND11_MODULEFunction · 0.85

Calls 1

to_owned_arrayFunction · 0.85

Tested by

no test coverage detected