Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kučera Petr RNDr. Ph.D.
PCCompile
Commits
ca6472d9
Commit
ca6472d9
authored
Sep 01, 2021
by
Kučera Petr RNDr. Ph.D.
Browse files
pccompile empowerement options
parent
79b98ea8
Changes
6
Hide whitespace changes
Inline
Side-by-side
bin/pccheck.cpp
View file @
ca6472d9
...
...
@@ -93,9 +93,9 @@ dump_config(const config_t &conf, unsigned level)
<<
"
\t
encode_only: "
<<
SUBool
::
bool_to_string
(
conf
.
encode_only
)
<<
std
::
endl
;
SUBool
::
logs
.
DumpValue
(
"
\t
"
,
level
,
"no_up_backbones"
,
conf
.
no_up_backbones
);
SUBool
::
logs
.
TLog
(
level
)
<<
"
\t
up_empower: "
<<
static_cast
<
unsigned
>
(
conf
.
up_empower
)
<<
std
::
endl
;
SUBool
::
PCEncoder
::
kUPEmpowerAnnotation
.
DumpValue
(
"
\t
"
,
level
,
"up_empower"
,
conf
.
up_empower
)
;
SUBool
::
logs
.
TLog
(
level
)
<<
"
\t
enc_conf:"
<<
std
::
endl
;
conf
.
enc_conf
.
Dump
(
"
\t\t
"
,
level
);
SUBool
::
logs
.
TLog
(
level
)
...
...
bin/pccompile.cpp
View file @
ca6472d9
...
...
@@ -108,9 +108,8 @@ dump_config(const config_t &conf, unsigned level)
"
\t
"
,
level
,
"minimize_method"
,
conf
.
comp_base_config
.
minimize_method
);
SUBool
::
PCCompAlgorithmOptions
::
kAlgorithmAnnotation
.
DumpValue
(
"
\t
"
,
level
,
"algorithm"
,
conf
.
algorithm
);
SUBool
::
logs
.
TLog
(
level
)
<<
"
\t
comp_base_config.up_empower: "
<<
static_cast
<
unsigned
>
(
conf
.
comp_base_config
.
up_empower
)
<<
std
::
endl
;
SUBool
::
PCEncoder
::
kUPEmpowerAnnotation
.
DumpValue
(
"
\t
"
,
level
,
"comp_base_config.up_empower"
,
conf
.
comp_base_config
.
up_empower
);
SUBool
::
logs
.
TLog
(
level
)
<<
"
\t
comp_base_config.simp_steps: "
<<
conf
.
comp_base_config
.
simp_steps
<<
(
conf
.
comp_base_config
.
simp_steps
>
0
...
...
@@ -206,6 +205,7 @@ parse_arguments(int argc, char *argv[], config_t &conf)
auto
preprocess_opts
=
opts
.
MakeOptionsGroup
<
SUBool
::
PCCompPreprocessOptions
>
();
auto
solver_opts
=
opts
.
MakeOptionsGroup
<
SUBool
::
PCSolverOptions
>
();
auto
empower_opts
=
opts
.
MakeOptionsGroup
<
SUBool
::
PCEmpowerOptions
>
();
if
(
!
opts
.
Parse
(
argc
,
argv
))
{
return
1
;
...
...
@@ -219,6 +219,7 @@ parse_arguments(int argc, char *argv[], config_t &conf)
conf
.
comp_base_config
.
propagate_backbones
=
!
preprocess_opts
->
NoBackbonePropagation
();
conf
.
comp_base_config
.
solver_type
=
solver_opts
->
SolverType
();
conf
.
comp_base_config
.
up_empower
=
empower_opts
->
Empower
();
return
0
;
#if 0
try
...
...
lib/pc_opt.cpp
View file @
ca6472d9
...
...
@@ -105,3 +105,17 @@ SUBool::PCSolverOptions::GetValues()
{
return
mSolverTypeOption
.
GetValue
(
mSolverType
);
}
SUBool
::
PCEmpowerOptions
::
PCEmpowerOptions
()
:
OptionsGroup
(
"Empowerment Encoding"
),
mEmpowerOption
(
PCEncoder
::
kUPEmpowerAnnotation
,
"empower,w"
,
"Encoding used to encode empowerment."
,
kDefaultEmpower
)
{
Add
(
mEmpowerOption
);
}
bool
SUBool
::
PCEmpowerOptions
::
GetValues
()
{
return
mEmpowerOption
.
GetValue
(
mEmpower
);
}
lib/pc_opt.h
View file @
ca6472d9
...
...
@@ -106,6 +106,25 @@ namespace SUBool
SOLVER_TYPE
SolverType
()
const
;
};
// Empowerement
class
PCEmpowerOptions
:
public
OptionsGroup
{
public:
static
const
PCEncoder
::
UP_EMPOWER
kDefaultEmpower
=
PCEncoder
::
UP_EMPOWER
::
ONE_LEVEL
;
private:
EnumOption
<
PCEncoder
::
UP_EMPOWER
>
mEmpowerOption
;
PCEncoder
::
UP_EMPOWER
mEmpower
{
kDefaultEmpower
};
public:
PCEmpowerOptions
();
virtual
bool
GetValues
()
override
;
PCEncoder
::
UP_EMPOWER
Empower
()
const
;
};
}
// namespace SUBool
inline
auto
...
...
@@ -145,4 +164,10 @@ SUBool::PCSolverOptions::SolverType() const
return
mSolverType
;
}
inline
SUBool
::
PCEncoder
::
UP_EMPOWER
SUBool
::
PCEmpowerOptions
::
Empower
()
const
{
return
mEmpower
;
}
#endif
lib/pcenc.cpp
View file @
ca6472d9
...
...
@@ -21,6 +21,17 @@
// On only for debugging
//#define ONLY_UP_ONE_PROVE
const
SUBool
::
EnumAnnotation
<
SUBool
::
PCEncoder
::
UP_EMPOWER
>
SUBool
::
PCEncoder
::
kUPEmpowerAnnotation
(
"UP_EMPOWER"
,
{
//
{
UP_EMPOWER
::
QUADRATIC_EQUIV
,
"quadratic_equiv"
,
"quadratic size encoding with equivalences"
},
//
{
UP_EMPOWER
::
QUADRATIC_ONE_SIDED
,
"quadratic_one_sided"
,
"quadratic size encoding with implications"
},
//
{
UP_EMPOWER
::
ONE_LEVEL
,
"one_level"
,
"one level encoding"
},
//
});
SUBool
::
PCEncoder
::
PCEncoder
(
const
Config
&
conf
)
:
AbsEncoder
(
conf
),
mConf
(
conf
),
mOneProveInputs
(),
mOneProveOutputs
(),
mEmpowerInputs
(),
mEmpowerOutputs
(),
mSelectionLits
(),
...
...
lib/pcenc.h
View file @
ca6472d9
...
...
@@ -16,6 +16,7 @@
#include "absenc.h"
#include "cl2lit.h"
#include "enum.h"
#include "glucose_bind.h"
#include "normalform.h"
#include "upenc.h"
...
...
@@ -30,10 +31,11 @@ namespace SUBool
{
QUADRATIC_EQUIV
,
QUADRATIC_ONE_SIDED
,
ONE_LEVEL
,
Last
=
ONE_LEVEL
ONE_LEVEL
};
static
const
EnumAnnotation
<
UP_EMPOWER
>
kUPEmpowerAnnotation
;
struct
Config
:
AbsConfig
{
UP_EMPOWER
up_empower
=
UP_EMPOWER
::
ONE_LEVEL
;
...
...
@@ -53,13 +55,13 @@ namespace SUBool
std
::
vector
<
Literal
>
mSelectionLits
;
virtual
void
AddClauses
(
const
CNF
&
cnf
,
const
ClausesToLiterals
&
cl2lit
,
const
LitImplSystem
&
impl_system
)
override
;
const
LitImplSystem
&
impl_system
)
override
;
unsigned
NewAuxVar
(
const
std
::
string
&
name
);
unsigned
NewAuxComparisonVar
(
const
std
::
string
&
left
,
const
std
::
string
&
right
,
unsigned
bit
);
unsigned
NewFireVar
(
unsigned
c_index
,
unsigned
c_subindex
,
const
Literal
&
lit
);
unsigned
NewAuxComparisonVar
(
const
std
::
string
&
left
,
const
std
::
string
&
right
,
unsigned
bit
);
unsigned
NewFireVar
(
unsigned
c_index
,
unsigned
c_subindex
,
const
Literal
&
lit
);
unsigned
NewFireVar
(
unsigned
c_index
,
const
Literal
&
lit
);
unsigned
EmpowerOutput
(
unsigned
i
)
const
;
...
...
@@ -92,8 +94,8 @@ namespace SUBool
void
InitEmpEncoder
(
const
CNF
&
cnf
,
const
ClausesToLiterals
&
cl2lit
);
virtual
void
WriteMappingsOfVariable
(
std
::
ostream
&
out
,
unsigned
i
)
const
override
;
virtual
void
WriteMappingsOfVariable
(
std
::
ostream
&
out
,
unsigned
i
)
const
override
;
virtual
std
::
string
Name
()
const
override
;
...
...
@@ -104,8 +106,8 @@ namespace SUBool
PCEncoder
(
const
Config
&
conf
=
Config
());
// Returns empowering variable.
virtual
unsigned
ExtractClause
(
const
SolverInterface
&
solver
,
Clause
*
clause
)
const
override
;
virtual
unsigned
ExtractClause
(
const
SolverInterface
&
solver
,
Clause
*
clause
)
const
override
;
static
UP_EMPOWER
UpEmpowerOfInt
(
unsigned
emp
);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment