Callable Library C++ API

SYMPHONY's C++ interface is derived from COIN-OR's Open Solver Interface (OSI). The OSI methods are implemented simply as wrapped calls to the SYMPHONY C callable library just described. For instance, when an instance of the OSI interface class is constructed, a call is made to sym_open_environment() and a pointer to the environment is stored in the class and when the OSI object is destroyed, sym_close_environment is called to destroy the environment object. Most subsequent calls within the class can then be made without any arguments. To fully support SYMPHONY's capabilities, we have extended the OSI interface to include some other methods not in the base class. For example, we added calls equivalent to our sym_parse_command_line() and sym_find_initial_bounds(). Additionally, SYMPHONY has a warm start class derived from the CoinWarmStart base class to support the new functionalities of the MILP warm starting such as sym_get_warm_start and sym_set_warm_start. They are also implemented as wrapped calls to the C interface library.

In order to have the whole list of the methods and information regarding their usage, see the OSI SYMPHONY interface and SYMPHONY warm start header files (OsiSymSolverInterface.hpp and SymWarmStart.hpp). Here, we will give the table of the C library equivalent calls of the C++ interface routines with brief descriptions:

15cm12cm
C++ Interface C Interface Description
OsiSymSolverInterface sym_open_environment create a new environment.
loadProblem sym_load_problem load the problem read trough an MPS or GMPL file
branchAndBound sym_solve/sym_warm_solve solve the MILP problem from scratch or
    from a warm start if loaded.
resolve sym_warm_solve re-solve the MILP problem after some modifications.
initialSolve sym_solve solve the MILP problem from scratch.
multiCriteriaBranchAndBound sym_mc_solve solve the multi criteria problem.
setInitialData sym_set_defaults set the parameters to their defaults.
parseCommandLine sym_parse_command_line read the command line arguments.
findInitialBounds sym_find_initial_bounds find the initial bounds via the user defined heuristics.
createPermanentCutPools sym_create_permanent_cut_pools save the global cuts.
loadProblem sym_explicit_load_problem load the problem through a set of arrays.
getWarmStart sym_get_warm_start get the warm start description.
setWarmStart sym_set_warm_start set the warm start description.
getLbForNewRhs sym_get_lb_for_new_rhs find a lower bound to the new rhs problem
    using the post solution info.
getUbForNewRhs sym_get_lb_for_new_rhs find an upper bound to the new rhs problem.
    using the post solution info.
getLbForNewObj sym_get_lb_for_new_rhs find a lower bound to the new obj problem.
    using the post solution info.
getUbForNewObj sym_get_lb_for_new_rhs find an upper bound to the new obj problem.
    using the post solution info.
reset sym_close_environment return the allocated memory.
setIntParam sym_set_int_param set the integer type OSI parameter.
setSymParam(int) sym_set_int_param set the integer type SYMPHONY parameter.
setDblParam sym_set_dbl_param set the double type OSI parameter.
setSymParam(double) sym_set_dbl_param set the double type SYMPHONY parameter.
setStrParam sym_set_str_param set the string type OSI parameter.
setSymParam(string) sym_set_str_param set the string type SYMPHONY parameter.
getIntParam sym_get_int_param get the value of the integer type OSI parameter.
getSymParam(int &) sym_get_int_param get the value of the integer type SYMPHONY parameter.
getDblParam sym_get_dbl_param get the value of the double type OSI parameter.
getSymParam(double &) sym_get_dbl_param get the value of the double type SYMPHONY parameter.
getStrParam sym_get_str_param get the value of the string type OSI parameter.
getSymParam(string &) sym_get_str_param get the value of the string type SYMPHONY parameter.
isProvenOptimal sym_is_proven_optimal query the problem status.
isProvenPrimalInfeasible sym_is_proven_primal_infeasible query the problem status.
isPrimalObjectiveLimitReached sym_is_target_gap_achieved query the problem status.
isIterationLimitReached sym_is_iteration_limit_reached query the problem status.
isTimeLimitReached sym_is_time_limit_reached query the problem status.
isTargetGapReached sym_is_target_gap_achieved query the problem status.
getNumCols sym_get_num_cols get the number of columns.
getNumRows sym_get_num_rows get the number of rows.
getNumElements sym_get_num_elements get the number of nonzero elements.
getColLower sym_get_col_lower get the column lower bounds.
getColUpper sym_get_col_upper get the column upper bounds.
getRowSense sym_get_row_sense get the row senses.
getRightHandSide sym_get_rhs get the rhs values.
getRowRange sym_get_row_range get the row range values.
getRowLower sym_get_row_lower get the row lower bounds.
getRowUpper sym_get_row_upper get the row upper bounds.
getObjCoefficients sym_get_obj_coeff get the objective function vector.

15cm10.5cm
C++ Interface C Interface Description
getObjSense sym_get_obj_sense get the objective sense.
isContinuous sym_is_continuous query the variable type.
isBinary sym_is_binary query the variable type.
isInteger sym_is_integer query the variable type.
isIntegerNonBinary - query the variable type.
isFreeBinary sym_is_binary query the variable type.
getMatrixByRow - get the constraint matrix by row oriented.
getMatrixByCol - get the constraint matrix by column oriented.
getInfinity - get the infinity definition of SYMPHONY.
getColSolution sym_get_col_solution get the current best column solution.
getRowActivity sym_get_row_activity get the current row activity.
getObjValue sym_get_obj_val get the current best objective value.
getPrimalBound sym_get_primal_bound get the primal upper bound.
getIterationCount sym_get_iteration_count get the number of the analyzed tree nodes.
setObjCoeff sym_set_obj_coeff set the objective function vector.
setObj2Coeff sym_set_obj2_coeff set the second objective function vector.
setColLower sym_set_col_lower set the column lower bounds.
setColUpper sym_set_col_upper set the column upper bounds.
setRowLower sym_set_row_lower set the row lower bounds.
setRowUpper sym_set_row_upper set the row upper bounds.
setRowType sym_set_row_type set the row characteristics.
setObjSense sym_set_obj_sense set the objective sense.
setColSolution sym_set_col_solution set the current solution.
setContinuous sym_set_continuous set the variable type.
setInteger sym_set_integer set the variable type.
setColName sym_set_col_names set the column names.
addCol sym_add_col add columns to the constraint matrix.
addRow sym_add_row add rows to the constraint matrix.
deleteCols sym_delete_cols delete some columns from the constraint matrix.
deleteRows sym_delete_rows delete some rows from the constraint matrix.
writeMps - write the current problem in MPS format.
applyRowCut - add some row cuts.
applyColCut - add some column cuts.
SymWarmStart(warm_start_desc *) sym_create_copy_warm_start create a SYMPHONY warm start by copying the given one.
SymWarmStart(char *) sym_read_warm_start create a SYMPHONY warm start reading from file.
getCopyOfWarmStartDesc sym_create_copy_warm_start get the copy of the warm start structure.
writeToFile sym_write_warm_start_desc write the loaded warm start to a file.

Ted Ralphs
2011-05-30