Geschwindigkeit, schränkt Zielgenauigkeit ein
Crossover
-sinnvoll für gute Position und gute Kraft
+sinnvoll für gute Position und gute Geschwindigkeit
problematisch bei gutem x- und gutem y-Wert
diff --git a/ea/project/EvA2.jar b/ea/project/EvA2.jar
new file mode 100644
index 0000000..5ce9a70
--- /dev/null
+++ b/ea/project/EvA2.jar
Binary files differ
diff --git a/ea/project/ExampleProblem.java b/ea/project/ExampleProblem.java
new file mode 100644
index 0000000..4a448e3
--- /dev/null
+++ b/ea/project/ExampleProblem.java
@@ -0,0 +1,185 @@
+package eva2.problems.simple;
+
+import eva2.util.annotation.Description;
+import eva2.util.annotation.Parameter;
+
+/**
+ * This is a simple example for adding problems to EvA2. The EvA2.jar is
+ * required for this class! The jar file is available from
+ * http://www.ra.cs.uni-tuebingen.de/software/EvA2/downloads/2.2.0-rc1/EvA2.jar
+ *
+ * To be found by EvA2, this class must remain in the package
+ * eva2.problems.simple!
+ *
+ * Depending on your representation of a solution, you must extend either the
+ * class SimpleProblemDouble or SimpleProblemBinary!
+ *
+ * To optimize this problem, start EvA2 (use the eva2.gui.Main class) and select
+ * as Problem: SimpleProblemWrapper. Next select as Simple Problem:
+ * eva2.problems.simple.ExampleProblem and customize any parameters. You can now
+ * try different optimization algorithms!
+ *
+ * To launch EvA2 from the command line with this custom problem:
+ * 1. extract the EvA2.jar (NOT EvA2Base.jar!)
+ * 2. place this class file in the directory eva2/problems/simple/
+ * 3. compile this class with: javac eva2/problems/simple/ExampleProblem.java
+ * 4. start EvA2 with: java eva2.gui.Main
+ *
+ * Some tips: - Look at the function setAbs, setDimension, and
+ * setEvaluateFunction to see how EvA2 recognizes changeable inputs! Note that
+ * getX() and setX() must be present to correctly provide the input!
+ *
+ * @author mroemer
+ *
+ */
+@Description("An example problem for including new problems in EvA2.")
+public class ExampleProblem extends SimpleProblemDouble {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2796213693976730841L;
+
+ /**
+ * Possible functions to evaluate the fitness
+ */
+ public enum EvaluateFunction {
+ SUM, MIN, MAX, MEAN
+ }
+
+ /**
+ * Problem dimension
+ */
+ private int dimension = 10;
+ /**
+ * Fitness evaluation function
+ */
+ private EvaluateFunction evalFun = EvaluateFunction.SUM;
+ /**
+ * Use absolute values for evaluation?
+ */
+ private boolean useAbs = true;
+
+ public ExampleProblem() {
+ // Here you can read files you need (i.e., input data) or set default values
+ // for parameters
+ }
+
+ /**
+ * Evaluate a double vector representing a possible problem solution as part
+ * of an individual in the EvA framework. This makes up the target function to
+ * be evaluated.
+ *
+ * @param x
+ * a double vector to be evaluated
+ * @return the fitness vector assigned to x as to the target function (the
+ * return value is actually a array with only one entry!)
+ */
+ @Override
+ public double[] evaluate(double[] individual) {
+ double fitness = 0;
+ switch (evalFun) {
+ case SUM:
+ fitness = 0;
+ for (int i = 0; i < individual.length; i++) {
+ fitness += evalAt(individual, i);
+ }
+ break;
+ case MIN:
+ fitness = Double.POSITIVE_INFINITY;
+ for (int i = 0; i < individual.length; i++) {
+ fitness = Math.min(fitness, evalAt(individual, i));
+ }
+ break;
+ case MAX:
+ fitness = Double.NEGATIVE_INFINITY;
+ for (int i = 0; i < individual.length; i++) {
+ fitness = Math.max(fitness, evalAt(individual, i));
+ }
+ break;
+ case MEAN:
+ fitness = 0;
+ for (int i = 0; i < individual.length; i++) {
+ fitness += evalAt(individual, i);
+ }
+ fitness = fitness / dimension;
+ break;
+ default:
+ break;
+ }
+ return new double[] { fitness };
+ }
+
+ // Evaluates an individual at a single point
+ // This is a abstraction to simplify incorporation of useAbs...
+ private double evalAt(double[] individual, int i) {
+ return useAbs ? Math.abs(individual[i]) : individual[i];
+ }
+
+ /*
+ * Below are parameters that can be set at runtime! See the class comment for
+ * more information...
+ */
+
+ /**
+ * Return the problem dimension.
+ *
+ * @return the problem dimension
+ */
+ @Override
+ public int getProblemDimension() {
+ return dimension;
+ }
+
+ /**
+ * This method allows you to toggle the usage of absolute values.
+ *
+ * @param show
+ * Whether to use absolute values or not
+ */
+ @Parameter(description = "Use absolute values for evaluation?")
+ public void setAbs(boolean useAbs) {
+ this.useAbs = useAbs;
+ }
+
+ public boolean getAbs() {
+ return this.useAbs;
+ }
+
+ /**
+ * Set the problem dimension.
+ *
+ * @param d
+ * The dimension.
+ */
+ @Parameter(description = "Set 1 <= Dimension <= 1000.")
+ public void setDimension(int d) {
+ if (d < 1) {
+ d = 1;
+ }
+ if (d > 1000) {
+ d = 1000;
+ }
+ this.dimension = d;
+ }
+
+ public int getDimension() {
+ return this.dimension;
+ }
+
+ /**
+ * Set the evaluation function.
+ *
+ * @param f
+ * The evaluation function.
+ */
+ @Parameter(description = "Choose the timeinterval type.")
+ public void setEvaluateFunction(EvaluateFunction f) {
+ this.evalFun = f;
+ }
+
+ public EvaluateFunction getEvaluateFunction() {
+ return this.evalFun;
+ }
+
+}
diff --git a/ea/project/overview.md b/ea/project/overview.md
index 5109038..6cd4189 100644
--- a/ea/project/overview.md
+++ b/ea/project/overview.md
@@ -23,7 +23,7 @@
- Ziel (x,y), wo stehen wenige Spieler
-- Kraft + Spin f, schränkt Zielgenauigkeit ein
+- Geschwindigkeit, schränkt Zielgenauigkeit ein
- auf geplante Position wird entsprechend noise addiert
@@ -79,6 +79,6 @@
### Crossover
-- sinnvoll für gute Position und gute Kraft
+- sinnvoll für gute Position und gute Geschwindigkeit
- problematisch bei gutem x- und gutem y-Wert
diff --git a/mr/ub10/A1c/EX1.m b/mr/ub10/A1c/EX1.m
new file mode 100644
index 0000000..a9ca7be
--- /dev/null
+++ b/mr/ub10/A1c/EX1.m
@@ -0,0 +1,66 @@
+p=[24,10;27,1;35,1;38,4;34,9;44,8;50,19;44,25;24,25;30,18;24,10;27,1]
+x=p(:,1);
+y=p(:,2);
+
+[~,xmin]=min(x);
+[~,xmax]=max(x);
+xmin
+xmax
+%expanded red
+%new added green
+%poligon red
+
+figure(1)
+scatter(x,y);
+line(p([1,7],1),p([1,7],2),'Color',[1 0 0])
+line(p([1,3],1),p([1,3],2),'Color',[0 1 0])
+line(p([7,3],1),p([7,3],2),'Color',[0 1 0])
+
+figure(2)
+scatter(x,y);
+line(p([1,7],1),p([1,7],2),'Color',[0 0 1])
+line(p([7,3],1),p([7,3],2),'Color',[0 0 1])
+line(p([1,3],1),p([1,3],2),'Color',[1 0 0])
+line(p([1,2],1),p([1,2],2),'Color',[0 1 0])
+line(p([3,2],1),p([3,2],2),'Color',[0 1 0])
+
+figure(3)
+scatter(x,y);
+line(p([1,7],1),p([1,7],2),'Color',[0 0 1])
+line(p([7,3],1),p([7,3],2),'Color',[1 0 0])
+line(p([1,2],1),p([1,2],2),'Color',[0 0 1])
+line(p([3,2],1),p([3,2],2),'Color',[0 0 1])
+line(p([7,6],1),p([7,6],2),'Color',[0 1 0])
+line(p([3,6],1),p([3,6],2),'Color',[0 1 0])
+
+figure(4)
+scatter(x,y);
+line(p([1,2],1),p([1,2],2),'Color',[0 0 1])
+line(p([3,2],1),p([3,2],2),'Color',[0 0 1])
+line(p([7,6],1),p([7,6],2),'Color',[0 0 1])
+line(p([3,6],1),p([3,6],2),'Color',[0 0 1])
+line(p([9,7],1),p([9,7],2),'Color',[0 1 0])
+line(p([9,1],1),p([9,1],2),'Color',[0 1 0])
+
+figure(5)
+scatter(x,y);
+line(p([1,2],1),p([1,2],2),'Color',[0 0 1])
+line(p([3,2],1),p([3,2],2),'Color',[0 0 1])
+line(p([7,6],1),p([7,6],2),'Color',[0 0 1])
+line(p([3,6],1),p([3,6],2),'Color',[0 0 1])
+line(p([9,7],1),p([9,7],2),'Color',[1 0 0])
+line(p([9,1],1),p([9,1],2),'Color',[0 0 1])
+line(p([9,8],1),p([9,8],2),'Color',[0 1 0])
+line(p([8,7],1),p([8,7],2),'Color',[0 1 0])
+
+figure(6)
+scatter(x,y);
+line(p([1,2],1),p([1,2],2),'Color',[0 0 1])
+line(p([3,2],1),p([3,2],2),'Color',[0 0 1])
+line(p([7,6],1),p([7,6],2),'Color',[0 0 1])
+line(p([3,6],1),p([3,6],2),'Color',[0 0 1])
+line(p([9,1],1),p([9,1],2),'Color',[0 0 1])
+line(p([9,8],1),p([9,8],2),'Color',[0 0 1])
+line(p([8,7],1),p([8,7],2),'Color',[0 0 1])
+
+
diff --git a/mr/ub10/A1c/step1.fig b/mr/ub10/A1c/step1.fig
new file mode 100644
index 0000000..8cd2b16
--- /dev/null
+++ b/mr/ub10/A1c/step1.fig
Binary files differ
diff --git a/mr/ub10/A1c/step2.fig b/mr/ub10/A1c/step2.fig
new file mode 100644
index 0000000..da19758
--- /dev/null
+++ b/mr/ub10/A1c/step2.fig
Binary files differ
diff --git a/mr/ub10/A1c/step3.fig b/mr/ub10/A1c/step3.fig
new file mode 100644
index 0000000..4a32f82
--- /dev/null
+++ b/mr/ub10/A1c/step3.fig
Binary files differ
diff --git a/mr/ub10/A1c/step4.fig b/mr/ub10/A1c/step4.fig
new file mode 100644
index 0000000..42f4163
--- /dev/null
+++ b/mr/ub10/A1c/step4.fig
Binary files differ
diff --git a/mr/ub10/A1c/step5.fig b/mr/ub10/A1c/step5.fig
new file mode 100644
index 0000000..fd65259
--- /dev/null
+++ b/mr/ub10/A1c/step5.fig
Binary files differ
diff --git a/mr/ub10/A1c/step6.fig b/mr/ub10/A1c/step6.fig
new file mode 100644
index 0000000..d033294
--- /dev/null
+++ b/mr/ub10/A1c/step6.fig
Binary files differ
diff --git a/mr/ub10/A2.m b/mr/ub10/A2.m
deleted file mode 100644
index 7ab588c..0000000
--- a/mr/ub10/A2.m
+++ /dev/null
@@ -1,131 +0,0 @@
-start=[3,7]
-%start= [8,2]
-goal=[8,8]
-
-d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
- -1,-1,inf,inf,-1,inf,inf,inf,inf,-1
- -1,inf,inf,inf,-1,inf,inf,inf,inf,-1
- -1,inf,inf,inf,-1,-1,inf,inf,inf,-1
- -1,inf,-1,inf,inf,-1,-1,inf,-1,-1
- -1,inf,-1,inf,-1,-1,-1,inf,-1,-1
- -1,inf,-1,inf,inf,inf,inf,inf,inf,-1
- -1,inf,-1,inf,inf,inf,inf,inf,inf,-1
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1];
-
-d(start(1),start(2))= 0;
-d
-%make d template to show changes
-dvt= d;
-for e= 1:size(d,1)
- for f= 1:size(d,2)
- if dvt(e,f)>-1
- dvt(e,f)= NaN;
- end
- end
-end
-dvt
-d
-changed = true;
-s2= sqrt(2);
-step=-1;
-while changed
- step=step+1
- changed= false;
- dv= dvt;
- for y = size(d,1)-1:-1:2%forward scan
- for x = 2:size(d,2)-1
- if(d(y,x) >-1)
- a=[d(y,x)];
- if(d(y,x-1) >-1)
- a=[a d(y,x-1)+1];
- end
- if(d(y,x+1) >-1)
- a=[a d(y,x+1)+s2];
- end
- if(d(y+1,x)>-1)
- a=[a d(y+1,x)+1];
- end
- if d(y+1,x-1) >-1
- a=[a d(y+1,x-1)+s2];
- end
-
- mi = min(a);
- if(mi~=d(y,x));
- changed = true;
- end
- if(d(y,x)~=mi)
- dv(y,x)=mi;
- end
- d(y,x) = mi;
-
-
- end
- end
- end
- forward=0
- d
- dv
- dv=dvt;
- for y = 2:size(d,1)-1%backward scan
- for x = size(d,2)-1:-1:2
- if(d(y,x) >-1)
- a=[d(y,x)];
- if(d(y,x+1) >-1)
- a=[a d(y,x+1)+1];
- end
- if(d(y-1,x-1) >-1)
- a=[a d(y-1,x-1)+s2];
- end
- if(d(y-1,x)>-1)
- a=[a d(y-1,x)+1];
- end
- if d(y-1,x+1) >-1
- a=[a d(y-1,x+1)+s2];
- end
- mi = min(a);
- if(mi~=d(y,x))
- changed = true;
- end
- if(d(y,x)~=mi)
- dv(y,x)=mi;
- end
- d(y,x) = mi;
-
- end
- end
- end
- backward=0
- step
- d
- dv
-end
-%plot gradient
-colormap(summer)
-imagesc(d)
-
-%get gradient path.
-cp= goal;
-path =goal;
-
-while ~isequal(cp,start)
- neighbours=[];
- for x = [cp(1)-1:cp(1)+1]
- for y=[cp(2)-1:cp(2)+1]
- if ~isequal([x,y],cp) && (d(x,y)>-1)
- neighbours = cat(1,neighbours,[x,y]);
- end
- end
- end
- nv=[];
- for i = 1:size(neighbours,1)
- yy=neighbours(i,:);
- nv = [nv d(yy(1),yy(2))];
- end
- [m,minindex] = min(nv);
- m;
- cp= neighbours(minindex,:);
- path = cat(1,cp,path);
-end
-path
-
-
diff --git a/mr/ub10/A2/A2.m b/mr/ub10/A2/A2.m
new file mode 100644
index 0000000..857790f
--- /dev/null
+++ b/mr/ub10/A2/A2.m
@@ -0,0 +1,133 @@
+start=[3,7]
+%start= [8,2]
+goal=[8,8]
+
+d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ -1,-1,inf,inf,-1,inf,inf,inf,inf,-1
+ -1,inf,inf,inf,-1,inf,inf,inf,inf,-1
+ -1,inf,inf,inf,-1,-1,inf,inf,inf,-1
+ -1,inf,-1,inf,inf,-1,-1,inf,-1,-1
+ -1,inf,-1,inf,-1,-1,-1,inf,-1,-1
+ -1,inf,-1,inf,inf,inf,inf,inf,inf,-1
+ -1,inf,-1,inf,inf,inf,inf,inf,inf,-1
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1];
+
+d(start(1),start(2))= 0;
+d
+%make d template to show changes
+dvt= d;
+for e= 1:size(d,1)
+ for f= 1:size(d,2)
+ if dvt(e,f)>-1
+ dvt(e,f)= NaN;
+ end
+ end
+end
+dvt
+d
+changed = true;
+s2= sqrt(2);
+step=-1;
+while changed
+ step=step+1
+ changed= false;
+ dv= dvt;
+ for y = size(d,1)-1:-1:2%forward scan
+ for x = 2:size(d,2)-1
+ if(d(y,x) >-1)
+ a=[d(y,x)];
+ if(d(y,x-1) >-1)
+ a=[a d(y,x-1)+1];
+ end
+ if(d(y,x+1) >-1)
+ a=[a d(y,x+1)+s2];
+ end
+ if(d(y+1,x)>-1)
+ a=[a d(y+1,x)+1];
+ end
+ if d(y+1,x-1) >-1
+ a=[a d(y+1,x-1)+s2];
+ end
+
+ mi = min(a);
+ if(mi~=d(y,x));
+ changed = true;
+ end
+ if(d(y,x)~=mi)
+ dv(y,x)=mi;
+ end
+ d(y,x) = mi;
+
+
+ end
+ end
+ end
+ forward=0
+ d
+ dv
+ latex(sym(dv))
+ dv=dvt;
+ for y = 2:size(d,1)-1%backward scan
+ for x = size(d,2)-1:-1:2
+ if(d(y,x) >-1)
+ a=[d(y,x)];
+ if(d(y,x+1) >-1)
+ a=[a d(y,x+1)+1];
+ end
+ if(d(y-1,x-1) >-1)
+ a=[a d(y-1,x-1)+s2];
+ end
+ if(d(y-1,x)>-1)
+ a=[a d(y-1,x)+1];
+ end
+ if d(y-1,x+1) >-1
+ a=[a d(y-1,x+1)+s2];
+ end
+ mi = min(a);
+ if(mi~=d(y,x))
+ changed = true;
+ end
+ if(d(y,x)~=mi)
+ dv(y,x)=mi;
+ end
+ d(y,x) = mi;
+
+ end
+ end
+ end
+ backward=0
+ step
+ d
+ dv
+ latex(sym(dv))
+end
+%plot gradient
+colormap(summer)
+imagesc(d)
+
+%get gradient path.
+cp= goal;
+path =goal;
+
+while ~isequal(cp,start)
+ neighbours=[];
+ for x = [cp(1)-1:cp(1)+1]
+ for y=[cp(2)-1:cp(2)+1]
+ if ~isequal([x,y],cp) && (d(x,y)>-1)
+ neighbours = cat(1,neighbours,[x,y]);
+ end
+ end
+ end
+ nv=[];
+ for i = 1:size(neighbours,1)
+ yy=neighbours(i,:);
+ nv = [nv d(yy(1),yy(2))];
+ end
+ [m,minindex] = min(nv);
+ m;
+ cp= neighbours(minindex,:);
+ path = cat(1,cp,path);
+end
+path
+
+
diff --git a/mr/ub10/A2/DTA.m b/mr/ub10/A2/DTA.m
new file mode 100644
index 0000000..de78d16
--- /dev/null
+++ b/mr/ub10/A2/DTA.m
@@ -0,0 +1,82 @@
+function [ output_args ] = DTA(map,start,aim)
+%UNTITLED4 Summary of this function goes here
+% Detailed explanation goes here
+
+d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
+ -1,-1,inf,inf,-1,inf,inf,inf,inf,-1
+ -1,inf,inf,inf,-1,inf,inf,inf,inf,-1
+ -1,inf,inf,inf,-1,-1,inf,inf,inf,-1
+ -1,inf,-1,inf,inf,-1,-1,inf,-1,-1
+ -1,inf,-1,inf,-1,-1,-1,inf,-1,-1
+ -1,inf,-1,inf,inf,inf,inf,inf,inf,-1
+ -1,0,-1,inf,inf,inf,inf,inf,inf,-1
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1]
+dvt= d
+
+changed = true;
+s2= sqrt(2);
+step=-1;
+while changed
+ step=step+1
+ changed= false;
+ for y = size(d,1)-1:-1:2
+ for x = 2:size(d,2)-1
+ x
+ y
+ d(y,x)
+ if(d(y,x) >-1)
+ a=[d(y,x)]
+ if(d(y,x-1) >-1)
+ a=[a d(y,x-1)+1];
+ end
+ if(d(y,x+1) >-1)
+ a=[a d(y,x+1)+s2];
+ end
+ if(d(y+1,x)>-1)
+ a=[a d(y+1,x)+1];
+ end
+ if d(y+1,x-1) >-1
+ a=[a d(y+1,x-1)+s2];
+ end
+ mi = min(a);
+ if(mi~=d(y,x));
+ changed = true;
+ end
+ d(y,x) = mi;
+
+ end
+ end
+ end
+ forward=0
+ d
+ for y = 2:size(d,1)-1
+ for x = size(d,2)-1:-1:2
+ if(d(y,x) >-1)
+ a=[d(y,x)];
+ if(d(y,x+1) >-1)
+ a=[a d(y,x+1)+1];
+ end
+ if(d(y-1,x-1) >-1)
+ a=[a d(y-1,x-1)+s2];
+ end
+ if(d(y-1,x)>-1)
+ a=[a d(y-1,x)+1];
+ end
+ if d(y-1,x+1) >-1
+ a=[a d(y-1,x+1)+s2];
+ end
+ mi = min(a);
+ if(mi~=d(y,x))
+ changed = true;
+ end
+ d(y,x) = mi;
+ end
+ end
+ end
+ backward=0
+ step
+ d
+end
+
+end
+
diff --git a/mr/ub10/A2/gradientA.png b/mr/ub10/A2/gradientA.png
new file mode 100644
index 0000000..26eb5f3
--- /dev/null
+++ b/mr/ub10/A2/gradientA.png
Binary files differ
diff --git a/mr/ub10/A2/gradientB.png b/mr/ub10/A2/gradientB.png
new file mode 100644
index 0000000..1556b73
--- /dev/null
+++ b/mr/ub10/A2/gradientB.png
Binary files differ
diff --git a/mr/ub10/A3c/step1.fig b/mr/ub10/A3c/step1.fig
deleted file mode 100644
index 8cd2b16..0000000
--- a/mr/ub10/A3c/step1.fig
+++ /dev/null
Binary files differ
diff --git a/mr/ub10/A3c/step2.fig b/mr/ub10/A3c/step2.fig
deleted file mode 100644
index da19758..0000000
--- a/mr/ub10/A3c/step2.fig
+++ /dev/null
Binary files differ
diff --git a/mr/ub10/A3c/step3.fig b/mr/ub10/A3c/step3.fig
deleted file mode 100644
index 4a32f82..0000000
--- a/mr/ub10/A3c/step3.fig
+++ /dev/null
Binary files differ
diff --git a/mr/ub10/A3c/step4.fig b/mr/ub10/A3c/step4.fig
deleted file mode 100644
index 42f4163..0000000
--- a/mr/ub10/A3c/step4.fig
+++ /dev/null
Binary files differ
diff --git a/mr/ub10/A3c/step5.fig b/mr/ub10/A3c/step5.fig
deleted file mode 100644
index fd65259..0000000
--- a/mr/ub10/A3c/step5.fig
+++ /dev/null
Binary files differ
diff --git a/mr/ub10/A3c/step6.fig b/mr/ub10/A3c/step6.fig
deleted file mode 100644
index d033294..0000000
--- a/mr/ub10/A3c/step6.fig
+++ /dev/null
Binary files differ
diff --git a/mr/ub10/A4/gradientA.png b/mr/ub10/A4/gradientA.png
deleted file mode 100644
index 26eb5f3..0000000
--- a/mr/ub10/A4/gradientA.png
+++ /dev/null
Binary files differ
diff --git a/mr/ub10/A4/gradientB.png b/mr/ub10/A4/gradientB.png
deleted file mode 100644
index 1556b73..0000000
--- a/mr/ub10/A4/gradientB.png
+++ /dev/null
Binary files differ
diff --git a/mr/ub10/DTA.m b/mr/ub10/DTA.m
deleted file mode 100644
index de78d16..0000000
--- a/mr/ub10/DTA.m
+++ /dev/null
@@ -1,82 +0,0 @@
-function [ output_args ] = DTA(map,start,aim)
-%UNTITLED4 Summary of this function goes here
-% Detailed explanation goes here
-
-d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
- -1,-1,inf,inf,-1,inf,inf,inf,inf,-1
- -1,inf,inf,inf,-1,inf,inf,inf,inf,-1
- -1,inf,inf,inf,-1,-1,inf,inf,inf,-1
- -1,inf,-1,inf,inf,-1,-1,inf,-1,-1
- -1,inf,-1,inf,-1,-1,-1,inf,-1,-1
- -1,inf,-1,inf,inf,inf,inf,inf,inf,-1
- -1,0,-1,inf,inf,inf,inf,inf,inf,-1
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1]
-dvt= d
-
-changed = true;
-s2= sqrt(2);
-step=-1;
-while changed
- step=step+1
- changed= false;
- for y = size(d,1)-1:-1:2
- for x = 2:size(d,2)-1
- x
- y
- d(y,x)
- if(d(y,x) >-1)
- a=[d(y,x)]
- if(d(y,x-1) >-1)
- a=[a d(y,x-1)+1];
- end
- if(d(y,x+1) >-1)
- a=[a d(y,x+1)+s2];
- end
- if(d(y+1,x)>-1)
- a=[a d(y+1,x)+1];
- end
- if d(y+1,x-1) >-1
- a=[a d(y+1,x-1)+s2];
- end
- mi = min(a);
- if(mi~=d(y,x));
- changed = true;
- end
- d(y,x) = mi;
-
- end
- end
- end
- forward=0
- d
- for y = 2:size(d,1)-1
- for x = size(d,2)-1:-1:2
- if(d(y,x) >-1)
- a=[d(y,x)];
- if(d(y,x+1) >-1)
- a=[a d(y,x+1)+1];
- end
- if(d(y-1,x-1) >-1)
- a=[a d(y-1,x-1)+s2];
- end
- if(d(y-1,x)>-1)
- a=[a d(y-1,x)+1];
- end
- if d(y-1,x+1) >-1
- a=[a d(y-1,x+1)+s2];
- end
- mi = min(a);
- if(mi~=d(y,x))
- changed = true;
- end
- d(y,x) = mi;
- end
- end
- end
- backward=0
- step
- d
-end
-
-end
-
diff --git a/mr/ub10/EX1.m b/mr/ub10/EX1.m
deleted file mode 100644
index a9ca7be..0000000
--- a/mr/ub10/EX1.m
+++ /dev/null
@@ -1,66 +0,0 @@
-p=[24,10;27,1;35,1;38,4;34,9;44,8;50,19;44,25;24,25;30,18;24,10;27,1]
-x=p(:,1);
-y=p(:,2);
-
-[~,xmin]=min(x);
-[~,xmax]=max(x);
-xmin
-xmax
-%expanded red
-%new added green
-%poligon red
-
-figure(1)
-scatter(x,y);
-line(p([1,7],1),p([1,7],2),'Color',[1 0 0])
-line(p([1,3],1),p([1,3],2),'Color',[0 1 0])
-line(p([7,3],1),p([7,3],2),'Color',[0 1 0])
-
-figure(2)
-scatter(x,y);
-line(p([1,7],1),p([1,7],2),'Color',[0 0 1])
-line(p([7,3],1),p([7,3],2),'Color',[0 0 1])
-line(p([1,3],1),p([1,3],2),'Color',[1 0 0])
-line(p([1,2],1),p([1,2],2),'Color',[0 1 0])
-line(p([3,2],1),p([3,2],2),'Color',[0 1 0])
-
-figure(3)
-scatter(x,y);
-line(p([1,7],1),p([1,7],2),'Color',[0 0 1])
-line(p([7,3],1),p([7,3],2),'Color',[1 0 0])
-line(p([1,2],1),p([1,2],2),'Color',[0 0 1])
-line(p([3,2],1),p([3,2],2),'Color',[0 0 1])
-line(p([7,6],1),p([7,6],2),'Color',[0 1 0])
-line(p([3,6],1),p([3,6],2),'Color',[0 1 0])
-
-figure(4)
-scatter(x,y);
-line(p([1,2],1),p([1,2],2),'Color',[0 0 1])
-line(p([3,2],1),p([3,2],2),'Color',[0 0 1])
-line(p([7,6],1),p([7,6],2),'Color',[0 0 1])
-line(p([3,6],1),p([3,6],2),'Color',[0 0 1])
-line(p([9,7],1),p([9,7],2),'Color',[0 1 0])
-line(p([9,1],1),p([9,1],2),'Color',[0 1 0])
-
-figure(5)
-scatter(x,y);
-line(p([1,2],1),p([1,2],2),'Color',[0 0 1])
-line(p([3,2],1),p([3,2],2),'Color',[0 0 1])
-line(p([7,6],1),p([7,6],2),'Color',[0 0 1])
-line(p([3,6],1),p([3,6],2),'Color',[0 0 1])
-line(p([9,7],1),p([9,7],2),'Color',[1 0 0])
-line(p([9,1],1),p([9,1],2),'Color',[0 0 1])
-line(p([9,8],1),p([9,8],2),'Color',[0 1 0])
-line(p([8,7],1),p([8,7],2),'Color',[0 1 0])
-
-figure(6)
-scatter(x,y);
-line(p([1,2],1),p([1,2],2),'Color',[0 0 1])
-line(p([3,2],1),p([3,2],2),'Color',[0 0 1])
-line(p([7,6],1),p([7,6],2),'Color',[0 0 1])
-line(p([3,6],1),p([3,6],2),'Color',[0 0 1])
-line(p([9,1],1),p([9,1],2),'Color',[0 0 1])
-line(p([9,8],1),p([9,8],2),'Color',[0 0 1])
-line(p([8,7],1),p([8,7],2),'Color',[0 0 1])
-
-
diff --git a/mr/ub10/Untitled.ipynb b/mr/ub10/Untitled.ipynb
deleted file mode 100644
index 17a07f5..0000000
--- a/mr/ub10/Untitled.ipynb
+++ /dev/null
@@ -1,117 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 41,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "import numpy as np\n",
- "import matplotlib.pyplot as plt"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 15,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "\n",
- "def qhull(pts):\n",
- " maxx = max(pts, key=lambda pt: pt[0])\n",
- " minx = min(pts, key=lambda pt: pt[0])\n",
- " hull_up = handle_line(pts, (minx, maxx))\n",
- " hull_down = handle_line(pts, (maxx, minx))\n",
- " return hull_up + hull_down"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 34,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "def handle_line(pts, line):\n",
- " left = [p for p in pts if leftOf(p, line)]\n",
- " if len(left) == 0: return []\n",
- " pivot = max(left, key=lambda pt: distanceToLine(pt, line))\n",
- " \n",
- " l = handle_line(left, (line[0], pivot))\n",
- " r = handle_line(left, (pivot, line[1]))\n",
- " hull= [line[0]] + l + [pivot] + r + [line[1]]\n",
- " return hull\n",
- "\n",
- "def distanceToLine(pt, (f, t)):\n",
- " return np.linalg.norm(cross(t - f, f - pt)) / np.linalg.norm(t - f)\n",
- "def leftOf(pt, (f, t)):\n",
- " return dot(ortho(t - f), (pt - f)) < -0.00000001\n",
- "def ortho(v):\n",
- " return np.array([-v[1], v[0]])"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 57,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "pts = np.array([[24,10],[27,1],[35,1],[38,4],[34,9],[44,8],[50,19],[44,25],[24,25],[30,18],[24,10],[27,1]])\n",
- "pts[:,1]\n",
- "plt.figure()\n",
- "plt.scatter(pts[:,0],pts[:,1])\n",
- "plt.show()\n",
- "plt.figure()\n",
- "plt.scatter([1,2,3],[1,3,4])\n",
- "plt.show()\n",
- "#print(qhull(pts))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/mr/ub10/untitled5.m b/mr/ub10/untitled5.m
deleted file mode 100644
index df48b26..0000000
--- a/mr/ub10/untitled5.m
+++ /dev/null
@@ -1,10 +0,0 @@
-a= [1,1]
-b=[1,1]
-
-a~=b
-a=[1 2 3
- 4 5 6
- 7 8 9
-]
-colormap(summer)
-imagesc( a )