answer-factory 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{answer-factory}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Tozier", "Trek Glowacki", "Jesse Sielaff"]
12
- s.date = %q{2010-05-11}
12
+ s.date = %q{2010-05-12}
13
13
  s.default_executable = %q{answer-factory}
14
14
  s.description = %q{The pragmaticgp gem provides a simple framework for building, running and managing genetic programming experiments which automatically discover algorithms and equations to solve user-defined problems.}
15
15
  s.email = %q{bill@vagueinnovation.com}
@@ -38,8 +38,8 @@ Gem::Specification.new do |s|
38
38
  "lib/machines/mutate_footnotes.rb",
39
39
  "lib/machines/select_nondominated.rb",
40
40
  "readme.md",
41
- "spec/answer_spec.rb",
42
- "spec/batch_spec.rb",
41
+ "spec/answers/answer_spec.rb",
42
+ "spec/answers/batch_spec.rb",
43
43
  "spec/factories/factory_spec.rb",
44
44
  "spec/factories/workstation_spec.rb",
45
45
  "spec/integration_specs/couch_db_integration.rspec",
@@ -61,8 +61,8 @@ Gem::Specification.new do |s|
61
61
  s.rubygems_version = %q{1.3.6}
62
62
  s.summary = %q{Genetic Programming in the Nudge language}
