How do I create a pair of matrices approximating a convex hull of a set of points in 2-space?
    1 visualizzazione (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commenti
  José-Luis
      
 il 10 Giu 2014
				I assumed a linear mapping. If non-affine transforms come into play, funny things can start to happen.
Risposte (2)
  José-Luis
      
 il 10 Giu 2014
        
      Modificato: José-Luis
      
 il 10 Giu 2014
  
      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 Commenti
Vedere anche
Categorie
				Scopri di più su Mathematics and Optimization in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!