carl  24.04
Computer ARithmetic Library
LPAssignment.cpp
Go to the documentation of this file.
1 #include "LPAssignment.h"
2 
3 
4 #include <carl-common/config.h>
5 #ifdef USE_LIBPOLY
6 
7 #include "../../poly/libpoly/LPVariables.h"
8 
9 
10 namespace carl {
11 
12 LPAssignment::LPAssignment() {
13  lp_assignment_construct(&lp_assignment, LPVariables::getInstance().lp_var_db);
14 }
15 
16 LPAssignment::~LPAssignment() {
17  lp_assignment_destruct(&lp_assignment);
18 }
19 
21  if (last_assignment == ass) {
22  return lp_assignment;
23  } else {
24  last_assignment = ass;
25  if (lp_assignment.values) {
26  for (size_t i = 0; i < lp_assignment.size; ++ i) {
27  lp_assignment_set_value(&lp_assignment, i, 0);
28  }
29  }
30  for (const auto& entry : ass) {
31  lp_assignment_set_value(&lp_assignment, LPVariables::getInstance().lp_variable(entry.first), entry.second.get_internal());
32  }
33  return lp_assignment;
34  }
35 }
36 
37 } // namespace carl
38 
39 #endif
carl is the main namespace for the library.
std::map< Variable, T > Assignment
Definition: Common.h:13
auto & get(const std::string &name)