Comments (9)
And by small, I mean, in the grand scheme of things I can work around this. However, I realize the change to the code could be large.
from burlap.
This is a coding philosophy where I kind of diverge from java-proper. The approach that is implemented now is by design because it saves you writing extra lines of code (one of my pet-peeves with java is that it is very verbose; cf. our discussion on exceptions), but it is true that java doesn't "like" it and it is true that it's not quite as transparent as requiring the client to directly link it. For those reasons, it's something that I strongly debated when I originally implemented it that way. My preference is how it is now, but since the goal is for BURLAP to be used by the public, it may be better to conform with how the majority would prefer it to be. I think right now I'd like to leave this as is until more people comment and if most people think it should be switched we can go with that.
from burlap.
@brawner's suggestion is definitely more in line with Java convention. The verbosity issue is why I typically prefer Scala or Jython wherever I have a choice. Convenience APIs for bulk-adds might help though.
from burlap.
If fewer lines of code is what you are looking for... you don't have to use carriage returns :)
If you want more concise code, you can always overload the methods in the domain class like this.
public Domain generateDomain() {
Domain domain = new SADomain();
domain.addNewAttribute("attribute1", Attribute.AttributeType.DISC);
domain.addNewAttribute("attribute2", Attribute.AttributeType.DISC);
domain.addNewObjectClass("objectClass", new String[] {"attribute1", "attribute2"});
}
But this adds a lot of code to burlap to reduce the client side by an insignificant amount of code.
Still, it's a large job. I suggest it stays as an enhancement request until someone wants to refactor and create version that's not backwards compatible.
from burlap.
That could possibly work, although the reason that I'm slightly hesitant toward it is that I like constructing outside because if for some reason someone wanted to subclass an action or attribute to add some non-standard functionality, they could. Maybe there could be other methods to link the "old" way (or that is, methods on the domain class to add an ObjectClass instance, rather than requesting it to be made) too though getting the best of both words.
I agree that this issue should be left open as an enhancement request.
from burlap.
You know, I was thinking about this a bit more and I wonder if it ultimately ends up being a non-issue. That is, the way BURLAP currently works is that in the attribute/object class/etc. constructor, it makes a call to the domain's addAttribute (et al.) method to add itself to the domain. Subsequent calls to the domain add method may be made with the same attribute/etc. and the BURLAP domain will not add the object if it already has an attribute/etc. with the same name. This means that in the client code, you could do something like:
Domain domain = new SADomain();
domain.addAttribute(new Attribute(domain, "anAtt", Attribute.AttributeType.INT));
and even though this will implicitly result in two calls to the domain's add attribute method, the attribute would still only be added once and java wouldn't throw any warnings.
from burlap.
I suppose that's ok, as long as that's a supported feature.
On Fri, Mar 14, 2014 at 7:59 PM, jmacglashan [email protected]:
You know, I was thinking about this a bit more and I wonder if it
ultimately ends up being a non-issue. That is, the way BURLAP currently
works is that in the attribute/object class/etc. constructor, it makes a
call to the domain's addAttribute (et al.) method to add itself to the
domain. Subsequent calls to the domain add method may be made with the same
attribute/etc. and the BURLAP domain will not add the object if it already
has an attribute/etc. with the same name. This means that in the client
code, you could do something like:Domain domain = new SADomain();domain.addAttribute(new Attribute(domain, "anAtt", Attribute.AttributeType.INT));
and even though this will implicitly result in two calls to the domain's
add attribute method, the attribute would still only be added once and java
wouldn't throw any warnings.Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-37708950
.
from burlap.
Yep, that safe check to prevent adding when it's already there has actually been there since the origin of BURLAP, but for whatever reason I didn't consider that the client could just do it too without breaking the code as a result of that.
I should probably update the domain code in BURLAP accordingly so it stops throwing warnings.
from burlap.
Since I updated all the code so that it didn't produce warnings related to this, I'm going to close this.
from burlap.
Related Issues (20)
- Q Learning Stochastic Movements HOT 5
- PolicyIteration error, type mismatch? HOT 1
- Cumulative probability incorrect in EMinMaxPolicy.getActionDistributionForState() ? HOT 1
- Cumulative probability incorrect in ECorrelatedQJointPolicy.getActionDistributionForState() ? HOT 1
- Is this a bug in SarsaLam implementation? HOT 2
- Hashing Performance in SimpleHashableState HOT 4
- DiscretizingMaskedHashableStateFactory is missing methods for handling config HOT 1
- StochasticGames SCPSolver does not work with Java 64-bit under Windows x64 HOT 2
- Renaming objects in a GenericOOState changes the order in objectsByClass list
- is the website source available?
- PerformancePlotter TRIAL_AVERAGES_ONLY Mode
- Null action issue on allApplicableActionsForTypes in ActionUtils.java
- Burlap incompatibilities HOT 1
- ROS - Continous Domain
- Possible bug in "performReachabilityFrom" function in PolicyIteration.java
- Actions are not published after terminal state
- StatePainter's Graphics2D Context Doesn't Update
- getTotalValueIterations() for ValueIteration?
- PolicyUtils.Rollout(Policy, State, SampleModel) will hang when policy does not reach goal state
- Agent can try to move out of bounds, throwing an ArrayIndexOutOfBoundsException HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from burlap.