Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the positional index t[i] and t[j] well in the TSP solved by CPLEX? #2

Open
worldstar opened this issue Mar 15, 2020 · 0 comments

Comments

@worldstar
Copy link

It is good to see the positional index of t[i] and t[j] is formulated shown in the following link.
https://github.com/alberto-santini/cplex-example/blob/master/src/solver.cpp
This positional index is able to show the sequence of each node.
Because this positional index is not used further in the model,
what if we like to use this positional index to calculate the objective function,
how could we modify the following code?
Thank you.

// Create objective function
for(auto i = 0u; i < n; ++i) {
  for(auto j = 0u; j < n; ++j) {
    expr += g.cost(i, j) * x[i][j];
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant