Non-deterministic CSP programming tool? [closed] - constraint-programming

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Hi i need a non deterministic constraint satisfaction problem tool, because i need different solutions with the same input of the problem. Someone knows about a tool with this characteristic?
I only know tools like Gecode (c++), Choco (Java) and Curry (Haskell) that i think work in deterministic way.

If what you want is to get some random solution, most CP tools have some support for using randomised heuristics. For example, the standard Gecode branchers have options for this, for example INT_VAR_RND and INT_VAL_RND for integer variables. To get a different search each time, make sure to set the seed uniquely.
Note that using random heuristics will not give you any guarantee of the distribution. For example, your problem might have only two solutions, but almost all random choices might lead to one of the solutions giving a very skewed distribution.

Are you trying to do Pareto optimization (aka multi-objective optimization) and let the user choose one of the pareto optimal solutions?
People have done this with Drools Planner (java, open source) by simply replacing the BestSolutionRecaller class. See this thread and this thread. Planner 6.0 or 6.1 will provide out-of-the-box pareto support.

Similar to what Zayenz said, you can try Minion with the flag -randomiseorder.

Related

dynamic programming in functional languages [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I study haskell. I encounter with the problem that I cannot save intermediate calculation steps. It feels ineffective. How to use dynamic programming in functional programming?
I encounter [in Haskell] the problem that I cannot save intermediate
calculation steps.
I do not know what ressources you used to learn it, but they were apparently not the best.
For example:
let
intermediate = {- calculation step -}
in ...
saves the result of a calculation step in intermediate. (Better: it binds the variable intermediate to the value. )
In addition, to cite the relevant Wikipedia entry:
In mathematics, computer science, and economics, dynamic programming
is a method for solving complex problems by breaking them down into
simpler subproblems. It is applicable to problems exhibiting the
properties of overlapping subproblems[1] and optimal substructure
(described below). When applicable, the method takes far less time
than naive methods.
The key idea behind dynamic programming is quite simple. In general,
to solve a given problem, we need to solve different parts of the
problem (subproblems), then combine the solutions of the subproblems
to reach an overall solution. Often, many of these subproblems are
really the same. The dynamic programming approach seeks to solve each
subproblem only once, thus reducing the number of computations: once
the solution to a given subproblem has been computed, it is stored or
"memo-ized": the next time the same solution is needed, it is simply
looked up. This approach is especially useful when the number of
repeating subproblems grows exponentially as a function of the size of
the input.
It is obvious that this style of problem solving is supported by Haskell quite nicely. For example, in the easiest case one could carry a map around, that keeps the already solved sub-problems and their solutions. More advanced approach could use the State Monad. And so on.

Is there any programming language that lets you redefine its type system? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I'm looking for programming languages that let you redefine their type system without having to hack into the compiler. Is there anything out there that allows you to do that?
Thanks
In C you can use DEFINE to redefine everything.
#DEFINE int double
Whether it's good or bad you can find out here:
What is the worst real-world macros/pre-processor abuse you've ever come across?
If you're talking about redefining an actual type system, like making a statically typed language dynamic or making a weakly-typed language strongly-typed, then no.
Practically every language lets you define your own types, so I don't think that's what you meant either.
The only thing I can think of that might fit into what you're asking about are Macros in Common Lisp, which let you extend the syntax. This might be able to acheive what you are looking for, but until you state what it is exactly you're looking for, I can't really elaborate.
Also OCaml and its related languages allow you to do some pretty cool things with types. You can basically define any kind of type you can think of and then match against it with pattern matching, which makes it especially good to write compilers in.
Javascript, Ruby, and Smalltalk, just that i know of, allow you to do all kinds of stuff, even redefining on the fly what an Object can do. Perl allows you to redefine practically the whole language. Basically any decent scripting language, especially one that allows duck typing, should have equal power. But it seems to be really common among functional languages and those with functional abilities.
If I remember correctly, Ada have neat type-creation possibilities, specially for measures (for instance, defining a minimum and a maximum, checking operations between differents measures...). I've seen it quoted as an example to avoid very stupid bugs.

How to Describe "Use case Diagram" in formal style? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How to Describe "Use case Diagram" in formal style?
Anyone have template ?
If you mean by "describe a use case diagram" describing each use case individually, there is a "procedure" in RUP methodology.
CASE tools like Enterprise Architect or MagicDraw support it by built-in forms for specifying preconditions (what must be fulfilled before the use case takes place), postconditions (what is fulfilled after taking place) and scenarios (what is particular flow of events or actions, and it alternatives) etc.
But if you are serious about describing your use case, filling all its details into those tiny forms is quite uncomfortable and not-providing-easy-survey. You may produce a .rtf generated by the tool from your use case model (providing a template already present in the tools, usually not very good-looking:).
Another way (and my preferred) is describing use cases in a separate Word document by hand (and paste the use case diagram into it). This guy wrote an amazing book "Writing effective use cases". I personally recommend it to everyone coping with use cases in his every day job. Here you can find a "compressed" guidelines extracted from the book.
I believe most of the UML drawing packages will have templates for UC diagram. For example see "dia" or eclipse with modelling framework
Other non-free tools include MS visio, MagicDraw and so many more

C## -- with two pound signs? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 13 years ago.
Visual Basic .NET
C##
etc
C#? With two pound signs?
It's on so many of these programming résumés we're getting -- from random people -- listed as a qualification.
Any ideas what these folks are talking about? Is this convention an accidental holdover from C++, or something?
EDIT/ANSWER: Turns out the corporate résumé management system converts the "C#" that applicants specify to "C##". That is just fantastic.
My guess is you shouldn't hire them.
Looks like a recruiter who doesn't know what he is talking about is trying to impress you.
That résumé speaks for itself - little attention to detail. Not good for a programmer...
If it's on "so many" I'm willing to bet that the candidates don't know what they are talking about. Similarly, I have seen 'C+' listed as a language as well.
It's not uncommon for people to list as many languages on their resume as they can, because the Bad Ones think that even knowing the name of the language gives them a foot ahead of someone who doesn't. This is obviously a flaw in logic.
I can't remember exactly where I heard this story before (someone's blog, maybe someone will remember) but the exact situation is described. A candidate comes in with a resume listing all of these languages. As the interviewer asks the candidate to demonstrate their knowledge of the language by writing some code, the candidate freezes. When the interviewer asks why, the candidate responds with "I didn't say I knew how to write in those languages, just that I know of them!"
I received a resume before has this line in the list of experiences
C \ C+ \ C++ \ C#
:)
C Sharp - now even sharper!

