5 #define is_true(x) (lround(x))
9 #define LAZY_ADD_ALL_CYCLES
13 #include <boost/bimap.hpp>
14 #include <boost/bimap/unordered_set_of.hpp>
16 #include <ilcplex/ilocplex.h>
19 #include "utils/graph_typedefs.hpp"
23 namespace scaffold {
namespace solv {
namespace ilp {
27 bool ignore_contig_jumps;
33 bool _multi_take_all =
true
35 ignore_contig_jumps(_ignore_contig_jumps),
36 multi_take_all(_multi_take_all)
42 unsigned times_called;
51 using VertexVarMap = boost::unordered_map<ScafVertex, IloNumVar>;
52 using VertexVarIter =
typename VertexVarMap::iterator;
53 using VertexAndVar =
typename VertexVarMap::value_type;
56 using VertexExpMap = boost::unordered_map<ScafVertex, IloExpr>;
57 using VertexExpIter =
typename VertexExpMap::iterator;
58 using VertexAndExp =
typename VertexExpMap::value_type;
61 using EdgeVarMap = boost::unordered_map<ScafVertexPair, IloNumVar>;
62 using EdgeVarIter =
typename EdgeVarMap::iterator;
63 using EdgeVarCIter =
typename EdgeVarMap::const_iterator;
64 using EdgeAndVar =
typename EdgeVarMap::value_type;
67 using EdgeExpMap = boost::unordered_map<ScafVertexPair, IloExpr>;
68 using EdgeExpIter =
typename EdgeExpMap::iterator;
69 using EdgeExpCIter =
typename EdgeExpMap::const_iterator;
70 using EdgeAndExp =
typename EdgeExpMap::value_type;
74 using ContigJumpVars = boost::unordered_map<ScafVertexPair, std::list<EdgeVarMap> >;
79 EdgeVarMap times_used_undir;
80 VertexVarMap from_source, to_path_sink, to_cycle_sink;
86 using var_collection_virt::var_collection_virt;
87 EdgeVarMap times_used;
88 EdgeVarMap used_at_all;
89 EdgeVarMap contig_jumps;
95 template<
typename VertexProp = no_property,
typename EdgeProp = no_property>
96 using AuxiliaryGraph = adjacency_list<hash_setS,
104 template<
class GraphA,
class GraphB>
105 using TranslateBiMap = boost::bimap< boost::bimaps::unordered_set_of<Vertex<GraphA> >, boost::bimaps::unordered_set_of<Vertex<GraphB> > >;
113 IloCplex::CallbackI* duplicateCallback()
const{
118 IloCplex::SolveCallbackI(env),
125 std::cout<<
"Relaxation solution in root has value "<<getBestObjValue()<<std::endl;
126 stats.root_relax = getBestObjValue();
138 void print_true_map_vars(
const IloCplex& cplex,
140 const EdgeVarMap& vars,
141 const std::string& prefix =
"",
142 std::ostream& os = std::cout)
144 bool is_empty =
true;
145 for(
const auto& v_pair: vars)
146 if(is_true(cplex.getValue(v_pair.second))){
153 if(!is_empty) os << std::endl;
158 void print_contig_jumps(
const IloCplex& cplex,
159 const var_collection_multi& vars,
160 std::ostream& os = std::cout)
162 print_true_map_vars(cplex, vars.I, vars.contig_jumps,
"", os);
166 void add_to_VExpr(
const IloEnv& env,
167 VertexExpMap& expr_map,
172 expr_map.DEEP_EMPLACE(u, env).first->second += (x * scale);
Definition: ilp_common.hpp:85
Definition: read_adj_list.hpp:22
a simple timer class that can be paused and resumed
Definition: profiling.hpp:23
an instance is a ScaffoldGraph with given path- & cycle- numbers and a solution to keep track of dele...
Definition: instance.hpp:27
Definition: ilp_common.hpp:108
EdgeName get_edge_name(const VertexPair< Graph > &uv) const
get a copy of the name of the edge uv; independent of its presence
Definition: scaffold_graph.hpp:421
Definition: ilp_common.hpp:25
Definition: ilp_common.hpp:40
Definition: ilp_common.hpp:77