Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Multi-agent interaction planning
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Larkin Heintzman
Multi-agent interaction planning
Commits
16cea4d0
Commit
16cea4d0
authored
Dec 10, 2019
by
Larkin Heintzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
5fe17651
Pipeline
#34
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
0 deletions
+98
-0
selectSamples.m
Matlab Code/selectSamples.m
+98
-0
No files found.
Matlab Code/selectSamples.m
0 → 100644
View file @
16cea4d0
function
[
plcs_sel
,
gdyInteractionTimes
]
=
selectSamples
(
sample_sets_const
,
plcs
)
% select samples given a set of viable samples, a heatmap, and both types
% of bounding sets
load_params
;
% reload all known parameters
% booleans
gdySolutions
=
true
;
parOpt
=
false
;
env
.
Z
=
Z
;
env
.
x_area
=
x_area
;
env
.
y_area
=
y_area
;
env
.
gmObj
=
gmObj
;
supergraphs
=
generateSupergraphs
(
plcs
,
rho
,
false
);
if
gdySolutions
useBdd
=
1
;
% perform constrained greedy first
[
greedy_sol_const
,
score_const
]
=
generateGreedySolutionFast
(
plcs
,
supergraphs
,
env
,
N
,
useBdd
,
...
sig
,
environment_size
,
sample_sets_const
,
parOpt
);
useBdd
=
0
;
% now perform unconstrained greedy
[
greedy_sol_unconst
,
score_unconst
]
=
generateGreedySolutionFast
(
plcs
,
supergraphs
,
env
,
N
,
useBdd
,
...
sig
,
environment_size
,
sample_sets_const
,
parOpt
);
for
k
=
1
:
Tk
% check both solutions for validity
if
length
(
greedy_sol_const
{
k
})
<
N
||
length
(
greedy_sol_unconst
{
k
})
<
N
error
(
'we failed to effectively select greedy samples, insufficient samples probably'
);
end
end
end
%---------------------------------------------%
fprintf
(
'--------------------------------\n'
)
% assume we can get the optimal solution, somehow. Now to compare trade
% offs:
[
~
,
gdyInteractionTimes
]
=
sort
(
score_unconst
-
score_const
);
gdyInteractionTimes
=
gdyInteractionTimes
(
1
:
K
);
% so now return which samples go where
plcs_sel
=
cell
(
N
,
1
);
for
i
=
1
:
N
plcs_sel
{
i
}
=
zeros
(
Tk
,
2
);
end
for
k
=
1
:
Tk
if
ismember
(
k
,
gdyInteractionTimes
)
[
agent_idx
,
traj_idx
]
=
covertIdxForm
(
greedy_sol_const
{
k
},
Pj
);
else
[
agent_idx
,
traj_idx
]
=
covertIdxForm
(
greedy_sol_unconst
{
k
},
Pj
);
end
for
i
=
1
:
N
plcs_sel
{
i
}(
k
,:)
=
plcs
{
k
,
traj_idx
(
i
)}(
agent_idx
(
i
),:);
end
end
% gdyInteractionTimesNaive = [1 Tk]; % the case of interacting at the begining and at the end
%
% gdyScore = 0;
% gdyScoreNaive = 0;
% for k=1:Tk
% if gdySolutions
% if ismember(k,gdyInteractionTimes)
% gdyScore = gdyScore + score_const(k);
% else
% gdyScore = gdyScore + score_unconst(k);
% end
%
% if ismember(k,gdyInteractionTimesNaive)
% gdyScoreNaive = gdyScoreNaive + score_const(k);
% else
% gdyScoreNaive = gdyScoreNaive + score_unconst(k);
% end
% end
% end
%
% recorder(innerCounter,outterCounter) = gdyScore;
% recorderNaive(innerCounter,outterCounter) = gdyScoreNaive;
%
% plcFin = cell(Tk,1);
% plcFinNaive = cell(Tk,1);
% for k=1:Tk
% if ismember(k,gdyInteractionTimes)
% plcFin{k} = greedy_sol_const{k};
% else
% plcFin{k} = greedy_sol_unconst{k};
% end
%
% if ismember(k,gdyInteractionTimesNaive)
% plcFinNaive{k} = greedy_sol_const{k};
% else
% plcFinNaive{k} = greedy_sol_unconst{k};
% end
% end
% counterM = counterM + 1; % go to next test
% innerCounter = innerCounter + 1;
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment