Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Capacitated Vehicule Routing Problem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Victor Ruelle
Capacitated Vehicule Routing Problem
Commits
ac873672
Commit
ac873672
authored
6 years ago
by
Victor Ruelle
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
21bf1071
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cvrpsep/FCISEP.cpp
+122
-0
122 additions, 0 deletions
cvrpsep/FCISEP.cpp
with
122 additions
and
0 deletions
cvrpsep/FCISEP.cpp
0 → 100644
+
122
−
0
View file @
ac873672
/* (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
"compress.h"
#include
"capsep.h"
#include
"fcits.h"
void
FCISEP_SeparateFCIs
(
int
NoOfCustomers
,
int
*
Demand
,
int
CAP
,
int
NoOfEdges
,
int
*
EdgeTail
,
int
*
EdgeHead
,
double
*
EdgeX
,
CnstrMgrPointer
CMPExistingCuts
,
int
MaxNoOfTreeNodes
,
int
MaxNoOfCuts
,
double
*
MaxViolation
,
CnstrMgrPointer
CutsCMP
)
{
int
i
,
j
,
k
;
int
GeneratedCuts
;
int
NoOfV1Cuts
;
int
ShrunkGraphCustNodes
;
int
MaxFCITSLoops
;
int
*
SuperDemand
;
double
*
XInSuperNode
;
double
**
XMatrix
;
double
**
SMatrix
;
ReachPtr
SupportPtr
;
ReachPtr
V1CutsPtr
;
ReachPtr
SAdjRPtr
;
ReachPtr
SuperNodesRPtr
;
ReachInitMem
(
&
SupportPtr
,
NoOfCustomers
+
1
);
ReachInitMem
(
&
SAdjRPtr
,
NoOfCustomers
+
1
);
ReachInitMem
(
&
SuperNodesRPtr
,
NoOfCustomers
+
1
);
SuperDemand
=
MemGetIV
(
NoOfCustomers
+
1
);
XInSuperNode
=
MemGetDV
(
NoOfCustomers
+
1
);
SMatrix
=
MemGetDM
(
NoOfCustomers
+
2
,
NoOfCustomers
+
2
);
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
];
}
V1CutsPtr
=
NULL
;
CAPSEP_GetOneVehicleCapCuts
(
CMPExistingCuts
,
&
V1CutsPtr
,
&
NoOfV1Cuts
);
COMPRESS_ShrinkGraph
(
SupportPtr
,
NoOfCustomers
,
XMatrix
,
SMatrix
,
NoOfV1Cuts
,
V1CutsPtr
,
SAdjRPtr
,
SuperNodesRPtr
,
&
ShrunkGraphCustNodes
);
ReachFreeMem
(
&
V1CutsPtr
);
/* Compute data of supernodes */
for
(
i
=
1
;
i
<=
ShrunkGraphCustNodes
;
i
++
)
{
XInSuperNode
[
i
]
=
SMatrix
[
i
][
i
];
SuperDemand
[
i
]
=
0
;
for
(
j
=
1
;
j
<=
SuperNodesRPtr
->
LP
[
i
].
CFN
;
j
++
)
{
k
=
SuperNodesRPtr
->
LP
[
i
].
FAL
[
j
];
SuperDemand
[
i
]
+=
Demand
[
k
];
}
}
/* Ready to call FCI separation */
MaxFCITSLoops
=
MaxNoOfTreeNodes
;
FCITS_MainCutGen
(
SupportPtr
,
NoOfCustomers
,
Demand
,
CAP
,
XMatrix
,
SuperNodesRPtr
,
SAdjRPtr
,
SuperDemand
,
ShrunkGraphCustNodes
,
MaxFCITSLoops
,
MaxNoOfCuts
,
MaxViolation
,
&
GeneratedCuts
,
CutsCMP
);
MemFree
(
SuperDemand
);
MemFree
(
XInSuperNode
);
MemFreeDM
(
SMatrix
,
NoOfCustomers
+
2
);
MemFreeDM
(
XMatrix
,
NoOfCustomers
+
2
);
ReachFreeMem
(
&
SupportPtr
);
ReachFreeMem
(
&
SAdjRPtr
);
ReachFreeMem
(
&
SuperNodesRPtr
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment