Subclassed IntVarLocalSearchOperator() in Python ?

32 views
Skip to first unread message

Dirk Schroetter

unread,
Apr 22, 2013, 4:31:02 AM4/22/13
to or-tools...@googlegroups.com
Hello folks,

yes, another question if I may:

I have written a specialized LSO for my problem derived from IntVarLocalSearchOperator. However, it seems that the overloaded methods of MakeNextNeighbor is not called. The optimizer will happily find NextNeighbors() for teh IntVars (verified using gdb) but my overloaded methods are not called. I get the impression, that I am missing some form of initialization here. The high leve code is:

class NetworkOperator (pywrapcp.IntVarLocalSearchOperator):
  
  def __init__(self, vars, pathsolver, all_paths, num_demands, cycles, toplevel):
     <Init of SuperClass>

     my suff
 
  def MakeNextNeighbor(self, delta, deltadelta):
     <caclulate my neighborhood>

     <logic per LSO example>

....

  network_operator = NetworkOperator (decision_vars, pathsolver,
                                      all_paths, demandindex-1, cycle_basis,
                                      toplevel_nodes)

  inner_db = LNSSolver.Phase(decision_vars,
                             LNSSolver.CHOOSE_RANDOM,
                             LNSSolver.ASSIGN_MIN_VALUE)


  inner_limit = LNSSolver.Limit(2000000000,
                                2000000000,
                                FLAGS.fail_limit,
                                2000000000)



  sl2 = LNSSolver.SearchLog(1,decision_vars[0])

  continuation_db = LNSSolver.SolveOnce (inner_db, inner_limit, sl2)

#  search_parameters=LNSSolver.LocalSearchPhaseParameters(lns_operator, continuation_db)

  search_parameters = LNSSolver.LocalSearchPhaseParameters(network_operator, inner_db)

  final_db = LNSSolver.LocalSearchPhase(decision_vars,db,
                                        search_parameters)

  LNSSolver.NewSearch(final_db,[objective, search_log])

Any pointers where I deviated from teh plan ?

Best Regards,

/Dirk


Laurent Perron

unread,
Apr 24, 2013, 5:49:55 PM4/24/13
to or-tools-discuss
Yes, this is not (yet) supported.
Can you open an issue for that?

Thanks




--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
--Laurent

Reply all
Reply to author
Forward
0 new messages