[Symphony] Fwd: Compiling symphony with one callback

Ted Ralphs ted at lehigh.edu
Wed Jan 11 15:06:00 EST 2012


First, you have to configure SYMPHONY with the argument
"--with-application" as described here:

http://www.coin-or.org/SYMPHONY/man-5.4.0/node26.html#build_appl_unix

The easiest way to proceed after that is to just go into the
SYMPHONY/Applications/USER directory, modify the callbacks as you wish and
then do a "make". This will link your code to the libSymApp library rather
than libSym library. At the moment, I'm guessing you are linking to the
libSym, which does not have the hooks for the user callbacks.

In general, it is not possible to define just a single callback the way
your attempting to do. The design is a little different than CPLEX. Using
the template provided by the USER application, though, you can pick and
choose what callbacks you want to modify and any that you do not modify
will simply execute the default implementation.

Hope this helps and sorry if the documentation was confusing at all.

Cheers,

Ted

On Wed, Jan 11, 2012 at 2:13 PM, Haroldo Gambini Santos <
haroldo.santos at gmail.com> wrote:

>  Follows the code:
> #include <coin/OsiSymSolverInterface.hpp>
> #include <coin/symphony.h>
> #include <sym_constants.h>
> #include <sym_macros.h>
> #include <sym_cg_u.h>
>
> int user_find_cuts(void *user, int varnum, int iter_num, int level,
>                    int index, double objval, int *indices, double *values,
>                    double ub, double etol, int *num_cuts, int *alloc_cuts,
>                    cut_data ***cuts);
>
>
> int main(int argc, char **argv)
> {
>    OsiSymSolverInterface *sym = new OsiSymSolverInterface();
>
>    sym->parseCommandLine( argc, argv );
>
>    sym->loadProblem();
>
>    sym->branchAndBound();
>
>    return(0);
> }
>
> int user_find_cuts(void *user, int varnum, int iter_num, int level,
>                    int index, double objval, int *indices, double *values,
>                    double ub, double etol, int *num_cuts, int *alloc_cuts,
>                    cut_data ***cuts)
> {
>    printf("hello.\n");
>
>    return USER_SUCCESS;
>
> }
>
>
> -------- Original Message --------  Subject: Compiling symphony with one
> callback  Date: Wed, 11 Jan 2012 17:12:21 -0200  From: Haroldo Gambini
> Santos <haroldo.santos at gmail.com> <haroldo.santos at gmail.com>  To:
> symphony at list.coin-or.org
>
> Hi,
>
> I'm starting to build a code with SYMPHONY, mainly based in the
> "Walkthrough..." example of Michael Trick.
>
> To start I've just included a callback to insert cuts, but it appears
> that is is not being called.
>
> In Trick's example it only defines the function, but there is no
> sym_set_user_callback (something like that) as I expected.
>
> Although my (small) code compiles fine, the callback is not being called
> (put a printf inside it).
>
> What additional step should I do ?
>
> Cheers,
>
> Haroldo
>
> --
> =============================================================
> Haroldo Gambini Santos
> Computing Department - Universidade Federal de Ouro Preto - UFOP
> email: haroldo [at ] iceb.ufop.br
> home/research page: www.decom.ufop.br/haroldo/
> sy
>
>
>
> _______________________________________________
> Symphony mailing list
> Symphony at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/symphony
>
>


-- 
Dr. Ted Ralphs
Associate Professor, Lehigh University
(610) 628-1280
ted 'at' lehigh 'dot' edu
coral.ie.lehigh.edu/~ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/symphony/attachments/20120111/f6fb1f6d/attachment.html>


More information about the Symphony mailing list