Thanks for the pointer, Philippe. I would like to control the order in which interval variables are fixed, based on a custom function. Therefore, I was expecting a function with signature
IloSearchPhase(env, intervalVarArray, varChooser, valueChooser)
, or something similar. However, such an interface is missing. I don't see how I can accomplish this with the ones that are available. I'm assuming at this point that I'll have to resort to manipulating
IlcGoal
in order to achieve this. Is that correct?
------------------------------
Marijn K
------------------------------
Original Message:
Sent: Fri August 12, 2022 09:29 AM
From: Philippe Refalo
Subject: Custom branching strategy with docplex
On this page you can find the documentation about search phases and variable/value selectors:
https://www.ibm.com/docs/en/icos/22.1.0?topic=search-ordering-variables-values
You have several level of selection:
1. Order groups of variables
2. Use already-defined variable and value selectors on a group
3. Write your own selector for variables and values.
Regards
Philippe
------------------------------
Philippe Refalo
IBM ILOG CP Optimizer
Original Message:
Sent: Fri August 12, 2022 08:58 AM
From: Marijn K
Subject: Custom branching strategy with docplex
Thanks for the clarification Renaud. Can you please point me to the relevant documentation page for the C++ API? I'm having some trouble locating it.
------------------------------
Marijn K
Original Message:
Sent: Thu August 04, 2022 10:21 AM
From: Renaud Dumeur
Subject: Custom branching strategy with docplex
Dear Marijn,
It is not yet possible. Custom var and value choosers are only available in C++ and Java.
Cheers,
------------------------------
Renaud Dumeur
Original Message:
Sent: Thu August 04, 2022 07:13 AM
From: Marijn K
Subject: Custom branching strategy with docplex
I understand that it is common to work from solution to solution, but I really need to be able to influence each branching decision. I understand that this can be done with search phases. However, the currently available functions for choosing variables are not flexible enough for my purposes. Is there a way to customize/add varchooser/valchooser functions for the search_phase function?
------------------------------
Marijn K
Original Message:
Sent: Fri July 08, 2022 06:53 AM
From: Cédric Doens
Subject: Custom branching strategy with docplex
If a CpoSolveResult contains a solution (is_solution()), you can get its CpoModelSolution representation directly (get_solution()).
Note that the methods implemented in the class CpoModelSolution to access solution elements are available directly CpoSolveResult,
so you can use them as condition to end the current search (end_search())
The general idea is:
- start a first search, examine each new solution until it meet your criteria; then store a first solution and end the search
- start a second search using the first solution as a starting point.
Each search might use its proper search phases.
A starting point accepts partial CpoModelSolution . Indeed you can create_empty_solution() then populate it with external values such as values extracted from previous solutions. (e.g. plant_location_with_starting_point)
------------------------------
Cédric Doens
Original Message:
Sent: Thu July 07, 2022 11:36 AM
From: Marijn K
Subject: Custom branching strategy with docplex
Thank you again for your help. This does indeed look more like what I'm after. I see though that it is limited to only adjusting the search phases whenever a solution is reached. Is there any possibility for more fine-grained control? The propagate() function looks promising for taking single steps. But I can't find how I would use the resulting CpoSolveResult as a new starting point. Would it work to use that to build a new partial CpoModelSolution (with create_empty_solution()) and then use that as a new starting point?
------------------------------
Marijn K
Original Message:
Sent: Thu July 07, 2022 09:36 AM
From: Cédric Doens
Subject: Custom branching strategy with docplex
Once the solver research is launched, its strategy cannot change.
However, a common practice is to start a new search, with its own phases, using a previously reached solution as a Starting Point.
This might suit your situation
------------------------------
Cédric Doens
Original Message:
Sent: Thu July 07, 2022 06:35 AM
From: Marijn K
Subject: Custom branching strategy with docplex
Thank you for you response, Cédric. Is there a way then, to update/change the search phases between decision points? I would like to steer the decision-making progress based on the current state of the solving process.
------------------------------
Marijn K
Original Message:
Sent: Wed July 06, 2022 04:53 AM
From: Cédric Doens
Subject: Custom branching strategy with docplex
The Python API does not provide a full access to the branching strategy yet. Only C++ API does.
However the Search Phases customize the selection and the evaluation of the variables. They may help.
------------------------------
Cedric Doens
Original Message:
Sent: Thu June 30, 2022 08:56 AM
From: Marijn K
Subject: Custom branching strategy with docplex
Is there any way to use a completely custom (external) branching strategy for the CP optimizer through docplex's Python API? I was hoping there is some way callback or goal interface in the API, but I cannot find it in the documentation. Is this at all possible?
------------------------------
Marijn K
------------------------------
#DecisionOptimization