Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model aGraph2 "Draw a Graph III"; set i,j "A set of nodes"; e{i,j} "A set of edges"; parameter X{i} "X-position of node"; Y{i} "Y-position of node";; i:=1..8; X{i} := [0 2 0 2 0.6 2.6 0.6 2.6]; Y{i} := [0 0 2 2 0.6 0.6 2.6 2.6]; e{i,j} := if(j-i=4 or (j-i=2 and (i-1)%4<2) or ((j-i)=1 and i%2=1) ,1); drawgraph; model drawgraph; Draw.Scale(60,60); Draw.DefFont('Verdana',10); for{e[i,j]} do Draw.Line(X[i],Y[i],X[j],Y[j],.2); end for{i} do Draw.Circle(i&'', X,Y,.2,1,0); end end end
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: