algorithmic modeling for Rhino
Could be possible to code a genome list that uses inputs to generate that list? (number of genes, domains, etc) We are solving a problem in a workshop I'm teaching now that turns to a non-parametric solution if you can't change genome list properties with other data inputs. That data that changes genome won't change in the optimization process.
Thanks and best.
Tags:
I just want the genes inside to inhert previous values, so that I don´t have to modify them manually since they are a lot of them
inside to inherit previous values
Save the state with a set of values that you want to use again in the future
Thanks, I see, but I didn´t mean that. I´m working with a VB Script by David Rutten (http://www.grasshopper3d.com/forum/topics/request-parametric-genome...) to control the number of genes with a slider, introduced as a counter input in the VB component. I was just wondering if it possible to control the value of the genes generated within the Genepool with an input because I already have a set of values for that genes, which are the ones I needed to be inhereted by the genes generated. I could modify these values manually since the genes are sliders, but that is a pain because they are a lot of them.
Hi,
of course there is a way to set the values of a GenePool within a script. That's just how Galapagos and Octopus work.
Here are some snippets of C# code:
GH_Document doc = this.OnPingDocument();
if (doc == null)
{
GAlog += "\r\nDocument not found";
return false;
}
// this line can be replaced by another doc.FindObject function giving you back a representation of the GenePool object from you canvas
GalapagosGeneListObject geneList = (GalapagosGeneListObject)doc.FindObject(new Guid( -- your Gene Pool's Guid--- ), false);
double max = geneList.Maximum;
double min = geneList.Minimum;
for (int k = 0; k < geneList.Count; k++)
{
geneList[k] = (decimal)(new Value);
}
geneLists[j].ExpirePreview(true);
// to update the solution with the new values
geneLists[j].ExpireSolution(false);
maybe this helps
Best
Thanks Robert, this is helping me today.. in 2017! Best, John.
I've had good success through this thread figuring out in VB how to dynamically set the number, range and decimals for my gene pools, but am having a harder time getting to adjusting the values. I can't seem to find a way to access the GalapagosGeneListObject. Any pointers?
Private Sub RunScript(ByVal Genelist As String, ByVal Count As Integer, ByVal MinVal As Double, ByVal MaxVal As Double, ByVal DecimalPlaces As Integer, ByRef A As Object)
For Each obj As IGH_DocumentObject In owner.OnPingDocument().Objects
If (obj.ComponentGuid <> New Guid("{21553c44-ea62-475e-a8bb-62b2a3ee5ca5}")) Then Continue For
If (obj.NickName Like genelist) Then
CallByName(obj, "Count", CallType.Set, count)
CallByName(obj, "Minimum", CallType.Set, MinVal)
CallByName(obj, "Maximum", CallType.Set, MaxVal)
CallByName(obj, "Decimals", CallType.Set, DecimalPlaces)
Return
End If
Next
End Sub
Never mind...sorted it out:
Dim SetIdx as Int32 = i 'value index to set
Dim SetValue as Double = v 'value to set
CallByName(obj, "Value", CallType.Set, SetIdx, SetValue)
Now you have to post it in the Milkbox ;)
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by