Is it possible to pass a parameter to a MoveIteratorFactory - optaplanner

I have created a number of MoveIteratorFactorys and would like to pass a parameter (maxValue) to them. The anticipated effect would be that each iterator created with these factories is then passed this parameter - and consequently change it's behaviour.
Looking that the code and documentation, I don't think this feature exists. But maybe I am missing something?

The current version 7.18 doesn't support it yet, but it does support custom properties on several other config classes.
In the exact same way, a future version of OptaPlanner should support it on MoveListFactoryConfig and MoveIteratorFactoryConfig. I've created an issue with code references for inspiration.
(Pull requests welcome :) Otherwise I 'll code it sooner or later.

Related

#BeanProperty with PropertyChangeListener support?

#BeanProperty generates simple get/set methods. Is there a way to automatically generate such methods with support for firing property change events (e.g. I want to use it with JFace Databinding?)
I've had the same question, and have been keeping a close eye out for possible answers. I think I've just stumbled across one (although I haven't tried it yet). Scala 2.9 has a feature for handling dynamic calls (meant for integration with dynamic languages, I suspect). Essentially, calls to methods which don't exist are routed to a method called applyDynamic. An implementation of that method could use reflection to check that the method signature matches a property (possibly one with an annotation similar to #BeanProperty). If there is a match, it could handle firing the event.
Maybe that's something where a custom compiler plugin can do the trick.
Sadly I have no idea about how to write such a plugin. But at least thought I give you this pointer.
I would be very interested, if you'd come up with something along that line.

optaplanner ValueRangeProvider configuration

Is it possible to configure ValueRangeProvider in such a way that, when engine calls getter of the valueRange, I can somehow know which instance of PlanningEntity is in question, so that I can change the range based on this info.
To make it clearer, for timetabling, I would like to know which "Lecture" is calling CourseSchedule.getRoomList function, then, I will give a smaller roomlist, based on other details of Lecture.
Yes, it's called value range provider from entity (instead of from solution). See docs.

CacheCow and OData caching, how to invalidate PUT/PATCH '/Cars(1)' for GET ALL query '/Cars' as well?

When using CacheCow everything is working great as far as caching goes, except when I do a put/patch/other update to a specific item like /Cars(1) it only invalidates the get query for /Cars(1) and not the parent Get All of /Cars
I've been looking and the documentation seems to be pretty sparse with the wiki just having how to use other types of persistent storage and not really any customization.
I don't mind having to call like Cacher.Invalidate("Cars") or something like that in each of the methods, but I'm not sure what I'd have to call as the CacheCow settings all take place in the config and not per controller so I'm not sure what I'd have to be calling (if a method even exists).
I ended up going with https://github.com/filipw/AspNetWebApi-OutputCache which worked well out of the box. There are a few modifications I made to allow it to work with Patch/Merge requests which you can view here: https://github.com/mackayj/AspNetWebApi-OutputCache/compare/filipw:master...master?w=1 (pull request here: https://github.com/filipw/AspNetWebApi-OutputCache/pull/103)

Umbraco 7, AfterUpdateDocumentCache event is deprecated

I look that the signature of umbraco.content.AfterUpdateDocumentCache event uses umbraco.cms.businesslogic.web.Document object. Unfortunatelly it is deprecated in "Umbraco 7".
What is the new event?
I'm the same issue in umbraco.content.AfterClearDocumentCache event.
Thanks
http://issues.umbraco.org/issue/U4-3462
According to this thread, answered by members of the Umbraco team, the AfterUpdateDocumentCache should still be used and the deprecated parameters are safely ignorable
It doesn't appear there's any analog for umbraco.content.AfterUpdateDocumentCache in the umbraco7 code.
It seems you may have to reconsider you implementation approach to the available events hanging off Umbraco.Core.Services.ContentService
Looking at the u7 implementation of ContentService.Publish, for example, this call the internal SaveAndPublishDo which shows that the PreviewXML and the ContentXML disc caches are called before firing the Saved and Published (via Umbraco.Core.Publishing.PublishingStrategy) events. I presume the old umbraco.content.AfterUpdateDocumentCache was a single event that happened after both of the aforemented events. In it's absence - i believe you may have to watch for the saved/published/deleted events separately.
I can see that there are a bunch of events that would cause the cache update and it'd be a pain to wire them up separately - but maybee a different approach specific to the granularity of the available events is an upgrade?!
It may also help to backtrack from Umbraco.Core.Cache.CacheRefresherBase where i see there are events like OnCacheUpdated. They exist end do fire - though i'm not sure if or where they are publicly exposed.
This is probably more appropriate as a comment (i need more pts) as it's not a 100% resolution to your question. Hopefully it may be helpful to nudge in the right direction?

Non-capturing wildcards in Play Framework routes

I'm exposing an HTTP API through Play, and in order to manage compatibility-breaking changes, the URL contains the version number. At present this looks like the following:
GET /api/v1/someMethod com.foo.Api.someMethod()
As I introduce a change to the output of one of the methods, I'd like to support v2. For most of the methods though, the behaviour is identical, so I don't care which version is used. I tried to modify the above line to:
GET /api/v:version/someMethod com.foo.Api.someMethod()
But Play fails to compile this, with the error Missing parameter in call definition: version.
I know I didn't use the version parameter in the call - because I didn't need to! Is there a sensible way to achieve what I'm after here, either to get Play to skip this check, or to put a wildcard in the route that is not captured as a parameter?
(I suppose if not I could add the parameter to the method definition, and then ignore it. But I'd rather avoid that if possible.)
Having played around with this for a while trying to find workarounds, I suspect it may not be possible.
The big sticking point is reverse routing. Play wants it to be possible for me to be able to use #routes.com.foo.Api.someMethod in my templates, and have it resolved to the URL that would invoke that method. (And in fact I do this in my API docs). If either of my above proposals were to be accepted, it would be arbitrary what the actual URL was that corresponded to the method.
I suppose what I really want is for the method to have a canonical URL, but for other similar patterns to be considered a match too. I accept that Play does not offer this as part of the relatively simple routes file syntax, and I'd have to accomplish it myself (e.g. by using two patterns, with the wildcard one ultimately but not directly invoking the same method).

Resources