1
$\begingroup$

I tried this code and it goes on and I'm clueless when it'll end so I manually interrupt it.

Is there any way we can see intermediate solutions that are feasible solutions and can we limit time or number of Feasible solution if optimal solution search takes time. I'm having 16 Gigs of RAM yet struggle to get optimal solution if runs instance of Large Sample.

Second Part: I ran code in jupyter notebook initially and ended with error

DuplicateFlagError: The flag 'params' is defined twice. First from C:\Users\Dell\anaconda3\lib\site-packages\ipykernel_launcher.py, Second from C:\Users\Dell\anaconda3\lib\site-packages\ipykernel_launcher.py.  Description from first occurrence: Sat solver parameters.

Is there any way of tackling this or not using FLAGS in general and declare instances as user input. After error I tried PyCharm where Small sample worked fine but others ended with no output and were utilizing 95% CPU in background so needed to interrupt.

$\endgroup$

1 Answer 1

1
$\begingroup$
  1. The large instance is very hard to solve. I need to spend some time on it, but I lack ideas and time.
  2. The flags part is problematic with jupyter notebook. We will fix those.
  3. To print intermediate solution, you need a callback. See this code sample
$\endgroup$
4
  • $\begingroup$ So in that example we have x,y,z as variables that are passed in solution printer 'solution_printer = VarArrayAndObjectiveSolutionPrinter([x, y, z])' so what needs to be passed in Bus-Driver example as that is assigning shifts to num_drivers in firstpass. Will it be num_drivers as argument and what about second pass ? $\endgroup$ Jul 31, 2021 at 16:47
  • $\begingroup$ [cont..] I tried ` solution_printer = VarArrayAndObjectiveSolutionPrinter([num_drivers]) status = solver.SolveWithSolutionCallback(model, solution_printer) print('Status = %s' % solver.StatusName(status)) print('Number of solutions found: %i' % solution_printer.solution_count())` that resulted in Solution 11 objective value = 13 24 = 24 whereas I was looking at drivers with shifts as intermediate solution. Any way we can achieve that ? $\endgroup$ Jul 31, 2021 at 16:57
  • $\begingroup$ You need to write a custom solution printer $\endgroup$ Jul 31, 2021 at 20:55
  • $\begingroup$ Hi again, I tried to make changes last week but none of them yielded fruitful results. Could you please help me with just code snippets so as what arguments should be passed in solution printer and how those args should be read by solution printer callback function to display results. That would be great help..! $\endgroup$ Aug 8, 2021 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.