Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetroSim
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
Julien Pillis
MetroSim
Commits
4e5f50ee
Commit
4e5f50ee
authored
1 year ago
by
julienpillis
Browse files
Options
Downloads
Patches
Plain Diff
modification mineure
parent
bf99c59b
No related branches found
No related tags found
2 merge requests
!7
Main
,
!6
Signalisation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
internal/simulation/agent.go
+7
-6
7 additions, 6 deletions
internal/simulation/agent.go
internal/simulation/simu.go
+1
-1
1 addition, 1 deletion
internal/simulation/simu.go
with
8 additions
and
7 deletions
internal/simulation/agent.go
+
7
−
6
View file @
4e5f50ee
...
...
@@ -13,6 +13,7 @@ import (
//"fmt"
//"fmt"
"log"
"math/rand"
//"math"
//"math/rand"
...
...
@@ -216,12 +217,12 @@ func (ag *Agent) MoveAgent() {
// ================== Etude de faisabilité =======================
if
IsAgentBlocking
(
ag
.
path
,
ag
,
ag
.
env
)
{
// TODO:voir comment gérer les situations de blocage
//
start, end := ag.generatePathExtremities()
//
//
Si un agent bloque notre déplacement, on attend un temps aléatoire, et reconstruit un chemin en évitant la position
//
time.Sleep(time.Duration(rand.Intn(1000)) * time.Millisecond)
//
path := alg.FindPath(ag.env.station, start, end, ag.path[0], false)
//
time.Sleep(time.Second)
//
ag.path = path
start
,
end
:=
ag
.
generatePathExtremities
()
// Si un agent bloque notre déplacement, on attend un temps aléatoire, et reconstruit un chemin en évitant la position
time
.
Sleep
(
time
.
Duration
(
rand
.
Intn
(
1000
))
*
time
.
Millisecond
)
path
:=
alg
.
FindPath
(
ag
.
env
.
station
,
start
,
end
,
ag
.
path
[
0
],
false
)
time
.
Sleep
(
time
.
Second
)
ag
.
path
=
path
}
safe
,
or
:=
IsMovementSafe
(
ag
.
path
,
ag
,
ag
.
env
)
if
safe
{
...
...
This diff is collapsed.
Click to expand it.
internal/simulation/simu.go
+
1
−
1
View file @
4e5f50ee
...
...
@@ -151,7 +151,7 @@ func NewSimulation(agentCount int, maxStep int, maxDuration time.Duration) (simu
//ag := NewAgent(id, &simu.env, syncChan, time.Duration(time.Second), 0, true, Coord{0, 8 + i%2}, Coord{0, 8 + i%2}, &UsagerLambda{}, Coord{0, 8 + i%2}, Coord{12 - 4*(i%2), 18 - 15*(i%2)})
//ag := NewAgent(id, &simu.env, syncChan, 1000, 0, true, &UsagerLambda{}, Coord{3, 4}, Coord{18, 12}, 2, 1)
ag
:=
NewAgent
(
id
,
&
simu
.
env
,
syncChan
,
1000
,
0
,
true
,
&
UsagerLambda
{},
Coord
{
18
,
4
},
Coord
{
1
,
8
},
2
,
1
)
ag
:=
NewAgent
(
id
,
&
simu
.
env
,
syncChan
,
1000
,
0
,
true
,
&
UsagerLambda
{},
Coord
{
18
,
4
},
Coord
{
1
,
8
},
1
,
1
)
//ag := NewAgent(id, &simu.env, syncChan, 1000, 0, true, &UsagerLambda{}, Coord{1, 17}, Coord{0, 0}, 2, 1)
// ajout de l'agent à la simulation
...
...
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