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
364f9a80
Commit
364f9a80
authored
1 year ago
by
Gabrielle Van De Vijver
Committed by
Balthazar Wilson
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
SCFFactory sans gestion d'erreur
parent
6e1efc56
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
comsoc/TieBreak.go
+28
-1
28 additions, 1 deletion
comsoc/TieBreak.go
with
28 additions
and
1 deletion
comsoc/TieBreak.go
+
28
−
1
View file @
364f9a80
...
...
@@ -75,4 +75,31 @@ func Test_sWFFactory(){
sorted_alts
,
_
:=
mu
(
profil
)
fmt
.
Println
(
"Alternatives strictement ordonnées selon la méthode de Borda :"
,
sorted_alts
)
}
//func SCFFactory(func scf(p Profile) ([]Alternative, error), func ([]Alternative) (Alternative, error)) (func(Profile) (Alternative, error))
func
SCFFactory
(
scf
func
(
p
Profile
)
([]
Alternative
,
error
),
tb
func
([]
Alternative
)
(
Alternative
,
error
))
(
func
(
Profile
)
(
Alternative
,
error
)){
return
func
(
p
Profile
)
(
Alternative
,
error
){
//récupération des meilleures alternatives
bestAlts
,
_
:=
scf
(
p
)
//récupération de la meilleure alternative
bestAlt
,
_
:=
tb
(
bestAlts
)
return
bestAlt
,
nil
}
}
func
Test_sCFFactory
(){
//Définition de l'Ordre strict
orderedAlts
:=
[]
Alternative
{
8
,
9
,
6
,
1
,
3
,
2
}
fmt
.
Println
(
"Ordre strict :"
,
orderedAlts
)
//Construction d'un profil avec alternatives ex aequo
profil
:=
make
([][]
Alternative
,
2
)
profil
[
0
]
=
[]
Alternative
{
1
,
2
,
3
,
4
,
5
,
6
}
profil
[
1
]
=
[]
Alternative
{
3
,
2
,
1
,
4
,
5
,
6
}
fmt
.
Println
(
"Profil :"
,
profil
)
//Construction de la fonction Tie Break
lambda
:=
TieBreakFactory
(
orderedAlts
)
mu
:=
SCFFactory
(
BordaSCF
,
lambda
)
//Construction d'une fonction
best_Alt
,
_
:=
mu
(
profil
)
fmt
.
Println
(
"Meilleure alternative selon la méthode de Borda :"
,
best_Alt
)
}
\ No newline at end of file
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