63
63
  s.test_files = [
64
- "spec/answer_spec.rb",
65
- "spec/batch_spec.rb",
64
+ "spec/answers/answer_spec.rb",
65
+ "spec/answers/batch_spec.rb",
66
66
  "spec/factories/factory_spec.rb",
67
67
  "spec/factories/workstation_spec.rb",
68
68
  "spec/machines/any_one_spec.rb",
data/readme.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  ## Caveat
4
4
 
5
- **DO NOT EXPECT ANYTHING TO WORK (AT ALL) UNTIL VERSION 0.1+**
6
- This particular project is undergoing a lot of serious surgery right now.
5
+ **THIS IS A PROJECT IN RAPID TRANSITION**
6
+ We're doing a lot of serious surgery right now (May 2010), and adding a lot of functionality very quickly.
7
7
 
8
8
  ## What it does
9
9
 
@@ -11,9 +11,12 @@ The answer-factory gem includes scripting support for
11
11
 
12
12
  * generating new design automation projects
13
13
  * Nudge, a Turing-complete programming language for readable genetic programming
14
- * standard genetic programming search operators
15
- * a standard suite of powerful metaheuristics
14
+ * some standard genetic programming search operators
15
+ * a standard suite of powerful metaheuristic tools
16
16
  * full automated archiving of all solutions
17
+
18
+ and is introducing
19
+
17
20
  * analytics and reporting
18
21
  * administrative tools for managing AnswerFactory daemons
19
22
  * reporting tools for exploring and directing search
@@ -34,15 +37,18 @@ This will automatically install several dependencies, including [nudge](http://g
34
37
  ### Creating a new AnswerFactory project
35
38
 
36
39
  Use this command line script to build an AnswerFactory project folder:
40
+
37
41
  answer-factory your-project-name-here
38
42
 
39
- This will create a new directory called 'your-project-name-here', and install a rudimentary subtree of folders and files. Perhaps most important is the `Thorfile`, which contains most of the generators you can use to simplify project creation and management.
43
+ This will create a new directory called 'your-project-name-here' (in your current working directory), and install a rudimentary subtree of folders and files. Perhaps most important is `activate.rb`, which includes both configuration information and some examples of how to proceed.
40
44
 
41
- ### Replicating a pre-existing project or demo
42
45
 
43
- TBD
46
+ ### Activating the AnswerFactory daemon
47
+
48
+ Make sure CouchDB is running and available, navigate to your project's root folder, and invoke
49
+ ruby activate.rb
44
50
 
45
- ### Generating new Nudge type defintitions
51
+ ### Generating new Nudge type definitions
46
52
 
47
53
  The Nudge language gem installed along with `answer-factory` includes a full-featured programming language designed for genetic programming projects, with integer, floating-point, boolean, and code types.
48
54
 
@@ -50,7 +56,8 @@ Often your project's domain model will call for additional types. To generate so
50
56
  thor new_nudge_type your-nudge-type-name
51
57
  This will create a template for your class definition in the `/lib/nudge/types` subdirectory (which you should edit as indicated in the comments to use), several standard nudge instruction classes in `/lib/nudge/instructions`, and rspec files.
52
58
 
53
- ### Activating the AnswerFactory daemon
59
+ ### Replicating a pre-existing project or demo
60
+
61
+ TBD
62
+
54
63
 
55
- Make sure CouchDB is running and available, navigate to your project's root folder, and invoke
56
- ruby activate.rb
@@ -1,5 +1,5 @@
1
1
  #encoding: utf-8
2
- require File.join(File.dirname(__FILE__), "spec_helper")
2
+ require File.join(File.dirname(__FILE__), "../spec_helper")
3
3
 
4
4
  describe "Answer" do
5
5
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "./spec_helper")
1
+ require File.join(File.dirname(__FILE__), "../spec_helper")
2
2
 
3
3
  describe "Batches" do
4
4
  it "should be a kind of Array" do
@@ -100,7 +100,11 @@ describe "Batches" do
100
100
  # because it hit the right URI!
101
101
  end
102
102
 
103
- it "should handle errors returned from CouchDB"
103
+ describe "error-handling" do
104
+ it "should handle errors returned from CouchDB"
105
+
106
+ it "should handle 'resource not found'"
107
+ end
104
108
 
105
109
  it "should handle db connection problems"
106
110
 
@@ -140,7 +140,7 @@ describe "Factory" do
140
140
  FakeWeb.allow_net_connect = false
141
141
  end
142
142
 
143
- it "should have a method to check that couchDB is accessible" do
143
+ it "should be a method of Factory" do
144
144
  f1 = Factory.new(name:"boo")
145
145
  lambda{Factory.couch_available?}.should_not raise_error
146
146
  end
@@ -163,6 +163,24 @@ describe "Factory" do
163
163
  Factory.couch_available?.should == false
164
164
  end
165
165
  end
166
+
167
+ describe "#couch_delete!" do
168
+ before(:each) do
169
+ FakeWeb.allow_net_connect = false
170
+ end
171
+
172
+ it "should send the couch command to delete the db"
173
+
174
+ it "should require authorization"
175
+ end
176
+
177
+ describe "authorization" do
178
+ it "should be necessary to set up an admin account in couch"
179
+
180
+ it "should not be possible to write to a factory's db without authenticating"
181
+
182
+ it "should raise an error if authentication fails"
183
+ end
166
184
  end
167
185
 
168
186
 
@@ -184,5 +202,24 @@ describe "Factory" do
184
202
  it "should replace 'configatron.[workstation_name].[settings]' for each workstation"
185
203
  end
186
204
  end
205
+
206
+
207
+ describe "Factory state persistence" do
208
+ describe "configuration" do
209
+ it "should record configatron settings in a special couch document"
210
+
211
+ it "should read from the special couch config docs"
212
+
213
+ it "should read from the config doc upon startup"
214
+
215
+ it "should read from the config doc every N steps, 'N' being a config"
216
+ end
217
+
218
+ describe "logging basic events" do
219
+ it "should generate log documents for launch"
220
+
221
+ it "should generate log documents for changes in config state during a run"
222
+ end
223
+ end
187
224
  end
188
225
  end
@@ -56,8 +56,7 @@ class VariationStation < Workstation
56
56
 
57
57
  def initialize(name, options = {})
58
58
  super
59
- @mutator = Machines::MutateFootnotesUniform.new(
60
- )
59
+ @mutator = Machines::MutateFootnotesUniform.new
61
60
  @score_1 = Machines::EvaluateSimpleScore.new(
62
61
  :name => :number_of_footnotes,
63
62
  scorer:Proc.new {|a| a.blueprint.scan(/^«/).length})
@@ -76,16 +75,13 @@ class VariationStation < Workstation
76
75
  end
77
76
 
78
77
  def ship!
79
- ship_to(:picker) {|answer| true}
78
+ ship_to(:picker) {|answer| rand < 0.25}
79
+ puts "POLISHER SHIP: kept #{@answers.find_all {|a| a.location == :polisher}.length}"
80
80
  end
81
81
 
82
82
  def scrap!
83
- best_score = (@answers.collect {|a| a.scores[:number_of_footnotes]}).min
84
- worst_score = (@answers.collect {|a| a.scores[:number_of_footnotes]}).max
85
- puts "#{worst_score}..#{best_score}"
86
- scrap_if("too many footnotes") {|a| a.scores[:number_of_footnotes] >
87
- ((worst_score - best_score)/2.0 + best_score)}
88
- puts "PICKER SCRAP: kept #{@answers.find_all {|a| a.location == :polisher}.length}"
83
+ scrap_if("contains 'oo'") {|a| a.blueprint.include? 'oo'}
84
+ puts "POLISHER SCRAP: kept #{@answers.find_all {|a| a.location == :polisher}.length}"
89
85
  end
90
86
  end
91
87
 
@@ -109,12 +105,12 @@ class ScreeningStation < Workstation
109
105
  def build!
110
106
  @answers = process_with @letters
111
107
  @best = process_with @so_far_so_good
112
- puts "PICKER EVERYTHING: #{@answers.length}"
108
+ puts "----------"
109
+ puts "PICKER HAS THESE: #{@answers.length}"
113
110
  @answers.each {|a| puts a.scores}
114
111
  puts "----------"
115
112
  puts "PICKER NONDOMINATED SET: #{@best.length}"
116
- @best.each {|a| puts a.scores}
117
-
113
+ @best.each {|a| puts "#{a.couch_id}: #{a.scores}"}
118
114
  end
119
115
 
120
116
  def scrap!
@@ -124,6 +120,14 @@ class ScreeningStation < Workstation
124
120
  end
125
121
 
126
122
 
123
+ ##### this will soon be an attribute of the Factory, and saved as persistent config data
124
+ # but it's the components of your Factory instance, each of which will be sent a #cycle! message,
125
+ # in this order, by the launch code below
126
+ workstations =[
127
+ GenerationStation.new(:maker),
128
+ VariationStation.new(:polisher),
129
+ ScreeningStation.new(:picker)]
130
+
127
131
 
128
132
  ####
129
133
  ####
@@ -146,10 +150,6 @@ Dir.glob(File.dirname(__FILE__) + configatron.project.workstations.path) {|file|
146
150
  ### these should get tucked away elsewhere:
147
151
 
148
152
  project = Factory.new()
149
- workstations =[
150
- GenerationStation.new(:maker),
151
- VariationStation.new(:polisher),
152
- ScreeningStation.new(:picker)]
153
153
 
154
154
  # reset database
155
155
  db = CouchRest.database!("#{configatron.factory.couchdb.server}/#{configatron.factory.name}")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bill Tozier
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-05-11 00:00:00 -04:00
19
+ date: 2010-05-12 00:00:00 -04:00
20
20
  default_executable: answer-factory
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -142,8 +142,8 @@ files:
142
142
  - lib/machines/mutate_footnotes.rb
143
143
  - lib/machines/select_nondominated.rb
144
144
  - readme.md
145
- - spec/answer_spec.rb
146
- - spec/batch_spec.rb
145
+ - spec/answers/answer_spec.rb
146
+ - spec/answers/batch_spec.rb
147
147
  - spec/factories/factory_spec.rb
148
148
  - spec/factories/workstation_spec.rb
149
149
  - spec/integration_specs/couch_db_integration.rspec
@@ -190,8 +190,8 @@ signing_key:
190
190
  specification_version: 3
191
191
  summary: Genetic Programming in the Nudge language
192
192
  test_files:
193
- - spec/answer_spec.rb
194
- - spec/batch_spec.rb
193
+ - spec/answers/answer_spec.rb
194
+ - spec/answers/batch_spec.rb
195
195
  - spec/factories/factory_spec.rb
196
196
  - spec/factories/workstation_spec.rb
197
197
  - spec/machines/any_one_spec.rb