Am I the only one who makes spelling and grammar mistakes when programming? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 13 years ago.
I don't know if I am a bad programmer because I often make mistakes when outputting information on a site, things like "thanx for subscribing to our service" instead of "Thanks for subscribing to our service".
I think this is because I usually don't concentrate on the spelling, my main focus is to get the functionality running perfectly. Please give me your opinion, do you concentrate on the spellings or the functionality?
If I'm writing a message which will be visible to users, I'll make sure it's clear and correct. If I'm writing a message which will only be visible to other developers, I'm slightly less careful - in particular, typos aren't really a problem, so long as I express myself clearly.
Fortunately my spelling/typing/grammar is reasonably good anyway, so I don't need to think too hard about this, but I think it is important for customer-facing text.
Developers often aren't very good at writing messages for users. It can be hard to put yourself in the position of someone who really has no idea about what's going on in the background: they just want to get their email (or whatever it is) working. If you're lucky, you may be able to get a technical writer to help compose appropriate text.
IMO attention must be paid to both. Cool logic and reliability are no excuse for crappy texts.
You could separate checking the resource from changing the source. When you do changes first change the code, test everything, then proofread the resources.
The CTO at my last job was dyslexic, and a completely brilliant programmer and manager. Every now and then I would go and make a spelling correction to one of his method or variable names (C# handles the refactoring pretty well) and it didn't really matter that much.
When there's user interface work it's much more important to spell things correctly coz it looks very shabby to have a misspelled UI.

Resources