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

Missing final objective with OR-Tools CP-SAT solver #47

Open
AllenZzw opened this issue Dec 2, 2024 · 3 comments · May be fixed by #49
Open

Missing final objective with OR-Tools CP-SAT solver #47

AllenZzw opened this issue Dec 2, 2024 · 3 comments · May be fixed by #49

Comments

@AllenZzw
Copy link
Contributor

AllenZzw commented Dec 2, 2024

model and data: cable-tree-wiring.zip

Running the schedule function with the above instance using CP-SAT results in inconsistency between stat.yml file and sol.yml.

The objective of the last solution in sol.yml is 1524056:

- configuration: CPSAT_free_all
  data_file: challenge/mznc2024_probs/cable-tree-wiring/A041.dzn
  model: challenge/mznc2024_probs/cable-tree-wiring/ctw.mzn
  problem: cable-tree-wiring
  solution:
    cfp: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
      22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
      41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 1]
    objective: 1524056
    pfc: [24, 32, 34, 42, 43, 45, 4, 2, 6, 8, 10, 26, 29, 5, 40, 41, 44, 46, 49, 7,
      11, 14, 15, 20, 19, 30, 33, 35, 23, 27, 50, 3, 1, 36, 38, 9, 25, 28, 37, 31,
      22, 21, 47, 48, 39, 12, 13, 16, 17, 18]
  status: SATISFIED
  time: 21.35
- {configuration: CPSAT_free_all, data_file: challenge/mznc2024_probs/cable-tree-wiring/A041.dzn,
  model: challenge/mznc2024_probs/cable-tree-wiring/ctw.mzn, problem: cable-tree-wiring,
  status: OPTIMAL_SOLUTION}

while the stat.yml shows a different objective 1524060.0:

{boolVariables: 5270, configuration: CPSAT_free_all, data_file: challenge/mznc2024_probs/cable-tree-wiring/A041.dzn,
  evaluatedHalfReifiedConstraints: 78, evaluatedReifiedConstraints: 2450, failures: 9488,
  flatBoolConstraints: 2439, flatBoolVars: 4928, flatIntConstraints: 5700, flatIntVars: 2708,
  flatTime: 0.457866, method: minimize, model: challenge/mznc2024_probs/cable-tree-wiring/ctw.mzn,
  nSolutions: 77, objective: 1524060.0, objectiveBound: 1524060.0, paths: 0, problem: cable-tree-wiring,
  propagations: 19294008, solveTime: 21.2494, status: OPTIMAL_SOLUTION, time: 22.248722480027936}
@Dekker1
Copy link
Member

Dekker1 commented Dec 2, 2024

Just to confirm, 1524060.0 is the objective of the solution just before the last one?

@AllenZzw
Copy link
Contributor Author

AllenZzw commented Dec 2, 2024

Just to confirm, 1524060.0 is the objective of the solution just before the last one?

No, it is not. Here are the yaml files log.zip. Actually, 1524060.0 does not correspond to an objective of any solution found.

@Dekker1
Copy link
Member

Dekker1 commented Dec 6, 2024

Looking at the code, it might be the expectation that we add a objective to the statistics, but I think OR-Tools might be outputting its own objective statistic and overriding it. (And the internal or FlatZinc objective value might be scaled or offset somehow from what the MiniZinc objective is).

I think I know how to resolve this and will get back to you with something to test.

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

Successfully merging a pull request may close this issue.

2 participants