Camargue
active_tour.hpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
7 #ifndef CMR_ACTIVE_TOUR_H
8 #define CMR_ACTIVE_TOUR_H
9 
10 #include "datagroups.hpp"
11 #include "lp_interface.hpp"
12 #include "lp_util.hpp"
13 
14 #include <utility>
15 #include <vector>
16 
17 namespace CMR {
18 namespace LP {
19 
30 class ActiveTour {
31 public:
32  ActiveTour() = default;
33 
35  ActiveTour(const Graph::CoreGraph &graph,
36  const Data::BestGroup &best_data);
37 
39  ActiveTour(std::vector<int> tour_nodes_,
40  std::vector<double> lp_edges, Basis base,
41  double lp_objval,
42  const Graph::CoreGraph &graph);
43 
45  ActiveTour(std::vector<int> tour_nodes_,
46  LP::Relaxation &relax,
47  const Graph::CoreGraph &graph);
48 
49  ActiveTour(ActiveTour &&T) noexcept;
50  ActiveTour &operator=(ActiveTour &&T) noexcept;
51 
52  void set_basis(Basis new_base) { tour_base = std::move(new_base); }
53 
54  void instate(Relaxation &relax);
55 
57  void reset_instate(Relaxation &relax);
58 
60  void best_update(Data::BestGroup &best_data) const;
61 
63  void enter_tourless(Data::BestGroup &best_data);
64 
65  double length() const { return tour_len; }
66 
67  bool tourless() const { return tourless_mode; }
68 
69  const std::vector<int> &nodes() const { return tour_nodes; }
70  const std::vector<int> &tour_perm() const { return perm; }
71 
72  const std::vector<double> &edges() const { return tour_edges; }
73 
74  const Basis &base() const { return tour_base; }
75 
76 private:
77  double tour_len;
78 
79  std::vector<int> tour_nodes;
80  std::vector<int> perm;
81 
82  std::vector<double> tour_edges;
83 
84  Basis tour_base;
85 
86  bool tourless_mode = false;
87 };
88 
89 }
90 }
91 
92 #endif
Miscellaneous functions, structs/enums, and constants for LPs.
Information about the current best tour.
Definition: datagroups.hpp:154
void enter_tourless(Data::BestGroup &best_data)
Go into tourless mode of operation with best tour.
Definition: active_tour.cpp:308
void best_update(Data::BestGroup &best_data) const
Update best_data with the this tour.
Definition: active_tour.cpp:279
Data group structures.
Graph structures for the edges currently in a CoreLP::Relaxation.
Definition: datagroups.hpp:100
Interface to the LP solver.
Row and column basic statuses corresponding to some LP solution.
Definition: lp_util.hpp:76
void instate(Relaxation &relax)
Instate this tour in relax.
Definition: active_tour.cpp:253
Information about the active tour in a CoreLP.
Definition: active_tour.hpp:30
Class for storing an lp relaxation via interface to an lp solver.
Definition: lp_interface.hpp:33
The namespace for this project.
Definition: abc_nodesel.hpp:20
void reset_instate(Relaxation &relax)
Get a new basis for this tour from relax, instating it.
Definition: active_tour.cpp:221