0
  1. what I want to do:

    I want to observe the process data of the scip provided branching rules (i.e. strang branch and relpscost) at each node, which includes LPSolution, branching depth, branching score, lower bound, and so on. Hence, I need to collect the branching data created by scip provided rules.

  2. what I did and tried:

    I think I can use the methods described in the How to add branching rules, I have read this page and try to coding using c++, the procedure see below. While I debug this procedure, I find that I can find the relpscost rule, and the error printed which shows Exception: EXC_BAD_ACCESS (code=1, address=0x28) after implementing the function branchexeclp(scip, relpscostRule, true, result);

static
SCIP_DECL_BRANCHEXECLP(collectBranchProcessData)
{
    SCIP_BRANCHRULE* relpscostRule = SCIPfindBranchrule(scip, "relpscost");
    SCIP_RETCODE (*branchexeclp)(SCIP* scip, SCIP_BRANCHRULE* branchrule, SCIP_Bool allowaddcons, SCIP_RESULT* result);
    branchexeclp(scip, relpscostRule, true, result);

    // TODO: get the data that I want to observe by calling the SCIP APIs.

    *result = SCIP_BRANCHED;
    return SCIP_OKAY;
}
  1. how can I collect the data I want to observe?
CCLDG
  • 3
  • 2

2 Answers2

0

For reliability branching, you can actually call SCIPexecRelpscostBranching and even run it without executing the branching (so that would just compute all the things you want for you).

Then you can get the statistics you want by calling different methods (such as SCIPvarGetLPSol to get the LP solution for a variable, SCIPgetVarPseudocostScore, etc)

If there is a specific method that you can't find, please specify.

Leon
  • 1,588
  • 1
  • 7
  • 16
0

An abnormal phenomenon appears that: the SCIPexecRelpscostBranching is called in the procedure (1) following your @Leon advice by

SCIP_DECL_BRANCHEXECLP(branchExeclpTest)
{
    int ncands;
    SCIP_VAR** branchcands;
    SCIP_Real* branchcandssol;
    SCIP_Real* branchcandsfrac;
    int npriolpcands;
    int nfracimplvars;

    SCIP_CALL( SCIPgetLPBranchCands( scip, &branchcands, &branchcandssol, &branchcandsfrac, &ncands, &npriolpcands, &nfracimplvars) );
    SCIP_CALL( SCIPexecRelpscostBranching(scip, branchcands, branchcandssol, branchcandsfrac, ncands, FALSE,  result) );

    *result = SCIP_BRANCHED;

    return SCIP_OKAY;
}

meanwhile, to make sure it's the right code, I also tried don't include any branching rule in the main function (the procedure (2)), and solve the same MILP using the command line in the shell (the procedure (3)). Because the priority is ranked top, so I didn't change the priority in the (2) and (3). After that, I found the performance of these three procedures are different. They solved a different number of nodes to solve the same MILP and using the same branching rule.

The solving process of the procedure (1), procedure (2), and the procedure (3) is posted here. Did I call the SCIPexecRelpscostBranching by mistake? Why their performance are different while they seem to use the same branching rule?

CCLDG
  • 3
  • 2