/// <summary> /// Initializes a new instance of the <see cref="RecognizeChooseApply" /> class. /// </summary> /// <param name="host">The _seed.</param> /// <param name="rulesets">The _rulesets.</param> /// <param name="maxNumOfCalls">The _max num of calls.</param> /// <param name="display">if set to <c>true</c> [_display].</param> /// <param name="inParallel">The process should be invoked in parallel where possible.</param> protected RecognizeChooseApply(designGraph host, ruleSet[] rulesets, int[] maxNumOfCalls = null, Boolean display = false, Boolean inParallel = true) { SearchIO.output("initializing RCA generation:", 4); Rulesets = (ruleSet[])rulesets.Clone(); NumOfRuleSets = rulesets.GetLength(0); SearchIO.output("There are " + NumOfRuleSets + " rule sets.", 4); Host = new candidate(host, NumOfRuleSets); SearchIO.output("Host = " + host.name, 4); MaxNumOfCalls = new int[rulesets.GetLength(0)]; for (var i = 0; i < this.MaxNumOfCalls.GetLength(0); i++) { if (maxNumOfCalls == null) { this.MaxNumOfCalls[i] = -1; } else if (maxNumOfCalls.GetLength(0) <= i) { this.MaxNumOfCalls[i] = maxNumOfCalls[0]; } else { this.MaxNumOfCalls[i] = maxNumOfCalls[i]; } } Display = display; SearchIO.output("It is " + display + " that the SearchIO will be displayed.", 4); InParallel = inParallel; }
/* One can create 3 custom Layout algorithms to alter the graph * appearance. Here I am showing two and leaving the third one * commented out. These names will appear in the GraphLayout menu * drop down and are accessible by the posted shortcuts as well. * ALSO, you can set a layout to be the default for whenever a * graph window is 'entered'. These names won't be shown in the * settings but you can choose one of these as Custom1, Custom2, * Custom3 in the settings dialog. */ public void diagonalLayout(GraphControl gc, designGraph graph) { /* in these functions, you need to set the properties of the * displayShape of the node and arc, and not their properties * directly. */ Random rnd = new Random(); int i = 1; foreach (node a in graph.nodes) { a.displayShape.X = 10 * i; a.displayShape.Y = 10 * i; a.displayShape.ShapeColor = Color.FromArgb((17 * i) % 255, 255 - i, (100 * i) % 255); /* in addition to X, Y, and ShapeColor, you can also change * the Z-Order (a.displayShape.ZOrder which is like "order" * in PPT, MS Word, or Photoshop), Width, Height, Show text * (i.e. ShowLabel), outline (Pen and PenWidth), and font. */ i++; } foreach (arc a in graph.arcs) { a.displayShape.LineColor = Color.Navy; //a.displayShape.LineEnd = ConnectionEnd.LeftOpenArrow; a.displayShape.LinePath = "Bezier"; // could also be "Default", which is straightline // or "Rectangular" but that doesn't seem to work // sometimes. a.displayShape.LineStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; a.displayShape.LineWeight = ConnectionWeight.Fat; a.displayShape.ZOrder = 0; a.displayShape.BoxedLabel = false; /* here are the basic properties one can change for an arc. */ } }
public graphDisplay() { InitializeComponent(); this.MdiParent = Program.main; graphControl1.LoadLibraries(); graph1 = new designGraph(); }
internal static void AddPartsProperties(string inputDir, designGraph assemblyGraph) { var reader = new StreamReader(File.OpenRead(@inputDir + "/information.csv")); while (!reader.EndOfStream) { var line = reader.ReadLine(); var values = line.Split(','); var i = 1; var node = assemblyGraph.nodes.Cast <Component>().Where(n => n.name == Convert.ToString(values[0])).ToList()[0]; while (i < 9) { if (Convert.ToDouble(values[i]) == Constants.WEIGHT) { node.Mass = Convert.ToDouble(values[i + 1]); i += 2; continue; } if (Convert.ToDouble(values[i]) == Constants.VOLUME) { node.Volume = Convert.ToDouble(values[i + 1]); i += 2; continue; } if (Convert.ToDouble(values[i]) == Constants.CENTEROFMASS) { node.CenterOfMass = new[] { Convert.ToDouble(values[i + 1]), Convert.ToDouble(values[i + 2]), Convert.ToDouble(values[i + 3]) }; i += 4; continue; } } } }
public static void LoadState() { DegreeOfFreedoms = state.DegreeOfFreedoms; StablbiblityScores = state.StablbiblityScores; Solids = state.Solids; SolidsNoFastener = state.SolidsNoFastener; SolidsNoFastenerSimplified = state.SolidsNoFastenerSimplified; SimplifiedSolids = state.SimplifiedSolids; SolidsMass = state.SolidsMass; AssemblyGraph = state.AssemblyGraph; StabilityWeightChosenByUser = state.StabilityWeightChosenByUser; UncertaintyWeightChosenByUser = state.UncertaintyWeightChosenByUser; MeshMagnifier = state.MeshMagnifier; PointInMagicBox = state.PointInMagicBox; BeamWidth = state.BeamWidth; DetectFasteners = state.DetectFasteners; AvailableWorkers = state.AvailableWorkers; FastenersAreThreaded = state.FastenersAreThreaded; StabilityScore = state.StabilityScore; RobustSolution = state.RobustSolution; globalDirPool = state.globalDirPool; allmtime = state.allmtime; allitime = state.allitime; gpmovingtime = state.gpmovingtime; gpinstalltime = state.gpinstalltime; gpsecuretime = state.gpsecuretime; gprotate = state.gprotate; }
/* This is APPLY for the rule entitled: aftersgos */ public designGraph gearspeedas(designGraph Lmapping, designGraph host, designGraph Rmapping, double[] parameters) { double gearmaas = Lmapping.nodes[0].localVariables[0]; double gearspeedas = Lmapping.nodes[0].localVariables[1]; double radius1as = Lmapping.nodes[0].localVariables[3]; double teeth1as = Lmapping.nodes[0].localVariables[2]; /* obtaining values for old properties */ Rmapping.nodes[0].localVariables[1] = gearspeedas; Rmapping.nodes[0].localVariables[2] = teeth1as; Rmapping.nodes[0].localVariables[3] = radius1as; Rmapping.nodes[0].localVariables[0] = gearmaas; /* setting old gear properties*/ double teeth2as = Rmapping.nodes[1].localVariables[2]; double radius2as = Rmapping.nodes[1].localVariables[3]; /*obtaining new gear properties from right*/ Rmapping.nodes[1].localVariables[0] = (-(teeth1as / teeth2as)) * gearmaas; Rmapping.nodes[1].localVariables[1] = -((gearspeedas * radius1as) / radius2as); return(host); }
public graphWindow(designGraph dg, CanvasProperty canvasProperties, string filename, string title) { /* the following is common to all GS window types. */ InitializeComponent(); Owner = main; ShowInTaskbar = false; foreach (CommandBinding cb in main.CommandBindings) { CommandBindings.Add(cb); graphGUI.CommandBindings.Add(cb); } foreach (InputBinding ib in main.InputBindings) { InputBindings.Add(ib); graphGUI.InputBindings.Add(ib); } /***************************************************/ graph = graphGUI.graph = dg; graphGUI.ScrollOwner = scrollViewer1; canvasProps = canvasProperties ?? new CanvasProperty(); canvasProps.AddGUIToControl(graphGUI); AdoptWindowWideCanvasProperties(); this.filename = !string.IsNullOrEmpty(filename) ? filename : "Untitled"; Title = !string.IsNullOrEmpty(title) ? title : Path.GetFileNameWithoutExtension(this.filename); graphGUI.InitDrawGraph(); txtGlobalVariables.Text = DoubleCollectionConverter.Convert(graph.globalVariables); txtGlobalLabels.Text = StringCollectionConverter.Convert(graph.globalLabels); }
private FrameworkElement BuildXAMLGraphPage(designGraph graph, CanvasProperty cp) { if (cp == null) { cp = new CanvasProperty(); } return(new Page { Background = Brushes.Black, Content = new Border { BorderThickness = new Thickness(1), BorderBrush = Brushes.DarkGray, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Child = new Viewbox { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, StretchDirection = StretchDirection.Both, Child = BuildGraphGUICanvas(graph, cp) } } }); }
public void showProperties(Netron.GraphLib.UI.GraphControl GC, grammarRule rule1, object[] props) { graphControl = GC; rule = rule1; if (graphControl.Name == "graphControlLHS") { graph = rule.L; } else { graph = rule.R; } rule.updateFromGraphControl(graphControl); try { this.graphRulePropsTab.Text = "Rule Properties"; if (rule.Bag == null) { rule.initPropertiesBag(); } this.graphRuleProps.SelectedObject = rule.Bag; } catch (Exception exc) { MessageBox.Show("The properties of the rule has thrown an exception and cannot be displayed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SearchIO.output(exc.Message, 2); } showDisplayProperties(graphControl, (Netron.GraphLib.PropertyBag)props[0]); showRuleNodeArcProperties((Netron.GraphLib.PropertyBag)props[0], graph); }
private void showNodeArcProperties(PropertyBag shapeProps, designGraph graph) { this.nodeArcProps.Enabled = true; this.propertiesTabControl.SelectedIndex = 0; try { if ((shapeProps.Owner.GetType()) == (typeof(Connection))) { arc temparc = graph.arcs.Find(delegate(arc b) { return(b.displayShape == shapeProps.Owner); }); if (temparc.Bag == null) { temparc.initPropertiesBag(); } this.nodeArcProps.SelectedObject = temparc.Bag; } else { node tempnode = graph.nodes.Find(delegate(node b) { return(b.displayShape == shapeProps.Owner); }); if (tempnode.Bag == null) { tempnode.initPropertiesBag(); } this.nodeArcProps.SelectedObject = tempnode.Bag; } } catch { this.nodeArcProps.Enabled = false; this.propertiesTabControl.SelectedIndex = 1; } }
/* This is APPLY for the rule entitled: gearshaftgear */ public designGraph gearspeedgsg(designGraph Lmapping, designGraph host, designGraph Rmapping, double[] parameters) { double gearmagsg = Lmapping.nodes[0].localVariables[0]; double gearspeed1gsg = Lmapping.nodes[0].localVariables[1]; double radius1gsg = Lmapping.nodes[0].localVariables[3]; double teeth1gsg = Lmapping.nodes[0].localVariables[2]; /* obtaining values for old properties */ Rmapping.nodes[1].localVariables[0] = gearspeed1gsg; /* setting shaft on right properties*/ Rmapping.nodes[0].localVariables[1] = gearspeed1gsg; Rmapping.nodes[0].localVariables[2] = teeth1gsg; Rmapping.nodes[0].localVariables[3] = radius1gsg; Rmapping.nodes[0].localVariables[0] = gearmagsg; /* setting old gear properties*/ double teeth2gsg = Rmapping.nodes[4].localVariables[2]; double radius2gsg = Rmapping.nodes[4].localVariables[3]; /*obtaining new gear properties from right*/ Rmapping.nodes[4].localVariables[0] = (-(teeth1gsg / teeth2gsg)) * gearmagsg; Rmapping.nodes[4].localVariables[1] = -((gearspeed1gsg * radius1gsg) / radius2gsg); /* setting new properties with calculations*/ return(host); }
private static bool ParallelNormals(designGraph assemblyGraph, TessellatedSolid solid1, TessellatedSolid solid2) { var dir1 = VariableOfTheIndex(DisConstants.GearNormal, assemblyGraph[solid1.Name].localVariables); var dir2 = VariableOfTheIndex(DisConstants.GearNormal, assemblyGraph[solid1.Name].localVariables); return(1 - Math.Abs(dir1.dotProduct(dir2)) < OverlappingFuzzification.EqualToZeroL); }
public static designGraph readxyz2graph(string path, designGraph host) { string text; using (StreamReader reader = new StreamReader(path)) { text = reader.ReadToEnd(); } //Console.WriteLine(text); string[] splitlocation = new string[] { "Atoms. Timestep: " }; ///xyz files contain this tag before each frame, this makes it so we can seperate out the frames string[] frames = text.Split(splitlocation, StringSplitOptions.None); //string finalframe =frames[frames.GetLength(0)-1];//get the last frame string secondframe = frames[2]; using (StringReader str = new StringReader(secondframe)) { string line; line = str.ReadLine(); int count = 0; while (((line = str.ReadLine()) != null) && (count < host.nodes.Count)) { string[] values = line.Split(' '); node n = host.nodes[ count]; //there should always be the same number of nodes in the graph as there are atoms in .xyz right? unless I put in some nodes that aren't atoms n.X = Convert.ToDouble(values[1]) / scale; n.Y = Convert.ToDouble(values[2]) / scale; n.Z = Convert.ToDouble(values[3]) / scale; count++; } } return(host); //using(Str) }
public static designGraph tagconvexhullpoints(designGraph host) { //putting this here for now //tags the points on a convex hull with the label hullpt //why even make this into a rule Dictionary <Tuple <double, double, double>, int> lookup = new Dictionary <Tuple <double, double, double>, int>(); List <double[]> points = new List <double[]>(); for (int i = 0; i < host.nodes.Count; i++) { node n = host.nodes[i]; n.localLabels.RemoveAll(s => s == "hullpt"); double[] pos = new double[] { n.X, n.Y, n.Z }; points.Add(pos); lookup.Add(Tuple.Create(n.X, n.Y, n.Z), i); } var chull = ConvexHull.Create(points); foreach (var pt in chull.Points) { var pttple = Tuple.Create(pt.Position[0], pt.Position[1], pt.Position[2]); if (lookup.ContainsKey(pttple)) { int n = lookup[pttple]; host.nodes[n].localLabels.Add("hullpt"); } } return(host); }
/* This is APPLY for the rules entitled: singleidler*/ public designGraph gearspeedidler(designGraph Lmapping, designGraph host, designGraph Rmapping, double[] parameters) { double gearmaidle = Lmapping.nodes[0].localVariables[0]; double gearspeedidle = Lmapping.nodes[0].localVariables[1]; double radius1idle = Lmapping.nodes[0].localVariables[3]; double teeth1idle = Lmapping.nodes[0].localVariables[2]; /* obtaining values for old properties */ /*Shaft speed is already set to 0*/ Rmapping.nodes[0].localVariables[1] = gearspeedidle; Rmapping.nodes[0].localVariables[2] = teeth1idle; Rmapping.nodes[0].localVariables[3] = radius1idle; Rmapping.nodes[0].localVariables[0] = gearmaidle; /* setting old gear properties*/ double teeth2idle = Rmapping.nodes[3].localVariables[2]; double radius2idle = Rmapping.nodes[3].localVariables[3]; /*obtaining new gear properties from right*/ Rmapping.nodes[3].localVariables[0] = (-(teeth1idle / teeth2idle)) * gearmaidle; Rmapping.nodes[3].localVariables[1] = -((gearspeedidle * radius1idle) / radius2idle); /* setting new properties with calculations*/ return(host); }
/// <summary> /// Saves the graph. /// </summary> /// <param name = "filename">The filename.</param> /// <param name = "graph1">The graph1.</param> protected void SaveGraph(string filename, designGraph graph1) { StreamWriter graphWriter = null; graph1.name = Path.GetFileNameWithoutExtension(filename); graph1.checkForRepeatNames(); removeNullWhiteSpaceEmptyLabels(graph1); try { graphWriter = new StreamWriter(filename); var s = SerializeGraphToXml(graph1); if (s != null) { graphWriter.Write(s); } } catch (FileNotFoundException fnfe) { SearchIO.output("***Error Writing to File***"); SearchIO.output(fnfe.ToString()); } finally { if (graphWriter != null) { graphWriter.Close(); } } }
public static void doFastenerDetection(string[] args) { state = new ProgramState(); SetInputArguments(state, args); LoadState(); Solids = GetSTLs(state.inputDir); EnlargeTheSolid(); AssemblyGraph = new designGraph(); DisassemblyDirectionsWithFastener.RunGeometricReasoning(Solids); if (DetectFasteners) { DisassemblyDirectionsWithFastener.RunFastenerDetection(Solids, FastenersAreThreaded); } SerializeSolidProperties(); SaveState(); if (serverMode) { state.Save(state.inputDir + slash + "intermediate" + slash + "ProgramState.xml"); } else { state.Save(state.inputDir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml"); } Console.WriteLine("\nDone"); }
/* This is APPLY for the rule entitled: terminal rule */ public designGraph gearspeedterm(designGraph Lmapping, designGraph host, designGraph Rmapping, double[] parameters) { double gearmaterm = Lmapping.nodes[0].localVariables[0]; double gearspeedterm = Lmapping.nodes[0].localVariables[1]; double radius1term = Lmapping.nodes[0].localVariables[3]; double teeth1term = Lmapping.nodes[0].localVariables[2]; double gearma2term = Lmapping.nodes[1].localVariables[0]; double gearspeed2term = Lmapping.nodes[1].localVariables[1]; double radius2term = Lmapping.nodes[1].localVariables[3]; double teeth2term = Lmapping.nodes[1].localVariables[2]; /* obtaining values for old properties */ Rmapping.nodes[1].localVariables[1] = gearspeedterm; Rmapping.nodes[1].localVariables[0] = gearmaterm; /* setting shaft on right properties*/ Rmapping.nodes[0].localVariables[1] = gearspeedterm; Rmapping.nodes[0].localVariables[2] = teeth1term; Rmapping.nodes[0].localVariables[3] = radius1term; Rmapping.nodes[0].localVariables[0] = gearmaterm; Rmapping.nodes[4].localVariables[1] = gearspeed2term; Rmapping.nodes[4].localVariables[2] = teeth2term; Rmapping.nodes[4].localVariables[3] = radius2term; Rmapping.nodes[4].localVariables[0] = gearma2term; /* setting old gear properties*/ return(host); }
private void SaveRule(string filename, grammarRule rule, designGraph graphK) { rule.name = Path.GetFileNameWithoutExtension(filename); if (checkRule(rule)) { // progress is now at 13 var SaveString = BuildXAMLRulePage(rule, graphK); /* A little manipulation is needed to stick the GraphSynth objects within the page. * * The IgnorableSetup string ensures that XAML viewers ignore the following * * GraphSynth specific elements: the canvas data, and the graph data. This eff- * * ectively separates the topology and data of the graph from the graphic elements. */ SaveString = SaveString.Insert(SaveString.IndexOf(">", StringComparison.Ordinal), IgnorableSetup + "Tag=\"Rule\" "); /* remove the ending Page tag but put it back at the end. */ SaveString = SaveString.Replace("</Page>", ""); /* add the graph data. */ SaveString += "\n\n" + AddIgnorablePrefix(SerializeRuleToXml(rule)) + "\n\n"; /* put the closing tag back on. */ SaveString += "</Page>"; try { File.WriteAllText(filename, SaveString); } catch (Exception E) { SearchIO.output("File Access Exception" + E.Message, 10000, "", "Cancel", false); } SearchIO.output("**** Rule successfully saved. ****", 2); } }
/* This is APPLY for the rule entitled: gearshaftgear */ public designGraph gearspeedgsg(designGraph Lmapping, designGraph host, designGraph Rmapping, double[] parameters) { double gearmagsg = Lmapping.nodes[0].localVariables[0]; double gearspeed1gsg = Lmapping.nodes[0].localVariables[1]; double radius1gsg = Lmapping.nodes[0].localVariables[3]; double teeth1gsg = Lmapping.nodes[0].localVariables[2]; /* obtaining values for old properties */ Rmapping.nodes[1].localVariables[0] = gearspeed1gsg; /* setting shaft on right properties*/ Rmapping.nodes[0].localVariables[1] = gearspeed1gsg; Rmapping.nodes[0].localVariables[2] = teeth1gsg; Rmapping.nodes[0].localVariables[3] = radius1gsg; Rmapping.nodes[0].localVariables[0] = gearmagsg; /* setting old gear properties*/ double teeth2gsg = Rmapping.nodes[4].localVariables[2]; double radius2gsg = Rmapping.nodes[4].localVariables[3]; /*obtaining new gear properties from right*/ Rmapping.nodes[4].localVariables[0] = (-(teeth1gsg / teeth2gsg)) * gearmagsg; Rmapping.nodes[4].localVariables[1] = -((gearspeed1gsg * radius1gsg) / radius2gsg); /* setting new properties with calculations*/ /* put the mechanical advantage into the 0 slot under the gear label*/ /*slot 0- MA, slot 1 - speed, slot 2 - teeth(catalog), slot 3 - radius(catalog)*/ return(host); }
private static void ConvertToSecondaryArc(designGraph graph, Dictionary <int, List <NonAdjacentBlockings> > NonAdjacentBlocking) { foreach (var key in NonAdjacentBlocking.Keys.ToList()) { var dirs = (from gDir in DisassemblyDirections.Directions where 1 - Math.Abs(gDir.dotProduct(DisassemblyDirections.Directions[key])) < OverlappingFuzzification.CheckWithGlobDirsParall select DisassemblyDirections.Directions.IndexOf(gDir)).ToList(); var oppositeDir = dirs.Where(d => d != key).ToList(); foreach (var blockings in NonAdjacentBlocking[key]) { var from = graph.nodes.Where(n => n.name == blockings.blockingSolids[0].Name).Cast <Component>().ToList()[0]; // blocked var to = graph.nodes.Where(n => n.name == blockings.blockingSolids[1].Name).Cast <Component>().ToList()[0]; // blocking // if the opprosite direction exists for to and from instead of from and to, do not add the arc. // if a is blocked by b in z direction, b is blocked by a in -z direction. So no need to add an additional arc. if (dirs.Count > 1) { if ( graph.arcs.Where(arc => arc is SecondaryConnection) .Cast <SecondaryConnection>() .Any( SC => (SC.From == to && SC.To == from && SC.Directions.Contains(oppositeDir[0])) || (SC.From == from && SC.To == to && SC.Directions.Contains(key)))) { continue; } } var existing = graph.arcs.OfType <SecondaryConnection>() .Where(exist => (exist.From == from && exist.To == to) || (exist.To == from && exist.From == to)) .ToList(); if (existing.Any()) { if (existing[0].From == from && existing[0].To == to && !existing[0].Directions.Contains(key)) { existing[0].Directions.Add(key); } else { if (oppositeDir.Any() && !existing[0].Directions.Contains(oppositeDir[0])) { existing[0].Directions.Add(oppositeDir[0]); } } } else { graph.addArc(from, to, "", typeof(SecondaryConnection)); var a = (SecondaryConnection)graph.arcs.Last(); a.Directions.Add(key); //a.Distance = blockings.blockingDistance; } } } }
internal void Update(List <node> _nodes, designGraph _graph, GraphGUI _gui) { nodes = _nodes; graph = _graph; gui = _gui; nodeIcon = ((DisplayShape)firstNode.DisplayShape).icon; Update(); }
internal void Update(List <hyperarc> _hyperarcs, designGraph _graph, GraphGUI _gui) { hyperarcs = _hyperarcs; graph = _graph; gui = _gui; hyperArcIcon = ((HyperArcShape)firstHyperArc.DisplayShape.Shape).icon; Update(); }
internal void Update(List <arc> _arcs, designGraph _graph, GraphGUI _gui) { arcs = _arcs; graph = _graph; gui = _gui; arcIcon = ((ArcShape)firstArc.DisplayShape.Shape).icon; Update(); }
/// <summary> /// Clean way to minimize a graph. /// </summary> private designGraph Minimize(designGraph graph) { var mol = OBFunctions.designgraphtomol(graph); var newMol = OBFunctions.InterStepMinimize(mol); OBFunctions.updatepositions(graph, newMol); return(graph); }
/* This is APPLY for the rule entitled: seedBurst1rule4 */ public designGraph distributeTo1NewRoot(designGraph Lmapping, designGraph host, designGraph Rmapping, double[] parameters) { Rmapping.nodes[1].localVariables.Add(Rmapping.nodes[0].localVariables[0] - 1); //Rmapping.nodes[1].screenY = 0.0f; //Rmapping.nodes[1].screenX = 0.0f; Rmapping.nodes[0].localVariables[0] = 0.1; return(host); }
private static IList <Connection> HyperBorderArcs(designGraph graph, hyperarc pNodeHy) { if (pNodeHy.nodes.Count == 1) { return(pNodeHy.nodes[0].arcs.Where(a => a is Connection).Cast <Connection>().ToList()); } return(DBGBinary.HyperarcBorderArcsFinder(pNodeHy)); }
/// <summary> /// Clean way to minimize a graph. /// </summary> private designGraph Minimize(designGraph graph) { var mol = QuickMinimization(OBFunctions.designgraphtomol(graph), IODir + "rank" + ".lmpdat", IODir + "rank" + ".coeff", false, 0); OBFunctions.updatepositions(graph, mol); return(OBFunctions.tagconvexhullpoints(graph)); }
internal static List <AssemblyCandidate> Run(designGraph assemblyGraph, List <TessellatedSolid> solids, List <int> globalDirPool, List <TessellatedSolid> solides) { //DisassemblyDirections.Directions = TemporaryDirections(); var solutions = new List <AssemblyCandidate>(); assemblyEvaluator = new AssemblyEvaluator(solids); //Updates.UpdateGlobalDirections(globalDirPool); assemblyGraph.addHyperArc(assemblyGraph.nodes); var iniHy = assemblyGraph.hyperarcs[assemblyGraph.hyperarcs.Count - 1]; iniHy.localLabels.Add(DisConstants.SeperateHyperarcs); var candidates = new SortedList <List <double>, AssemblyCandidate>(new MO_optimizeSort()); var found = false; AssemblyCandidate goal = null; var ini = new AssemblyCandidate(new candidate(assemblyGraph, 1)); candidates.Add(new List <double>(), ini); while (candidates.Count != 0 && !found) { var current = candidates.Values[0]; candidates.Clear(); if (isCurrentTheGoal(current)) { goal = current; found = true; break; } var options = new List <option>(); foreach (var cndDirInd in globalDirPool) { foreach ( var seperateHy in current.graph.hyperarcs.Where(h => h.localLabels.Contains(DisConstants.SeperateHyperarcs)) .ToList()) { SCC.StronglyConnectedComponents(current.graph, seperateHy, cndDirInd); //BoostedSCC.StronglyConnectedComponents(current.graph, seperateHy, cndDirInd); var blockingDic = DBG.DirectionalBlockingGraph(current.graph, cndDirInd); options.AddRange(OptionGeneratorPro.GenerateOptions(current.graph, seperateHy, blockingDic, options)); } } foreach (var opt in options) { //var child = (AssemblyCandidate) current.copy(); //SearchProcess.transferLmappingToChild(child.graph, current.graph, opt); //var rest = Updates.AddSecondHyperToOption(child, opt); //Updates.ApplyChild(child, opt); //if (assemblyEvaluator.Evaluate(child, opt, rest, solides) > 0) // candidates.Add(child.performanceParams, child); //child.addToRecipe(opt); } } solutions.Add(goal); TemporaryFixingSequence(goal); return(solutions); }
internal static void SaveTheGraph(designGraph assemblyGraph) { var outputDirectory = ""; var setting = new GlobalSettings(); var sa = new BasicFiler(setting.InputDir, setting.OutputDir, setting.RulesDir); sa.outputDirectory = outputDirectory; sa.Save("abbasgholi.gxml", assemblyGraph, false); }