I am trying to solve linear problem in IBM Cplex. Problem is a complicated version of cheapest path problem. For a given graph find best (cheapest) path between all pairs and go through at least one node from provided list. I solved basic version (without obligatory nodes) with node-link representation. For most cases following constrain was good enough:
sum ( obligatoryNode in obligatoryNodes, a in neighbourOut[obligatoryNode] ) x[<a, obligatoryNode>][d] >= 1;
However I encountered cases when this is not enough and I got additional not connected link just to fulfil that constrains.
What is mathematical formula that ensure that founded path is continuous?
My model from cplex https://pastebin.com/vJXCvggt