Enabling and Disabling Elitism during a Genetic Run - genetic-programming

In EpochX framework how do you enable and disable Elitism during a run? Is there a way to configure the framework to function like that.

According the oficial documentation:
the "Elitism - is performed by the ElitismManager, and the number of
elites is obtained from the model's getNoElites() method [...] The
number of elites requested may be zero, which effectively disables elitism.
So, you can set zero to the getNoElites function to disable elitism.

Related

Is there any way to enable extensions or features after an instance/device is created?

I'm doing some wrapper job with Vulkan, to make the API more safe, and I wondered if I can create an instance or device first, and enable extensions or features later.
First, according to the spec:
VUID-VkDeviceCreateInfo-pProperties-04451
If the VK_KHR_portability_subset extension is included in pProperties of
vkEnumerateDeviceExtensionProperties, ppEnabledExtensionNames must
include "VK_KHR_portability_subset"
This looks fine, but notice that to enable VK_KHR_portability_subset extension on a device, you must enable its dependency VK_KHR_get_physical_device_properties2, which is an instance extension. This makes the fact that an instance must enable VK_KHR_get_physical_device_properties2 anyway in case the 04451 will check when a device is creating.
Secondly, it will be convenient to enable features later, for example if a user passed some parameter in, which requires some features, I can implicitly enable them for this user.
Features and extensions are specified at creation time. They're an innate part of the instance or device from that point forward. They cannot be modified later.
You can create new instances or devices. But you can't change existing ones.

How to invoke a custom ResultFilter before ClientErrorResultFilter is executed in ASP.NET 6

I spent almost a full day debugging why my client can't post any forms, until I found out the anti-forgery mechanism got borked on the client-side and the server just responded with a 400 error, with zero logs or information (turns out anti-forgery validation is logged internally with Info level).
So I decided the server needs to special handle this scenario, however according to this answer I don't really know how to do that (aside from hacking).
Normally I would set up a IAlwaysRunResultFilter and check for IAntiforgeryValidationFailedResult. Easy.
Except that I use Api Controllers, so by default all results get transformed into ProblemDetails. So context.Result as mentioned here is always of type ObjectResult. The solution accepted there is to use options.SuppressMapClientErrors = true;, however I want to retain this mapping at the end of the pipeline. But if this option isn't set to true, I have no idea how to intercept the Result in the pipeline before this transformation.
So in my case, I want to do something with the result of the anti-forgery validation as mentioned in the linked post, but after that I want to retain the ProblemDetails transformation. But my question is titled generally, as it is about executing filters before the aforementioned client mapping filter.
Through hacking I am able to achieve what I want. If we take a look at the source code, we can see that the filter I want to precede has an order of -2000. So if I register my global filter like this o.Filters.Add(typeof(MyResultFilter), -2001);, then the filter shown here correctly executes before ClientErrorResultFilter and thus I can handle the result and retain the transformation after the handling. However I feel like this is just exploiting the open-source-ness of .Net 6 and of course as you can see it's an internal constant, so I have no guarantee the next patch doesn't change it and my code breaks. Surely there must be a proper way to order my filter to run before the api transform.

Add Validation in Aurelia dynamically

Is there a way to add Validation to a property on my VM "dynamically" (i.e. sometime after I register the initial rules on the VM)?
Currently, I'm registering the rules in the constructor of the VM, then a little while later, after the user has entered a bunch of data, I need to show a new field (using if.bind) and want to add validation depending on the result of a web api call..
Wondering if there's an API for this that I've missed?
You can achieve it without dynamically adding rule but instead you can use satisfiesRule and when, see it here in section Conditional Validation. satisfiesRule will only evaluated if the property that attached to it is already pass.
when will only evaluated the rule if the condition is true.
Additional link.
If you're using bootstrap, you can find this useful.

How to set thread number when running tensorflow sample on Android?

As we know, the android demo of tensorflow is multi-thread. So how can I change it to the single-thread mode?
There's no way to do this from Java right now. A value for intra-op parallelism is automatically picked in local_device.cc matching the number of cores detected on your device. If you just want to test, you could overwrite the value there.
Inter-op parallelism is currently always 1 on mobile -- only one op runs at a time.
More generally in native code intra and inter op parallism can be set when creating your Session object. e.g.:
tensorflow::SessionOptions options;
tensorflow::ConfigProto& config = options.config;
config.set_intra_op_parallelism_threads(num_threads);
Session session = tensorflow::NewSession(options);
This will override the automatically picked value. See benchmark_model.cc for an example.
If you want to set this from Java, you would have to add a parameter to TensorFlowInferenceInterface.initializeTensorFlow().
We're switching to the Java API soon, though, so it will be easier to access the SessionOptions to set the value then.

MSI MsiGetFeatureState returns INSTALLSTATE_BROKEN when called by a custom action as commit execution

One of my CA's tried to detect which feature was selected using MsiGetFeatureState and modify HKLM using its state, but it alayws returns INSTALLSTATE_BROKEN. I put this CA before "InstallFinalize".
So I wonder if this is expected and how I can do this. Thank you in advance.
Please see: Obtaining Context Information for Deferred Execution Custom Actions
A deferred cusom acton ( which commit is ) can't call MsiGetFeatureState. Only an immeadiate custom action can. If the information is needed in the deferred it must be marshaled using CustomActionData. For more information, read Installation Phases and In-Script Execution Options for Custom Actions in Windows Installer.
Also please realize that commit custom actions don't execute when rollback is disabled.
I'm not really sure what you mean by "modify HKLM using it's state" but in general you should use the registry table to declare registry updates. Don't reinevent the wheel as it's generally less robust.
You should avoid modify the features in the registry. i'm not sure if it's allowed to query feature states thru the api while installing the same product. you may get an old/wrong answer. but what you can do, is to set some property's and use them within the custom action. Take a look at the msdn "Conditional Statement Syntax". there are some symbols which allow you the query features-actions and feature-states (or components).