Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
a48811ca
Commit
a48811ca
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
Selectable cost-model using the --costmodel option, yet to define multiple cost models
parent
ed115bf5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/leon/synthesis/CostModel.scala
+5
-1
5 additions, 1 deletion
src/main/scala/leon/synthesis/CostModel.scala
src/main/scala/leon/synthesis/SynthesisPhase.scala
+8
-0
8 additions, 0 deletions
src/main/scala/leon/synthesis/SynthesisPhase.scala
with
13 additions
and
1 deletion
src/main/scala/leon/synthesis/CostModel.scala
+
5
−
1
View file @
a48811ca
...
@@ -6,12 +6,16 @@ import purescala.TreeOps._
...
@@ -6,12 +6,16 @@ import purescala.TreeOps._
import
synthesis.search.Cost
import
synthesis.search.Cost
abstract
class
CostModel
(
name
:
String
)
{
abstract
class
CostModel
(
val
name
:
String
)
{
def
solutionCost
(
s
:
Solution
)
:
Cost
def
solutionCost
(
s
:
Solution
)
:
Cost
def
problemCost
(
p
:
Problem
)
:
Cost
def
problemCost
(
p
:
Problem
)
:
Cost
def
ruleAppCost
(
r
:
Rule
,
app
:
RuleApplication
)
:
Cost
def
ruleAppCost
(
r
:
Rule
,
app
:
RuleApplication
)
:
Cost
}
}
object
CostModel
{
def
all
:
Set
[
CostModel
]
=
Set
(
NaiveCostModel
)
}
case
object
NaiveCostModel
extends
CostModel
(
"Naive"
)
{
case
object
NaiveCostModel
extends
CostModel
(
"Naive"
)
{
def
solutionCost
(
s
:
Solution
)
:
Cost
=
new
Cost
{
def
solutionCost
(
s
:
Solution
)
:
Cost
=
new
Cost
{
val
value
=
{
val
value
=
{
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/synthesis/SynthesisPhase.scala
+
8
−
0
View file @
a48811ca
...
@@ -19,6 +19,7 @@ object SynthesisPhase extends LeonPhase[Program, Program] {
...
@@ -19,6 +19,7 @@ object SynthesisPhase extends LeonPhase[Program, Program] {
LeonFlagOptionDef
(
"derivtrees"
,
"--derivtrees"
,
"Generate derivation trees"
),
LeonFlagOptionDef
(
"derivtrees"
,
"--derivtrees"
,
"Generate derivation trees"
),
LeonFlagOptionDef
(
"firstonly"
,
"--firstonly"
,
"Stop as soon as one synthesis solution is found"
),
LeonFlagOptionDef
(
"firstonly"
,
"--firstonly"
,
"Stop as soon as one synthesis solution is found"
),
LeonValueOptionDef
(
"timeout"
,
"--timeout=T"
,
"Timeout after T seconds when searching for synthesis solutions .."
),
LeonValueOptionDef
(
"timeout"
,
"--timeout=T"
,
"Timeout after T seconds when searching for synthesis solutions .."
),
LeonValueOptionDef
(
"costmodel"
,
"--costmodel=cm"
,
"Use a specific cost model for this search"
),
LeonValueOptionDef
(
"functions"
,
"--functions=f1:f2"
,
"Limit synthesis of choose found within f1,f2,.."
)
LeonValueOptionDef
(
"functions"
,
"--functions=f1:f2"
,
"Limit synthesis of choose found within f1,f2,.."
)
)
)
...
@@ -39,6 +40,13 @@ object SynthesisPhase extends LeonPhase[Program, Program] {
...
@@ -39,6 +40,13 @@ object SynthesisPhase extends LeonPhase[Program, Program] {
inPlace
=
true
inPlace
=
true
case
LeonValueOption
(
"functions"
,
ListValue
(
fs
))
=>
case
LeonValueOption
(
"functions"
,
ListValue
(
fs
))
=>
options
=
options
.
copy
(
filterFuns
=
Some
(
fs
.
toSet
))
options
=
options
.
copy
(
filterFuns
=
Some
(
fs
.
toSet
))
case
LeonValueOption
(
"costmodel"
,
cm
)
=>
CostModel
.
all
.
find
(
_
.
name
.
toLowerCase
==
cm
.
toLowerCase
)
match
{
case
Some
(
model
)
=>
options
=
options
.
copy
(
costModel
=
model
)
case
None
=>
ctx
.
reporter
.
fatalError
(
"Unknown cost model: "
+
cm
)
}
case
LeonValueOption
(
"timeout"
,
t
)
=>
case
LeonValueOption
(
"timeout"
,
t
)
=>
try
{
try
{
options
=
options
.
copy
(
timeoutMs
=
Some
(
t
.
toLong
))
options
=
options
.
copy
(
timeoutMs
=
Some
(
t
.
toLong
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment