Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Transmitter Clusters
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
OROBWorld
Transmitter Clusters
Commits
6ef54954
Commit
6ef54954
authored
3 years ago
by
Paul A. Rubin
Browse files
Options
Downloads
Patches
Plain Diff
Renamed the greedy construction heuristic.
parent
ecbe50c4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/solvers/GreedyConstruction.java
+6
-4
6 additions, 4 deletions
src/solvers/GreedyConstruction.java
src/xmtrclusters/XmtrClusters.java
+3
-3
3 additions, 3 deletions
src/xmtrclusters/XmtrClusters.java
with
9 additions
and
7 deletions
src/solvers/Greedy.java
→
src/solvers/Greedy
Construction
.java
+
6
−
4
View file @
6ef54954
...
...
@@ -8,7 +8,8 @@ import java.util.List;
import
xmtrclusters.Problem
;
/**
* Greedy implements a greedy heuristic for the clustering problem.
* GreedyConstruction implements a greedy construction heuristic for the
* clustering problem.
*
* Initially, each transmitter is a cluster unto itself. In each iteration,
* all legal merges of a pair of clusters are tested, and the one with maximum
...
...
@@ -23,7 +24,7 @@ import xmtrclusters.Problem;
record
Merger
(
int
first
,
int
second
,
double
change
)
{
}
public
final
class
Greedy
{
public
final
class
Greedy
Construction
{
private
final
List
<
Collection
<
Integer
>>
clusters
;
// list of clusters
private
final
Problem
problem
;
// problem to solve
private
final
int
maxSize
;
// maximum problem size
...
...
@@ -33,7 +34,7 @@ public final class Greedy {
* Constructs the heuristic instance and solves it.
* @param prob the problem to solve
*/
public
Greedy
(
final
Problem
prob
)
{
public
Greedy
Construction
(
final
Problem
prob
)
{
long
time
=
System
.
currentTimeMillis
();
problem
=
prob
;
maxSize
=
prob
.
getMaxSize
();
// max cluster size
...
...
@@ -75,7 +76,8 @@ public final class Greedy {
}
}
time
=
System
.
currentTimeMillis
()
-
time
;
System
.
out
.
println
(
"\nThe greedy heuristic ran for "
+
time
+
" ms."
);
System
.
out
.
println
(
"\nThe greedy construction heuristic ran for "
+
time
+
" ms."
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/xmtrclusters/XmtrClusters.java
+
3
−
3
View file @
6ef54954
...
...
@@ -2,7 +2,7 @@ package xmtrclusters;
import
ilog.concert.IloException
;
import
java.util.Collection
;
import
solvers.Greedy
;
import
solvers.Greedy
Construction
;
import
solvers.MIPModel
;
import
solvers.MIPModel2
;
...
...
@@ -33,10 +33,10 @@ public final class XmtrClusters {
int
nU
=
60
;
// # of users
int
maxC
=
7
;
// maximum number of clusters
int
maxS
=
5
;
// maximum cluster size
Problem
prob
=
new
Problem
(
nT
,
nU
,
maxC
,
maxS
,
456
);
Problem
prob
=
new
Problem
(
nT
,
nU
,
maxC
,
maxS
,
1234
);
// Try the greedy heuristic.
Greedy
greedy
=
new
Greedy
(
prob
);
Greedy
Construction
greedy
=
new
Greedy
Construction
(
prob
);
Collection
<
Collection
<
Integer
>>
g
=
greedy
.
getSolution
();
if
(
g
.
isEmpty
())
{
System
.
out
.
println
(
"\nThe greedy heuristic failed."
);
...
...
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