Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Polling server IA04
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Balthazar Wilson
Polling server IA04
Commits
e0d2c55a
Commit
e0d2c55a
authored
1 year ago
by
Balthazar Wilson
Browse files
Options
Downloads
Patches
Plain Diff
add: copeland vote procedure (untested)
parent
e92da658
Branches
main
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
comsoc/Copeland.go
+39
-1
39 additions, 1 deletion
comsoc/Copeland.go
with
39 additions
and
1 deletion
comsoc/Copeland.go
+
39
−
1
View file @
e0d2c55a
package
comsoc
\ No newline at end of file
package
comsoc
func
CopelandSWF
(
p
Profile
)
(
count
Count
,
err
error
)
{
count
=
make
(
Count
)
alts
:=
make
([]
Alternative
,
0
)
for
i
:=
1
;
i
<=
len
(
p
[
0
]);
i
++
{
alts
=
append
(
alts
,
Alternative
(
i
))
}
err
=
checkProfileAlternative
(
p
,
alts
)
if
err
!=
nil
{
return
nil
,
err
}
for
alt1
:=
0
;
alt1
<
len
(
p
);
alt1
++
{
for
alt2
:=
alt1
+
1
;
alt2
<
len
(
p
);
alt2
++
{
score1
,
score2
:=
0
,
0
for
_
,
pref
:=
range
p
{
if
isPref
(
Alternative
(
alt1
),
Alternative
(
alt2
),
pref
)
{
score1
++
}
else
{
score2
++
}
}
if
score1
>
score2
{
count
[
Alternative
(
alt1
)]
++
}
else
if
score2
>
score1
{
count
[
Alternative
(
alt2
)]
++
}
}
}
return
}
func
CopelandSCF
(
p
Profile
)
(
bestAlts
[]
Alternative
,
err
error
)
{
count
,
err
:=
MajoritySWF
(
p
)
if
err
!=
nil
{
return
nil
,
err
}
return
maxCount
(
count
),
err
}
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