I try to modeling this constraint (flow conservation constraint): Xi = sumj(Zij) = sumj(Zji)
. So i tried the first part : Zji <= Xi
, after that, i used AddImplication like model.AddImplication(Xi, Sumj(Zij))
but it not worked. It is possible to use model.Add(sumj(Zij) == Xi)
but it is time consuming to resolve.
Please, is their others possibility to modeling this constraint in sat-cp format from google or-tools. Thanks
$\begingroup$
$\endgroup$
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
4
Just use the sum formulation, and write linear equations for flow conservation.
-
$\begingroup$ Thanks, i try it and it consume time, and the gap after 20 min is 80%. CpSolverResponse summary: status: FEASIBLE objective: 705892 best_bound: 139016 integers: 1327 booleans: 72801 conflicts: 132 branches: 162463 propagations: 17599138 integer_propagations: 3608747 restarts: 97261 lp_iterations: 0 walltime: 1200.85 usertime: 1200.85 deterministic_time: 1985.02 gap_integral: 26338 solution_fingerprint: 0x69d5619f962f5da1 $\endgroup$– IssoufCommented Sep 24 at 13:31
-
$\begingroup$ you should use more that 1 worker. Can you send me the model ? model.export_to_file('slow_flow.pb.txt') in python $\endgroup$ Commented Sep 24 at 15:16
-
$\begingroup$ i try with 16 workers, the gap is hight: drive.google.com/file/d/1sjjNpkKz2nc7MWEv9nuoNJQh0H7EMLJz/… $\endgroup$– IssoufCommented Sep 24 at 16:42
-
1$\begingroup$ Your model has 1.2M Boolean variables, and 1.2M Linear equations. It is not surprising the gap is high. $\endgroup$ Commented Sep 26 at 12:06