Closed light-and-salt closed 1 year ago
I would not know how to map this to optimization constraints. It sounds possible in two steps though. You can probably enumerate valid nodes. And for each valid node compute a shortest path (if there is one path to a node then there is also a shortest one). You might also want to have a look at asprin. Maybe it allows you to write this nicely. Otherwise, this sounds like a problem that could be formulated using a disjunctive program. But such an approach is both cumbersome to implement and does not scale well.
Thank you so much @rkaminsk! That answers my question
Question: Is there a way to express "for each (valid) node X, find the shortest path from the root to X?"
Attempt: This is what I have so far:
When I only include
#maximize { 100 @2, X : valid_node(X) }.
, I get thousands of solutions, each containing onevalid_node(X)
.When I include both
#maximize
and#minimize
, I get 2 optimum solutions -- the two shortest paths among all the paths leading to all validX
. All the other solutions, even though they contain validX
, were considered non-optimal because their paths are longer. This is not what I want... I want to find all validX
, and find the shortest path for eachX
. Wondering how I could achieve this...