[Symphony-tickets] [SYMPHONY] #90: cuts from user callback are added wrongly
SYMPHONY
coin-trac at coin-or.org
Tue Mar 3 16:13:12 EST 2009
#90: cuts from user callback are added wrongly
-----------------------+----------------------------------------------------
Reporter: asm4 | Owner: asm4
Type: defect | Status: assigned
Priority: major | Milestone: 5.2
Component: Not Sure | Version:
Resolution: | Keywords:
-----------------------+----------------------------------------------------
Changes (by asm4):
* owner: tkr => asm4
* status: new => assigned
Old description:
> cuts added using the function cg_add_explicit_cut() function get added
> wrongly. probably also happens wherever cuts are allocated in different
> applications.
>
> heres a patch.
>
> Index: ../../src/CutGen/cg_func.c
> ===================================================================
> --- ../../src/CutGen/cg_func.c (revision 1588)
> +++ ../../src/CutGen/cg_func.c (working copy)
> @@ -188,11 +188,12 @@
> cut->sense = sense;
> cut->rhs = rhs;
> cut->range = range;
> - cut->size = ISIZE + nzcnt * (ISIZE + DSIZE);
> + cut->size = DSIZE + nzcnt * (ISIZE + DSIZE);
> cut->coef = (char *) malloc (cut->size);
> + ((double *) cut->coef)[0] = 0; /* important to zero out */
> ((int *) cut->coef)[0] = nzcnt;
> - memcpy(cut->coef + ISIZE, (char *)indices, nzcnt*ISIZE);
> - memcpy(cut->coef + (nzcnt + 1) * ISIZE, (char *)values, nzcnt *
> DSIZE);
> + memcpy(cut->coef + DSIZE, (char *)values, nzcnt*DSIZE);
> + memcpy(cut->coef + (nzcnt + 1) * DSIZE, (char *)indices, nzcnt *
> ISIZE);
> cut->branch = DO_NOT_BRANCH_ON_THIS_ROW;
> cut->deletable = TRUE;
> cut->name = send_to_cp ? CUT__SEND_TO_CP : CUT__DO_NOT_SEND_TO_CP;
New description:
cuts added using the function cg_add_explicit_cut() function get added
wrongly. probably also happens wherever cuts are allocated in different
applications.
heres a patch.
{{{
Index: ../../src/CutGen/cg_func.c
===================================================================
--- ../../src/CutGen/cg_func.c (revision 1588)
+++ ../../src/CutGen/cg_func.c (working copy)
@@ -188,11 +188,12 @@
cut->sense = sense;
cut->rhs = rhs;
cut->range = range;
- cut->size = ISIZE + nzcnt * (ISIZE + DSIZE);
+ cut->size = DSIZE + nzcnt * (ISIZE + DSIZE);
cut->coef = (char *) malloc (cut->size);
+ ((double *) cut->coef)[0] = 0; /* important to zero out */
((int *) cut->coef)[0] = nzcnt;
- memcpy(cut->coef + ISIZE, (char *)indices, nzcnt*ISIZE);
- memcpy(cut->coef + (nzcnt + 1) * ISIZE, (char *)values, nzcnt *
DSIZE);
+ memcpy(cut->coef + DSIZE, (char *)values, nzcnt*DSIZE);
+ memcpy(cut->coef + (nzcnt + 1) * DSIZE, (char *)indices, nzcnt *
ISIZE);
cut->branch = DO_NOT_BRANCH_ON_THIS_ROW;
cut->deletable = TRUE;
cut->name = send_to_cp ? CUT__SEND_TO_CP : CUT__DO_NOT_SEND_TO_CP;
}}}
--
Ticket URL: <https://projects.coin-or.org/SYMPHONY/ticket/90#comment:1>
SYMPHONY <http://projects.coin-or.org/SYMPHONY>
The SYMPHONY framework for parallel branch-and-cut algorithms.
More information about the Symphony-tickets
mailing list