Skip to content

Commit

Permalink
Added |E| constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
phspo committed Apr 25, 2018
1 parent d34baa1 commit 8782fa4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/ILPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,32 @@ long ILPSolver::solve(const ClusterEditingInstance& inst, ClusterEditingSolution
}
M.add(cluster_association >= 1);
}

//Even more Constraints:
/** Those are adapted from Bulhões et al. 2017 (http://dx.doi.org/10.1016/j.dam.2016.10.026)
*
*/

// |E|-Bounds Inequalities
IloExpr edgeCountTotal(cplexEnv);
for (FullGraph::EdgeIt i(g); i != INVALID; ++i){
edgeCountTotal += x[g.id(i)];
}
// Upper Bound
M.add(
edgeCountTotal <= (
(g.nodeNum()-(_clusterCount -1))*(g.nodeNum()-(_clusterCount -1)-1)
)/2
);
// Lower Bound
int q = std::floor(g.nodeNum()/_clusterCount);
M.add(
edgeCountTotal >=
(g.nodeNum() % _clusterCount)*
((q*(q+1))/2) +
(_clusterCount-(g.nodeNum() % _clusterCount))*
((q*(q-1))/2)
);
}

if (verbosity > 1)
Expand Down

0 comments on commit 8782fa4

Please sign in to comment.