Gozintograph: Unterschied zwischen den Versionen

 
(18 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
Ein '''Gozintograph''' (von engl. *goes into* = „geht hinein“) ist ein gerichteter Graph, der die Zerlegung eines Endprodukts in seine Einzelteile oder Komponenten beschreibt.   
Ein '''Gozintograph''' (von engl. ''goes into'' = „geht hinein“) ist ein gerichteter Graph, der die Zerlegung eines Endprodukts in seine Einzelteile oder Komponenten beschreibt.   
Jede Kante stellt dabei eine „Gozinto“-Beziehung dar: Sie zeigt von einer Komponente (Teil) auf das Produkt, in das sie eingeht. Der Gozintograph ist ein zentrales Hilfsmittel in der Produktionsplanung und Stücklistenverwaltung.
Jede Kante stellt dabei eine „Gozinto“-Beziehung dar: Sie zeigt von einer Komponente auf das Produkt, in das sie eingeht. Der Gozintograph ist ein zentrales Hilfsmittel in der Produktionsplanung und Stücklistenverwaltung.


== Definition ==
== Definition ==
Ein Gozintograph ist ein gerichteter, azyklischer Graph \( G = (V, E) \), wobei:
* \( V \) die Menge der Knoten darstellt (Produkte oder Teile),
* \( E \subseteq V \times V \) die gerichteten Kanten darstellt, welche „geht-in“-Beziehungen symbolisieren.


Eine Kante \( (v_i, v_j, a_{ij}) \) mit der Beschriftung \( a_{ij} \) zeigt an, dass zur Herstellung eines Teils \( v_j \) genau \( a_{ij} \) Einheiten von Teil \( v_i \) benötigt werden.
Ein Gozintograph ist ein gerichteter, azyklischer Graph
 
:<math>G=(V,E)</math>
 
mit:
* <math>V</math> als Menge der Knoten (Produkte oder Komponenten),
* <math>E \subseteq V \times V</math> als Menge der gerichteten Kanten.
 
Zusätzlich besitzt jede Kante ein Gewicht <math>a_{ij} \in \mathbb{N}</math>. 
Eine Kante <math>(v_i,v_j)\in E</math> mit Gewicht <math>a_{ij}</math> bedeutet, dass zur Herstellung des Produkts <math>v_j</math> genau <math>a_{ij}</math> Einheiten der Komponente <math>v_i</math> benötigt werden.
 
Da rekursive Stücklisten ausgeschlossen werden, enthält ein Gozintograph keine Zyklen.


== Zusammenhang zu Matrizen ==
== Zusammenhang zu Matrizen ==
Die Informationen eines Gozintographen lassen sich in einer sogenannten '''Gozintomatrix''' darstellen. 
Diese ist eine [[Matrix]] \( A = (a_{ij}) \), bei der das Element \( a_{ij} \) die Anzahl der Einheiten von Komponente \( i \) angibt, die für die Herstellung von Produkt \( j \) benötigt wird. 
In der Produktionsplanung kann die benötigte Gesamtmenge aller Einzelteile über die Gleichung


\[ \mathbf{x} = (I - A)^{-1} \mathbf{y} \]
Die Informationen eines Gozintographen lassen sich in einer sogenannten '''Gozintomatrix''' darstellen.
 
Dies ist eine Matrix
 
:<math>A=(a_{ij})</math>
 
bei der das Element <math>a_{ij}</math> die Anzahl der Einheiten der Komponente <math>i</math> angibt, die unmittelbar zur Herstellung des Produkts <math>j</math> benötigt werden.
 
Unter der Voraussetzung, dass der Gozintograph zyklusfrei ist und <math>I-A</math> invertierbar ist, kann der Gesamtbedarf aller Komponenten über die Gleichung
 
:<math>
\mathbf{x}=(I-A)^{-1}\mathbf{y}
</math>
 
bestimmt werden, wobei:
* <math>\mathbf{y}</math> den Vektor der Endprodukte,
* <math>\mathbf{x}</math> den Vektor der insgesamt benötigten Komponentenmengen
 
beschreibt.


bestimmt werden, wobei \( \mathbf{y} \) den Vektor der Endprodukte und \( \mathbf{x} \) den Vektor der benötigten Teilemengen beschreibt.
== Beispiele ==


==Beispiele==
=== Produktion eines Produkts aus Einzelteilen ===
=== Produktion eines Produkts aus Einzelteilen ===


Im folgenden Beispiel werden fünf Bauteile \( B_1, B_2, B_3, B_4, B_5 \) aus vier Einzelteilen \( E_1, E_2, E_3, E_4 \) gefertigt.   
Im folgenden Beispiel werden fünf Bauteile <math>B_1,B_2,B_3,B_4,B_5</math> aus vier Einzelteilen <math>E_1,E_2,E_3,E_4</math> gefertigt.   
Die Pfeile zeigen, welche Einzelteile in welches Bauteil eingehen. Die Zahlen an den Pfeilen geben die Stückzahl an.
Die Pfeile zeigen, welche Einzelteile in welches Bauteil eingehen. Die Zahlen an den Pfeilen geben die benötigte Stückzahl an.
<!-- VARIANTE B – FINAL OPTIMIERT -->
 
<html>
<html>
<style>
<style>
Zeile 30: Zeile 52:
     height:50vw;
     height:50vw;
     max-width:1100px;
     max-width:1100px;
     max-height:480px;
     max-height:450px;
     border:0;
     border:0;
     margin:0;
     margin:0;
Zeile 51: Zeile 73:
   }
   }


  /* Einheitliche Schriftgröße */
   .node-text, .count-text {
   .node-text, .count-text {
     font-family:sans-serif;
     font-family:sans-serif;
Zeile 65: Zeile 86:
   }
   }


   .edge-arrow { fill:#000; }
   .edge-arrow {
    fill:#000;
  }


   .count-circle {
   .count-circle {
Zeile 75: Zeile 98:


<div class="gozinto-wrap">
<div class="gozinto-wrap">
<svg id="gozinto_svg_2" viewBox="0 0 100 520" preserveAspectRatio="xMinYMin meet">
<svg id="gozinto_svg_2"
    viewBox="0 0 1200 450"
    preserveAspectRatio="xMinYMin meet">
</svg>
</svg>
</div>
</div>
Zeile 81: Zeile 106:
<script>
<script>
(function(){
(function(){
  const svg = document.getElementById("gozinto_svg_2");


   // leicht reduzierte Abstände
const svg=document.getElementById("gozinto_svg_2");
   const scale = 100;
 
   const yOffset = 0;           // früher 5 20 → Grafik rückt nach oben
const scale=100;
   const xOffsetGlobal = 120;   // gesamte Grafik leicht nach rechts (zentrieren)
const yOffset=0;
const xOffsetGlobal=120;
 
function svgEl(name,attrs){
   const el=document.createElementNS("http://www.w3.org/2000/svg",name);
   for(const k in (attrs||{})) el.setAttribute(k,attrs[k]);
  return el;
}
 
function getSVGcoords(evt){
  const pt=svg.createSVGPoint();
  pt.x=evt.clientX;
  pt.y=evt.clientY;
  return pt.matrixTransform(svg.getScreenCTM().inverse());
}
 
function createNode(id,cx,cy,w,h,label){
 
  cx+=xOffsetGlobal/scale;
 
  const g=svgEl("g",{"data-id":id});
 
  const rect=svgEl("rect",{
    class:"node-rect",
    x:(cx-w/2)*scale,
    y:(cy-h/2)*scale+yOffset,
    width:w*scale,
    height:h*scale,
    rx:6,
    ry:6
  });
 
   const text=svgEl("text",{
    class:"node-text",
    x:cx*scale,
    y:cy*scale+yOffset,
    "text-anchor":"middle",
    "dominant-baseline":"middle"
  });
 
  text.textContent=label;
 
  g.appendChild(rect);
  g.appendChild(text);
 
  svg.appendChild(g);
 
  const node={id,cx,cy,w,h,rect,text,g};
 
  let dragging=false,start={};
 
  rect.addEventListener("pointerdown",e=>{
    rect.setPointerCapture(e.pointerId);
    dragging=true;
 
    const p=getSVGcoords(e);
 
    start={
      px:p.x,
      py:p.y,
      cx:node.cx,
      cy:node.cy
    };
  });
 
  rect.addEventListener("pointermove",e=>{
 
    if(!dragging) return;
 
    const p=getSVGcoords(e);
 
    node.cx=start.cx+(p.x-start.px)/scale;
    node.cy=start.cy+(p.y-start.py)/scale;
 
    updateNode(node);
    updateAllEdges();
  });
 
  rect.addEventListener("pointerup",e=>{
    dragging=false;
    rect.releasePointerCapture(e.pointerId);
  });
 
  return node;
}
 
function updateNode(n){
  n.rect.setAttribute("x",(n.cx-n.w/2)*scale);
  n.rect.setAttribute("y",(n.cy-n.h/2)*scale+yOffset);
 
  n.text.setAttribute("x",n.cx*scale);
  n.text.setAttribute("y",n.cy*scale+yOffset);
}
 
function intersectRectBorder(node,tx,ty){
 
   const cx=node.cx;
  const cy=node.cy;
 
  const w2=node.w/2;
  const h2=node.h/2;
 
  const dx=tx-cx;
  const dy=ty-cy;
 
  let pts=[];
 
  if(Math.abs(dx)>1e-9){
 
    let t1=(-w2)/dx;
    let y1=cy+t1*dy;
 
    if(t1>0 && y1>=cy-h2 && y1<=cy+h2)
      pts.push({x:cx-w2,y:y1,t:t1});
 
    let t2=(w2)/dx;
    let y2=cy+t2*dy;


  function svgEl(name, attrs){
    if(t2>0 && y2>=cy-h2 && y2<=cy+h2)
    const el = document.createElementNS("http://www.w3.org/2000/svg", name);
      pts.push({x:cx+w2,y:y2,t:t2});
    for(const k in (attrs||{})) el.setAttribute(k, attrs[k]);
    return el;
   }
   }


   function getSVGcoords(evt){
   if(Math.abs(dy)>1e-9){
     const pt = svg.createSVGPoint();
 
     pt.x = evt.clientX;
     let t3=(-h2)/dy;
     pt.y = evt.clientY;
     let x3=cx+t3*dx;
     return pt.matrixTransform(svg.getScreenCTM().inverse());
 
    if(t3>0 && x3>=cx-w2 && x3<=cx+w2)
      pts.push({x:x3,y:cy-h2,t:t3});
 
    let t4=(h2)/dy;
     let x4=cx+t4*dx;
 
     if(t4>0 && x4>=cx-w2 && x4<=cx+w2)
      pts.push({x:x4,y:cy+h2,t:t4});
   }
   }


   // ----------- NODE -----------
   pts.sort((a,b)=>a.t-b.t);
   function createNode(id, cx, cy, w, h, label){
 
    cx += xOffsetGlobal/scale;  // gesamte Grafik nach rechts versetzt
   return pts[0]||{x:cx,y:cy};
}
 
function pointOnCircle(cx,cy,R,tx,ty){
 
  const dx=tx-cx;
  const dy=ty-cy;
 
  const d=Math.sqrt(dx*dx+dy*dy);
 
  if(d<1e-9) return {x:cx,y:cy};
 
   return {
    x:cx+R*dx/d,
    y:cy+R*dy/d
  };
}
 
function makeArrowHead(x,y,ux,uy,size){


    const g = svgEl("g", {"data-id":id});
  let px=-uy;
    const rect = svgEl("rect", {
  let py=ux;
      class:"node-rect",
      x:(cx-w/2)*scale, y:(cy-h/2)*scale + yOffset,
      width:w*scale, height:h*scale, rx:6, ry:6
    });


    const text = svgEl("text", {
  return `M ${x} ${y}
      class:"node-text",
          L ${x-ux*size+px*size*0.5} ${y-uy*size+py*size*0.5}
      x:cx*scale, y:cy*scale+yOffset,
          L ${x-ux*size-px*size*0.5} ${y-uy*size-py*size*0.5} Z`;
      "text-anchor":"middle",
}
      "dominant-baseline":"middle"
    });
    text.textContent = label;


    g.appendChild(rect);
const edges=[];
    g.appendChild(text);
    svg.appendChild(g);


    const node = {id,cx,cy,w,h,rect,text,g};
function makeConnection(fromNode,toNode,amount,yMid,xOffset){


    // Draggen
  const g=svgEl("g",{});
    let dragging=false, start={};


    rect.addEventListener("pointerdown", e=>{
  const lineA=svgEl("path",{class:"edge-line"});
      rect.setPointerCapture(e.pointerId);
  const lineB=svgEl("path",{class:"edge-line"});
      dragging=true;
  const circle=svgEl("circle",{class:"count-circle"});
      const p = getSVGcoords(e);
  const text=svgEl("text",{class:"count-text"});
      start = {px:p.x, py:p.y, cx:node.cx, cy:node.cy};
  const arrow=svgEl("path",{class:"edge-arrow"});
    });


    rect.addEventListener("pointermove", e=>{
  text.textContent=amount;
      if(!dragging) return;
      const p = getSVGcoords(e);
      node.cx = start.cx + (p.x - start.px)/scale;
      node.cy = start.cy + (p.y - start.py)/scale;
      updateNode(node);
      updateAllEdges();
    });


    rect.addEventListener("pointerup", e=>{
  g.appendChild(lineA);
      dragging=false;
  g.appendChild(lineB);
      rect.releasePointerCapture(e.pointerId);
  g.appendChild(circle);
    });
  g.appendChild(text);
  g.appendChild(arrow);


    return node;
  svg.appendChild(g);
  }


   function updateNode(n){
   let e={
     n.rect.setAttribute("x",(n.cx-n.w/2)*scale);
     fromNode,
     n.rect.setAttribute("y",(n.cy-n.h/2)*scale+yOffset);
    toNode,
     n.text.setAttribute("x",n.cx*scale);
    amount,
     n.text.setAttribute("y",n.cy*scale+yOffset);
    yMid,
   }
    xOffset,
     circle,
     text,
     lineA,
    lineB,
    arrow
   };


   // ------- Geometrie -------
   edges.push(e);
  function intersectRectBorder(node, tx, ty){
    const cx=node.cx, cy=node.cy, w2=node.w/2, h2=node.h/2;
    const dx=tx-cx, dy=ty-cy;
    let pts=[];


    if(Math.abs(dx)>1e-9){
  updateEdge(e);
      let t1=(-w2)/dx; let y1=cy+t1*dy;
}
      if(t1>0 && y1>=cy-h2 && y1<=cy+h2) pts.push({x:cx-w2,y:y1,t:t1});
      let t2=(w2)/dx; let y2=cy+t2*dy;
      if(t2>0 && y2>=cy-h2 && y2<=cy+h2) pts.push({x:cx+w2,y:y2,t:t2});
    }
    if(Math.abs(dy)>1e-9){
      let t3=(-h2)/dy; let x3=cx+t3*dx;
      if(t3>0 && x3>=cx-w2 && x3<=cx+w2) pts.push({x:x3,y:cy-h2,t:t3});
      let t4=(h2)/dy; let x4=cx+t4*dx;
      if(t4>0 && x4>=cx-w2 && x4<=cx+w2) pts.push({x:x4,y:cy+h2,t:t4});
    }
    pts.sort((a,b)=>a.t-b.t);
    return pts[0] || {x:cx,y:cy};
  }


  function pointOnCircle(cx,cy,R,tx,ty){
function updateEdge(e){
    const dx=tx-cx, dy=ty-cy;
    const d=Math.sqrt(dx*dx+dy*dy);
    if(d<1e-9) return {x:cx,y:cy};
    return {x:cx+R*dx/d, y:cy+R*dy/d};
  }


   function makeArrowHead(x,y,ux,uy,size){
   const cx=(e.fromNode.cx+e.toNode.cx)/2+(e.xOffset||0);
    let px=-uy, py=ux;
  const cy=e.yMid;
    return `M ${x} ${y}
  const R=0.14;
            L ${x-ux*size+px*size*0.5} ${y-uy*size+py*size*0.5}
            L ${x-ux*size-px*size*0.5} ${y-uy*size-py*size*0.5} Z`;
  }


   const edges=[];
   const pF=intersectRectBorder(e.fromNode,cx,cy);
  const pT=intersectRectBorder(e.toNode,cx,cy);


   function makeConnection(fromNode,toNode,amount,yMid,xOffset){
   const pCircleIn=pointOnCircle(cx,cy,R,pF.x,pF.y);
    const g=svgEl("g",{});
  const pCircleOut=pointOnCircle(cx,cy,R,pT.x,pT.y);
    const lineA=svgEl("path",{class:"edge-line"});
    const lineB=svgEl("path",{class:"edge-line"});
    const circle=svgEl("circle",{class:"count-circle"});
    const text=svgEl("text",{class:"count-text"});
    const arrow=svgEl("path",{class:"edge-arrow"});


    text.textContent=amount;
  const px=p=>[p.x*scale,p.y*scale+yOffset];
    g.appendChild(lineA);
    g.appendChild(lineB);
    g.appendChild(circle);
    g.appendChild(text);
    g.appendChild(arrow);
    svg.appendChild(g);


    let e={fromNode,toNode,amount,yMid,xOffset,circle,text,lineA,lineB,arrow};
  const F=px(pF);
    edges.push(e);
  const Ci=px(pCircleIn);
    updateEdge(e);
  const Co=px(pCircleOut);
   }
   const T=px(pT);


   function updateEdge(e){
   e.lineA.setAttribute("d",`M ${F[0]} ${F[1]} L ${Ci[0]} ${Ci[1]}`);
    const cx=(e.fromNode.cx+e.toNode.cx)/2+(e.xOffset||0);
  e.lineB.setAttribute("d",`M ${Co[0]} ${Co[1]} L ${T[0]} ${T[1]}`);
    const cy=e.yMid;
    const R=0.14;


    const pF=intersectRectBorder(e.fromNode,cx,cy);
  e.circle.setAttribute("cx",cx*scale);
    const pT=intersectRectBorder(e.toNode,cx,cy);
  e.circle.setAttribute("cy",cy*scale+yOffset);
  e.circle.setAttribute("r",R*scale);


    const pCircleIn=pointOnCircle(cx,cy,R,pF.x,pF.y);
  e.text.setAttribute("x",cx*scale-5);
    const pCircleOut=pointOnCircle(cx,cy,R,pT.x,pT.y);
  e.text.setAttribute("y",cy*scale+yOffset+5);


    const px=p=>[p.x*scale, p.y*scale+yOffset];
  let ux=T[0]-Co[0];
    const F=px(pF), Ci=px(pCircleIn), Co=px(pCircleOut), T=px(pT);
  let uy=T[1]-Co[1];


    e.lineA.setAttribute("d",`M ${F[0]} ${F[1]} L ${Ci[0]} ${Ci[1]}`);
  let L=Math.sqrt(ux*ux+uy*uy);
    e.lineB.setAttribute("d",`M ${Co[0]} ${Co[1]} L ${T[0]} ${T[1]}`);


    e.circle.setAttribute("cx",cx*scale);
  if(L<1e-6) L=1;
    e.circle.setAttribute("cy",cy*scale+yOffset);
    e.circle.setAttribute("r",R*scale);


    e.text.setAttribute('x', cx*scale-5);
  ux/=L;
    e.text.setAttribute('y', cy*scale + yOffset+5);
  uy/=L;


    let ux=T[0]-Co[0], uy=T[1]-Co[1];
  e.arrow.setAttribute("d",makeArrowHead(T[0],T[1],ux,uy,10));
    let L=Math.sqrt(ux*ux+uy*uy); if(L<1e-6) L=1;
}
    ux/=L; uy/=L;


    e.arrow.setAttribute("d",makeArrowHead(T[0],T[1],ux,uy,10));
function updateAllEdges(){
  }
  edges.forEach(updateEdge);
}


  function updateAllEdges(){ edges.forEach(updateEdge); }
const nodes={};


  // ------------ Nodes ------------
nodes.E1=createNode("E1",0,0.5,1.0,0.5,"E1");
  const nodes={};
nodes.E2=createNode("E2",2.5,0.5,1.0,0.5,"E2");
nodes.E3=createNode("E3",5.0,0.5,1.0,0.5,"E3");
nodes.E4=createNode("E4",7.5,0.5,1.0,0.5,"E4");


  // Einzelteile oben
nodes.B1=createNode("B1",0.75,4.5,1.0,0.5,"B1");
  nodes.E1=createNode("E1",0,0.5,1.0,0.5,"E1");
nodes.B2=createNode("B2",2.5,4.5,1.0,0.5,"B2");
  nodes.E2=createNode("E2",2.5,0.5,1.0,0.5,"E2");
nodes.B3=createNode("B3",5.0,4.5,1.0,0.5,"B3");
  nodes.E3=createNode("E3",5.0,0.5,1.0,0.5,"E3");
nodes.B4=createNode("B4",7.5,4.5,1.0,0.5,"B4");
  nodes.E4=createNode("E4",7.5,0.5,1.0,0.5,"E4");
nodes.B5=createNode("B5",10,4.5,1.0,0.5,"B5");


  // Bauteile darunter
makeConnection(nodes.E1,nodes.B1,"2",2.2,-0.2);
  nodes.B1=createNode("B1",0.75,4.5,1.0,0.5,"B1");
makeConnection(nodes.E2,nodes.B1,"1",2.2,0.2);
  nodes.B2=createNode("B2",2.5,4.5,1.0,0.5,"B2");
  nodes.B3=createNode("B3",5.0,4.5,1.0,0.5,"B3");
  nodes.B4=createNode("B4",7.5,4.5,1.0,0.5,"B4");
  nodes.B5=createNode("B5",10,4.5,1.0,0.5,"B5");


  // ------------ Verbindungen ------------
makeConnection(nodes.E1,nodes.B2,"2",2.2,-0.2);
  makeConnection(nodes.E1,nodes.B1,"2",2.2,-0.2);
makeConnection(nodes.E2,nodes.B2,"1",2.2,0.2);
  makeConnection(nodes.E2,nodes.B1,"1",2.2, 0.2);


  makeConnection(nodes.E1,nodes.B2,"2",2.2,-0.2);
makeConnection(nodes.E1,nodes.B3,"1",2.2,-0.25);
  makeConnection(nodes.E2,nodes.B2,"1",2.2, 0.2);
makeConnection(nodes.E2,nodes.B3,"1",2.2,0.0);
makeConnection(nodes.E3,nodes.B3,"1",2.2,0.25);


  makeConnection(nodes.E1,nodes.B3,"1",2.2,-0.25);
makeConnection(nodes.E1,nodes.B4,"2",2.2,-0.3);
  makeConnection(nodes.E2,nodes.B3,"1",2.2, 0.0);
makeConnection(nodes.E3,nodes.B4,"1",2.2,0.0);
  makeConnection(nodes.E3,nodes.B3,"1",2.2, 0.25);
makeConnection(nodes.E4,nodes.B4,"1",2.2,0.3);


  makeConnection(nodes.E1,nodes.B4,"2",2.2,-0.3);
makeConnection(nodes.E1,nodes.B5,"1",2.2,-0.2);
  makeConnection(nodes.E3,nodes.B4,"1",2.2, 0.0);
makeConnection(nodes.E4,nodes.B5,"2",2.2,0.2);
  makeConnection(nodes.E4,nodes.B4,"1",2.2, 0.3);


  makeConnection(nodes.E1,nodes.B5,"1",2.2,-0.2);
updateAllEdges();
  makeConnection(nodes.E4,nodes.B5,"2",2.2, 0.2);


  updateAllEdges();
})();
})();
</script>
</script>
</html>
</html>


Die Gozintomatrix zum oberen Gozintographen kann dann aus der Tabelle  
Die Gozintomatrix zum oberen Gozintographen kann aus folgender Tabelle abgeleitet werden:


{| class="wikitable"
{| class="wikitable"
!     !! B1   !! B2 !! B3 !! B4 !! B5
! !! B1 !! B2 !! B3 !! B4 !! B5
|-
|-
| '''E1'''   || 2 || 2 || 1 || 1
| '''E1''' || 2 || 2 || 1 || 2 || 1
|-
|-
| '''E2'''   || 1 || 1 || 1 || 0
| '''E2''' || 1 || 1 || 1 || 0 || 0
|-
|-
| '''E3'''   || 0 || 0 || 1 || 0
| '''E3''' || 0 || 0 || 1 || 1 || 0
|-
|-
| '''E3'''   || 0 || 0 || 0 || 2
| '''E4''' || 0 || 0 || 0 || 1 || 2
|}
|}


abgeleitet werden und ist dann durch
und ist durch


:<math>
:<math>
A = \begin{pmatrix}
A=
\begin{pmatrix}
2 & 2 & 1 & 2 & 1 \\
2 & 2 & 1 & 2 & 1 \\
1 & 1 & 1 & 0 & 0 \\
1 & 1 & 1 & 0 & 0 \\
Zeile 315: Zeile 423:
0 & 0 & 0 & 1 & 2
0 & 0 & 0 & 1 & 2
\end{pmatrix}
\end{pmatrix}
</math>  
</math>


gegeben. Beispielsweise lässt sich aus der ersten Spalte ablesen, dass 2 Einzelteile von E1, 1 Einzelteil von E2 sowie 0 Einzelteile von E3 und E4 für die Herstellung eines Bauteils B1 benötigt werden.
gegeben.


=== Produktion von Spielwaren aus Rohstoffen über Zwischenprodukte ===
=== Produktion von Spielwaren aus Rohstoffen über Zwischenprodukte ===


Ein Spielwarenhersteller produziert aus drei Rohstoffen \(R_1, R_2, R_3\) zunächst die beiden Zwischenprodukte \(Z_1, Z_2\), aus denen anschließend die drei Endprodukte \(E_1, E_2, E_3\) gefertigt werden.  
Ein Spielwarenhersteller produziert aus drei Rohstoffen <math>R_1,R_2,R_3</math> zunächst die beiden Zwischenprodukte <math>Z_1,Z_2</math>, aus denen anschließend die drei Endprodukte <math>E_1,E_2,E_3</math> gefertigt werden.


Die Pfeile im Gozintographen geben an, wie viele Tonnen eines Materials zur Produktion von 1 Tonne des entstehenden Produkts benötigt werden
Die Pfeile im Gozintographen geben an, wie viele Mengeneinheiten eines Materials zur Produktion einer Mengeneinheit des entstehenden Produkts benötigt werden.
Beispiel: Für die Herstellung von 1 Tonne \(Z_1\) werden 3 Tonnen \(R_1\) und 4 Tonnen \(R_2\) benötigt.


<!-- GOZINTOGRAPH: Rohstoffe → Zwischenprodukte → Endprodukte -->
<!-- GOZINTOGRAPH: Rohstoffe → Zwischenprodukte → Endprodukte -->
<html>
<html>
<style>
<style>
   .gozinto-wrap {
   .gozinto-wrap2 {
     width:95vw;
     width:95vw;
     height:60vw;
     height:70vw;
     max-width:1200px;
     max-width:1200px;
     max-height:650px;
     max-height:800px;
     border:0;
     border:0;
     margin:0;
     margin:0;
Zeile 339: Zeile 446:
   }
   }


   svg {
   .gozinto-wrap2 svg {
     width:100%;
     width:100%;
     height:100%;
     height:100%;
Zeile 354: Zeile 461:
   }
   }


   .node-text, .count-text {
   .node-text,
  .count-text {
     font-family:sans-serif;
     font-family:sans-serif;
     font-size:14px;
     font-size:14px;
Zeile 367: Zeile 475:
   }
   }


   .edge-arrow { fill:#000; }
   .edge-arrow {
    fill:#000;
  }


   .count-circle {
   .count-circle {
Zeile 376: Zeile 486:
</style>
</style>


<div class="gozinto-wrap">
<div class="gozinto-wrap2">
<svg id="gozinto_svg" viewBox="0 0 1180 600" preserveAspectRatio="xMinYMin meet">
<svg id="gozinto_svg"
    viewBox="0 0 1180 640"
    preserveAspectRatio="xMinYMin meet">
</svg>
</svg>
</div>
</div>
Zeile 383: Zeile 495:
<script>
<script>
(function(){
(function(){
   const svg = document.getElementById("gozinto_svg");
   const svg = document.getElementById("gozinto_svg");


Zeile 391: Zeile 504:
   function svgEl(name, attrs){
   function svgEl(name, attrs){
     const el = document.createElementNS("http://www.w3.org/2000/svg", name);
     const el = document.createElementNS("http://www.w3.org/2000/svg", name);
     for(const k in (attrs||{})) el.setAttribute(k, attrs[k]);
 
     for(const k in (attrs||{}))
      el.setAttribute(k, attrs[k]);
 
     return el;
     return el;
   }
   }
Zeile 397: Zeile 513:
   function getSVGcoords(evt){
   function getSVGcoords(evt){
     const pt = svg.createSVGPoint();
     const pt = svg.createSVGPoint();
     pt.x = evt.clientX;
     pt.x = evt.clientX;
     pt.y = evt.clientY;
     pt.y = evt.clientY;
     return pt.matrixTransform(svg.getScreenCTM().inverse());
     return pt.matrixTransform(svg.getScreenCTM().inverse());
   }
   }
  // -------------------------------------------------
  // NODE
  // -------------------------------------------------


   function createNode(id, cx, cy, w, h, label){
   function createNode(id, cx, cy, w, h, label){
     cx += xOffsetGlobal/scale;
 
     cx += xOffsetGlobal / scale;


     const g = svgEl("g", {"data-id":id});
     const g = svgEl("g", {"data-id":id});
     const rect = svgEl("rect", {
     const rect = svgEl("rect", {
       class:"node-rect",
       class:"node-rect",
       x:(cx-w/2)*scale, y:(cy-h/2)*scale + yOffset,
       x:(cx-w/2)*scale,
       width:w*scale, height:h*scale, rx:6, ry:6
      y:(cy-h/2)*scale + yOffset,
       width:w*scale,
      height:h*scale,
      rx:6,
      ry:6
     });
     });


     const text = svgEl("text", {
     const text = svgEl("text", {
       class:"node-text",
       class:"node-text",
       x:cx*scale, y:cy*scale+yOffset,
       x:cx*scale,
      y:cy*scale+yOffset,
       "text-anchor":"middle",
       "text-anchor":"middle",
       "dominant-baseline":"middle"
       "dominant-baseline":"middle"
     });
     });
     text.textContent = label;
     text.textContent = label;


     g.appendChild(rect);
     g.appendChild(rect);
     g.appendChild(text);
     g.appendChild(text);
     svg.appendChild(g);
     svg.appendChild(g);


     const node = {id,cx,cy,w,h,rect,text,g};
     const node = {id,cx,cy,w,h,rect,text,g};


     let dragging=false, start={};
    // Dragging
 
     let dragging=false,start={};


     rect.addEventListener("pointerdown", e=>{
     rect.addEventListener("pointerdown", e=>{
       rect.setPointerCapture(e.pointerId);
       rect.setPointerCapture(e.pointerId);
       dragging=true;
       dragging=true;
       const p = getSVGcoords(e);
 
       start = {px:p.x, py:p.y, cx:node.cx, cy:node.cy};
       const p=getSVGcoords(e);
 
       start={
        px:p.x,
        py:p.y,
        cx:node.cx,
        cy:node.cy
      };
     });
     });


     rect.addEventListener("pointermove", e=>{
     rect.addEventListener("pointermove", e=>{
       if(!dragging) return;
       if(!dragging) return;
       const p = getSVGcoords(e);
 
       node.cx = start.cx + (p.x - start.px)/scale;
       const p=getSVGcoords(e);
       node.cy = start.cy + (p.y - start.py)/scale;
 
       node.cx=start.cx+(p.x-start.px)/scale;
       node.cy=start.cy+(p.y-start.py)/scale;
 
       updateNode(node);
       updateNode(node);
       updateAllEdges();
       updateAllEdges();
Zeile 445: Zeile 591:


     rect.addEventListener("pointerup", e=>{
     rect.addEventListener("pointerup", e=>{
       dragging=false;
       dragging=false;
       rect.releasePointerCapture(e.pointerId);
       rect.releasePointerCapture(e.pointerId);
     });
     });
Zeile 453: Zeile 601:


   function updateNode(n){
   function updateNode(n){
     n.rect.setAttribute("x",(n.cx-n.w/2)*scale);
     n.rect.setAttribute("x",(n.cx-n.w/2)*scale);
     n.rect.setAttribute("y",(n.cy-n.h/2)*scale+yOffset);
     n.rect.setAttribute("y",(n.cy-n.h/2)*scale+yOffset);
     n.text.setAttribute("x",n.cx*scale);
     n.text.setAttribute("x",n.cx*scale);
     n.text.setAttribute("y",n.cy*scale+yOffset);
     n.text.setAttribute("y",n.cy*scale+yOffset);
   }
   }
  // -------------------------------------------------
  // GEOMETRIE
  // -------------------------------------------------


   function intersectRectBorder(node, tx, ty){
   function intersectRectBorder(node, tx, ty){
     const cx=node.cx, cy=node.cy, w2=node.w/2, h2=node.h/2;
 
     const dx=tx-cx, dy=ty-cy;
     const cx=node.cx;
    const cy=node.cy;
 
    const w2=node.w/2;
    const h2=node.h/2;
 
     const dx=tx-cx;
    const dy=ty-cy;
 
     let pts=[];
     let pts=[];


     if(Math.abs(dx)>1e-9){
     if(Math.abs(dx)>1e-9){
       let t1=(-w2)/dx; let y1=cy+t1*dy;
 
       if(t1>0 && y1>=cy-h2 && y1<=cy+h2) pts.push({x:cx-w2,y:y1,t:t1});
       let t1=(-w2)/dx;
       let t2=(w2)/dx; let y2=cy+t2*dy;
      let y1=cy+t1*dy;
       if(t2>0 && y2>=cy-h2 && y2<=cy+h2) pts.push({x:cx+w2,y:y2,t:t2});
 
       if(t1>0 && y1>=cy-h2 && y1<=cy+h2)
        pts.push({x:cx-w2,y:y1,t:t1});
 
       let t2=(w2)/dx;
      let y2=cy+t2*dy;
 
       if(t2>0 && y2>=cy-h2 && y2<=cy+h2)
        pts.push({x:cx+w2,y:y2,t:t2});
     }
     }
     if(Math.abs(dy)>1e-9){
     if(Math.abs(dy)>1e-9){
       let t3=(-h2)/dy; let x3=cx+t3*dx;
 
       if(t3>0 && x3>=cx-w2 && x3<=cx+w2) pts.push({x:x3,y:cy-h2,t:t3});
       let t3=(-h2)/dy;
       let t4=(h2)/dy; let x4=cx+t4*dx;
      let x3=cx+t3*dx;
       if(t4>0 && x4>=cx-w2 && x4<=cx+w2) pts.push({x:x4,y:cy+h2,t:t4});
 
       if(t3>0 && x3>=cx-w2 && x3<=cx+w2)
        pts.push({x:x3,y:cy-h2,t:t3});
 
       let t4=(h2)/dy;
      let x4=cx+t4*dx;
 
       if(t4>0 && x4>=cx-w2 && x4<=cx+w2)
        pts.push({x:x4,y:cy+h2,t:t4});
     }
     }
     pts.sort((a,b)=>a.t-b.t);
     pts.sort((a,b)=>a.t-b.t);
     return pts[0] || {x:cx,y:cy};
     return pts[0] || {x:cx,y:cy};
   }
   }


   function pointOnCircle(cx,cy,R,tx,ty){
   function pointOnCircle(cx,cy,R,tx,ty){
     const dx=tx-cx, dy=ty-cy;
 
     const dx=tx-cx;
    const dy=ty-cy;
 
     const d=Math.sqrt(dx*dx+dy*dy);
     const d=Math.sqrt(dx*dx+dy*dy);
     if(d<1e-9) return {x:cx,y:cy};
     if(d<1e-9) return {x:cx,y:cy};
     return {x:cx+R*dx/d, y:cy+R*dy/d};
 
     return {
      x:cx+R*dx/d,
      y:cy+R*dy/d
    };
   }
   }


   function makeArrowHead(x,y,ux,uy,size){
   function makeArrowHead(x,y,ux,uy,size){
     let px=-uy, py=ux;
 
     let px=-uy;
    let py=ux;
 
     return `M ${x} ${y}
     return `M ${x} ${y}
             L ${x-ux*size+px*size*0.5} ${y-uy*size+py*size*0.5}
             L ${x-ux*size+px*size*0.5} ${y-uy*size+py*size*0.5}
             L ${x-ux*size-px*size*0.5} ${y-uy*size-py*size*0.5} Z`;
             L ${x-ux*size-px*size*0.5} ${y-uy*size-py*size*0.5} Z`;
   }
   }
  // -------------------------------------------------
  // KANTEN
  // -------------------------------------------------


   const edges=[];
   const edges=[];


   function makeConnection(fromNode,toNode,amount,yMid,xOffset){
   function makeConnection(fromNode,toNode,amount,yMid,xOffset){
     const g=svgEl("g",{});
     const g=svgEl("g",{});
     const lineA=svgEl("path",{class:"edge-line"});
     const lineA=svgEl("path",{class:"edge-line"});
     const lineB=svgEl("path",{class:"edge-line"});
     const lineB=svgEl("path",{class:"edge-line"});
     const circle=svgEl("circle",{class:"count-circle"});
 
     const text=svgEl("text",{class:"count-text"});
     const circle=svgEl("circle",{
     const arrow=svgEl("path",{class:"edge-arrow"});
      class:"count-circle"
    });
 
     const text=svgEl("text",{
      class:"count-text"
    });
 
     const arrow=svgEl("path",{
      class:"edge-arrow"
    });


     text.textContent=amount;
     text.textContent=amount;
Zeile 511: Zeile 718:
     g.appendChild(text);
     g.appendChild(text);
     g.appendChild(arrow);
     g.appendChild(arrow);
     svg.appendChild(g);
     svg.appendChild(g);


     let e={fromNode,toNode,amount,yMid,xOffset,circle,text,lineA,lineB,arrow};
     let e={
      fromNode,
      toNode,
      amount,
      yMid,
      xOffset,
      circle,
      text,
      lineA,
      lineB,
      arrow
    };
 
     edges.push(e);
     edges.push(e);
     updateEdge(e);
     updateEdge(e);
   }
   }


   function updateEdge(e){
   function updateEdge(e){
     const cx=(e.fromNode.cx+e.toNode.cx)/2+(e.xOffset||0);
     const cx=(e.fromNode.cx+e.toNode.cx)/2+(e.xOffset||0);
     const cy=e.yMid;
     const cy=e.yMid;
     const R=0.14;
     const R=0.14;


Zeile 529: Zeile 752:
     const pCircleOut=pointOnCircle(cx,cy,R,pT.x,pT.y);
     const pCircleOut=pointOnCircle(cx,cy,R,pT.x,pT.y);


     const px=p=>[p.x*scale, p.y*scale+yOffset];
     const px=p=>[p.x*scale,p.y*scale+yOffset];
     const F=px(pF), Ci=px(pCircleIn), Co=px(pCircleOut), T=px(pT);
 
     const F=px(pF);
    const Ci=px(pCircleIn);
    const Co=px(pCircleOut);
    const T=px(pT);
 
    e.lineA.setAttribute(
      "d",
      `M ${F[0]} ${F[1]} L ${Ci[0]} ${Ci[1]}`
    );


     e.lineA.setAttribute("d",`M ${F[0]} ${F[1]} L ${Ci[0]} ${Ci[1]}`);
     e.lineB.setAttribute(
    e.lineB.setAttribute("d",`M ${Co[0]} ${Co[1]} L ${T[0]} ${T[1]}`);
      "d",
      `M ${Co[0]} ${Co[1]} L ${T[0]} ${T[1]}`
    );


     e.circle.setAttribute("cx",cx*scale);
     e.circle.setAttribute("cx",cx*scale);
Zeile 539: Zeile 773:
     e.circle.setAttribute("r",R*scale);
     e.circle.setAttribute("r",R*scale);


     e.text.setAttribute('x', cx*scale-5);
     e.text.setAttribute("x",cx*scale-5);
     e.text.setAttribute('y', cy*scale + yOffset+5);
     e.text.setAttribute("y",cy*scale+yOffset+5);
 
    let ux=T[0]-Co[0];
    let uy=T[1]-Co[1];
 
    let L=Math.sqrt(ux*ux+uy*uy);
 
    if(L<1e-6) L=1;


     let ux=T[0]-Co[0], uy=T[1]-Co[1];
     ux/=L;
    let L=Math.sqrt(ux*ux+uy*uy); if(L<1e-6) L=1;
     uy/=L;
     ux/=L; uy/=L;


     e.arrow.setAttribute("d",makeArrowHead(T[0],T[1],ux,uy,10));
     e.arrow.setAttribute(
      "d",
      makeArrowHead(T[0],T[1],ux,uy,10)
    );
   }
   }


   function updateAllEdges(){ edges.forEach(updateEdge); }
   function updateAllEdges(){
    edges.forEach(updateEdge);
  }


   // -----------------------------------------------------
   // -------------------------------------------------
   // NODES
   // NODES
   // -----------------------------------------------------
   // -------------------------------------------------


   const nodes={};
   const nodes={};


   // Rohstoffe (oben)
   // Rohstoffe
 
   nodes.R1=createNode("R1",0,0.8,1.0,0.5,"R1");
   nodes.R1=createNode("R1",0,0.8,1.0,0.5,"R1");
   nodes.R2=createNode("R2",2.5,0.8,1.0,0.5,"R2");
   nodes.R2=createNode("R2",2.5,0.8,1.0,0.5,"R2");
   nodes.R3=createNode("R3",5.0,0.8,1.0,0.5,"R3");
   nodes.R3=createNode("R3",5.0,0.8,1.0,0.5,"R3");


   // Zwischenprodukte (Mitte)
   // Zwischenprodukte
   nodes.Z1=createNode("Z1",1.2,3.3,1.0,0.5,"Z1");
 
   nodes.Z2=createNode("Z2",4.0,3.3,1.0,0.5,"Z2");
   nodes.Z1=createNode("Z1",1.2,3.2,1.0,0.5,"Z1");
   nodes.Z2=createNode("Z2",3.6,3.2,1.0,0.5,"Z2");
 
  // Endprodukte


  // Endprodukte (unten)
   nodes.E1=createNode("E1",0.5,5.6,1.0,0.5,"E1");
   nodes.E1=createNode("E1",0.5,5.8,1.0,0.5,"E1");
   nodes.E2=createNode("E2",2.8,5.6,1.0,0.5,"E2");
   nodes.E2=createNode("E2",2.5,5.8,1.0,0.5,"E2");
   nodes.E3=createNode("E3",5.1,5.6,1.0,0.5,"E3");
   nodes.E3=createNode("E3",4.5,5.8,1.0,0.5,"E3");


   // -----------------------------------------------------
   // -------------------------------------------------
   // VERBINDUNGEN
   // VERBINDUNGEN
  // gemäß Tabellen:
   // -------------------------------------------------
  // Rohstoffe → Zwischenprodukte
 
  // R1→Z1: 3  | R1→Z2: 1
  // Rohstoffe -> Zwischenprodukte
  // R2→Z1: 4  | R2→Z2: 2
  // R3→Z1: 0  | R3→Z2: 3
  // Zwischenprodukte → Endprodukte
  // Z1: (E1=2, E2=1, E3=0)
  // Z2: (E1=1, E2=3, E3=2)
   // -----------------------------------------------------


  // R1
   makeConnection(nodes.R1,nodes.Z1,"3",1.8,-0.3);
   makeConnection(nodes.R1,nodes.Z1,"3",1.8,-0.3);
   makeConnection(nodes.R1,nodes.Z2,"1",1.8, 0.4);
   makeConnection(nodes.R1,nodes.Z2,"1",1.8,0.4);


  // R2
   makeConnection(nodes.R2,nodes.Z1,"4",1.8,-0.2);
   makeConnection(nodes.R2,nodes.Z1,"4",1.8,-0.2);
   makeConnection(nodes.R2,nodes.Z2,"2",1.8, 0.2);
   makeConnection(nodes.R2,nodes.Z2,"2",1.8,0.2);
 
  makeConnection(nodes.R3,nodes.Z2,"3",1.8,0.0);


   // R3
   // Zwischenprodukte -> Endprodukte
  makeConnection(nodes.R3,nodes.Z2,"3",1.8, 0.0);


  // Z1 → Endprodukte
   makeConnection(nodes.Z1,nodes.E1,"2",4.4,-0.2);
   makeConnection(nodes.Z1,nodes.E1,"2",4.6,-0.2);
   makeConnection(nodes.Z1,nodes.E2,"1",4.4,0.2);
   makeConnection(nodes.Z1,nodes.E2,"1",4.6, 0.2);


  // Z2 → Endprodukte
   makeConnection(nodes.Z2,nodes.E1,"1",4.4,-0.3);
   makeConnection(nodes.Z2,nodes.E1,"1",4.6,-0.3);
   makeConnection(nodes.Z2,nodes.E2,"3",4.4,0.0);
   makeConnection(nodes.Z2,nodes.E2,"3",4.6, 0.0);
   makeConnection(nodes.Z2,nodes.E3,"2",4.4,0.3);
   makeConnection(nodes.Z2,nodes.E3,"2",4.6, 0.3);


   updateAllEdges();
   updateAllEdges();
})();
})();
</script>
</script>
</html>
</html>
Die vollständigen Mengen seien wie folgt definiert:
Die vollständigen Mengen seien wie folgt definiert:


{| class="wikitable"
{| class="wikitable"
!             !! Z1 !! Z2
! !! Z1 !! Z2
|-
|-
| '''R1'''     || 3 || 1
| '''R1''' || 3 || 1
|-
|-
| '''R2'''     || 4 || 2
| '''R2''' || 4 || 2
|-
|-
| '''R3'''     || 0 || 3
| '''R3''' || 0 || 3
|}
|}


{| class="wikitable"
{| class="wikitable"
!             !! E1 !! E2 !! E3
! !! E1 !! E2 !! E3
|-
|-
| '''Z1'''     || 2 || 1 || 0
| '''Z1''' || 2 || 1 || 0
|-
|-
| '''Z2'''     || 1 || 3 || 2
| '''Z2''' || 1 || 3 || 2
|}
|}


Aus diesen Tabellen ergibt sich die **Gozintomatrix Rohstoffe → Endprodukte**, indem die Matrizen miteinander multipliziert werden:
Aus diesen Tabellen ergibt sich die '''Gozintomatrix Rohstoffe → Endprodukte''' durch Matrixmultiplikation:


:<math>
:<math>
RZ = \begin{pmatrix}
RZ=
\begin{pmatrix}
3 & 1 \\
3 & 1 \\
4 & 2 \\
4 & 2 \\
0 & 3
0 & 3
\end{pmatrix},
\end{pmatrix}
\qquad
</math>
ZE = \begin{pmatrix}
 
:<math>
ZE=
\begin{pmatrix}
2 & 1 & 0 \\
2 & 1 & 0 \\
1 & 3 & 2
1 & 3 & 2
Zeile 646: Zeile 887:


:<math>
:<math>
RE = RZ \cdot ZE
RE=RZ \cdot ZE
    = \begin{pmatrix}
=
\begin{pmatrix}
3 & 1 \\
3 & 1 \\
4 & 2 \\
4 & 2 \\
Zeile 662: Zeile 904:


:<math>
:<math>
RE =
RE=
\begin{pmatrix}
3\cdot2 + 1\cdot1  & 3\cdot1 + 1\cdot3 & 3\cdot0 + 1\cdot2 \\
4\cdot2 + 2\cdot1  & 4\cdot1 + 2\cdot3 & 4\cdot0 + 2\cdot2 \\
0\cdot2 + 3\cdot1  & 0\cdot1 + 3\cdot3 & 0\cdot0 + 3\cdot2
\end{pmatrix}
=
\begin{pmatrix}
\begin{pmatrix}
7 & 6 & 2 \\
7 & 6 & 2 \\
Zeile 676: Zeile 912:
</math>
</math>


Die Matrix zeigt, wie viele Tonnen der Rohstoffe \(R_1, R_2, R_3\) jeweils zur Herstellung von 1 Tonne der Endprodukte \(E_1, E_2, E_3\) notwendig sind
Die Matrix zeigt, wie viele Mengeneinheiten der Rohstoffe <math>R_1,R_2,R_3</math> jeweils zur Herstellung einer Einheit der Endprodukte <math>E_1,E_2,E_3</math> notwendig sind.
Beispielsweise bedeutet die erste Spalte:
 
Für 1 Tonne \(E_1\) werden benötigt:
* 7 Tonnen \(R_1\) 
* 10 Tonnen \(R_2\) 
* 3 Tonnen \(R_3\)
 
Dies ergibt sich daraus, dass die Zwischenprodukte Z1 und Z2 selbst wiederum aus Rohstoffen bestehen.


[[Kategorie:Lineare_Algebra]]
[[Kategorie:Lineare_Algebra]]
[[Kategorie:AHR_WuV_Mathe_GK]]
[[Kategorie:AHR_WuV_Mathe_GK]]