-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcombsep.cpp
More file actions
60 lines (50 loc) · 1.76 KB
/
Copy pathcombsep.cpp
File metadata and controls
60 lines (50 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* SAS modified this file. */
/* (C) Copyright 2003 Jens Lysgaard. All rights reserved. */
/* OSI Certified Open Source Software */
/* This software is licensed under the Common Public License Version 1.0 */
#include <stdlib.h>
#include <stdio.h>
#include "memmod.h"
#include "basegrph.h"
#include "cnstrmgr.h"
#include "strcomb.h"
void COMBSEP_SeparateCombs(int NoOfCustomers,
int *Demand,
int CAP,
int QMin,
int NoOfEdges,
int *EdgeTail,
int *EdgeHead,
double *EdgeX,
int MaxNoOfCuts,
double *MaxViolation,
CnstrMgrPointer CutsCMP)
{
int i,j;
double **XMatrix;
ReachPtr SupportPtr;
ReachInitMem(&SupportPtr,NoOfCustomers+1);
XMatrix = MemGetDM(NoOfCustomers+2,NoOfCustomers+2);
for (i=1; i<=NoOfCustomers+1; i++)
for (j=1; j<=NoOfCustomers+1; j++)
XMatrix[i][j] = 0.0;
for (i=1; i<=NoOfEdges; i++)
{
ReachAddForwArc(SupportPtr,EdgeTail[i],EdgeHead[i]);
ReachAddForwArc(SupportPtr,EdgeHead[i],EdgeTail[i]);
XMatrix[EdgeTail[i]][EdgeHead[i]] = EdgeX[i];
XMatrix[EdgeHead[i]][EdgeTail[i]] = EdgeX[i];
}
/* Ready to call comb separation */
STRCOMB_MainStrengthenedCombs(SupportPtr,
NoOfCustomers,
CAP,
Demand,
QMin,
XMatrix,
MaxNoOfCuts,
MaxViolation,
CutsCMP);
MemFreeDM(XMatrix,NoOfCustomers+2);
ReachFreeMem(&SupportPtr);
}