How do I create a pair of matrices approximating a convex hull of a set of points in 2-space?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to approximate the convex hull of payoffs for a 2x2 normal form game. The inputs would be the four points defining the payoffs at each of the four pure strategy outcomes, plus a factor k that would define the increments (and matrix sizes) of the approximating Row and Column player payoffs of the convex hull of payoffs. (So if k=10, the outputs would be a pair of 11x11 matrices UR and UC where UR has the convex hull payoffs for Row at 1/10 increments and UC has the convex hull of payoffs for Column at 10 point increments.)
My motivating problem is I'm trying to analyze an discretized approximation of a 2-playey bargaining problem that's constructed by creating the convex hull of payoffs for a 2x2 coordination game.
댓글 수: 8
José-Luis
2014년 6월 10일
I assumed a linear mapping. If non-affine transforms come into play, funny things can start to happen.
답변 (2개)
José-Luis
2014년 6월 10일
편집: José-Luis
2014년 6월 10일
Assuming linear mapping:
Not the most efficient thing out there, but it serves as a proof of concept. The important thing is that your vertices must be ordered either clockwise or counterclockwise:
%You need to provide ordered vertices either clockwise or counterclockwise
unit_square = [0,0;...
0,1;...
1,1;...
1,0];
mapped_poly = [2,1;...
7,3;...
4,10;...
1,2];
unit_square = [unit_square;unit_square(1,:)];
mapped_poly = [mapped_poly;mapped_poly(1,:)];
patch(unit_square(:,1),unit_square(:,2),'r','FaceAlpha',0.5);
hold on;
patch(mapped_poly(:,1),mapped_poly(:,2),'g','FaceAlpha',0.5);
point_to_project = rand(1,2);
x = point_to_project(1);
y = point_to_project(2);
plot(x,y,'ks');
bottom_position = mapped_poly(1,:) + x .* (mapped_poly(2,:) - mapped_poly(1,:));
right_position = mapped_poly(2,:) + y .* (mapped_poly(3,:) - mapped_poly(2,:));
top_position = mapped_poly(3,:) + (1 - x) .* (mapped_poly(4,:) - mapped_poly(3,:));
left_position = mapped_poly(4,:) + (1 - y) .* (mapped_poly(1,:) - mapped_poly(4,:));
%fit linear polynomial
p1 = polyfit([bottom_position(1) top_position(1)] ,[bottom_position(2) top_position(2)],1);
p2 = polyfit([left_position(1) right_position(1)] ,[left_position(2) right_position(2)],1);
%calculate intersection
x_intersect = fzero(@(x) polyval(p1-p2,x),3);
y_intersect = polyval(p1,x_intersect);
plot(x_intersect,y_intersect,'ks');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!