Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
f9914988
Commit
f9914988
authored
Sep 03, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to minimize_assumptions.
parent
f77af1a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
src/sat/bsat/satSolver.c
+22
-7
No files found.
src/sat/bsat/satSolver.c
View file @
f9914988
...
@@ -2191,16 +2191,13 @@ int sat_solver_solve_lexsat( sat_solver* s, int * pLits, int nLits )
...
@@ -2191,16 +2191,13 @@ int sat_solver_solve_lexsat( sat_solver* s, int * pLits, int nLits )
// of assumptions after minimization. The set of assumptions is returned in pLits.
// of assumptions after minimization. The set of assumptions is returned in pLits.
int
sat_solver_minimize_assumptions
(
sat_solver
*
s
,
int
*
pLits
,
int
nLits
,
int
nConfLimit
)
int
sat_solver_minimize_assumptions
(
sat_solver
*
s
,
int
*
pLits
,
int
nLits
,
int
nConfLimit
)
{
{
int
i
,
k
,
nLitsL
,
nLitsR
,
nResL
,
nResR
;
int
i
,
k
,
nLitsL
,
nLitsR
,
nResL
,
nResR
,
status
;
if
(
nLits
==
1
)
if
(
nLits
==
1
)
{
{
// since the problem is UNSAT, we will try to solve it without assuming the last literal
// since the problem is UNSAT, we will try to solve it without assuming the last literal
// if the result is UNSAT, the last literal can be dropped; otherwise, it is needed
// if the result is UNSAT, the last literal can be dropped; otherwise, it is needed
int
status
=
l_False
;
if
(
nConfLimit
)
s
->
nConfLimit
=
s
->
stats
.
conflicts
+
nConfLimit
;
int
Temp
=
s
->
nConfLimit
;
s
->
nConfLimit
=
nConfLimit
;
status
=
sat_solver_solve_internal
(
s
);
status
=
sat_solver_solve_internal
(
s
);
s
->
nConfLimit
=
Temp
;
//printf( "%c", status == l_False ? 'u' : 's' );
//printf( "%c", status == l_False ? 'u' : 's' );
return
(
int
)(
status
!=
l_False
);
// return 1 if the problem is not UNSAT
return
(
int
)(
status
!=
l_False
);
// return 1 if the problem is not UNSAT
}
}
...
@@ -2215,8 +2212,17 @@ int sat_solver_minimize_assumptions( sat_solver* s, int * pLits, int nLits, int
...
@@ -2215,8 +2212,17 @@ int sat_solver_minimize_assumptions( sat_solver* s, int * pLits, int nLits, int
sat_solver_pop
(
s
);
sat_solver_pop
(
s
);
return
sat_solver_minimize_assumptions
(
s
,
pLits
,
i
+
1
,
nConfLimit
);
return
sat_solver_minimize_assumptions
(
s
,
pLits
,
i
+
1
,
nConfLimit
);
}
}
// solve with these assumptions
if
(
nConfLimit
)
s
->
nConfLimit
=
s
->
stats
.
conflicts
+
nConfLimit
;
status
=
sat_solver_solve_internal
(
s
);
if
(
status
==
l_False
)
// these are enough
{
for
(
i
=
0
;
i
<
nLitsL
;
i
++
)
sat_solver_pop
(
s
);
return
sat_solver_minimize_assumptions
(
s
,
pLits
,
nLitsL
,
nConfLimit
);
}
// solve for the right lits
// solve for the right lits
nResL
=
sat_solver_minimize_assumptions
(
s
,
pLits
+
nLitsL
,
nLitsR
,
nConfLimit
);
nResL
=
nLitsR
==
1
?
1
:
sat_solver_minimize_assumptions
(
s
,
pLits
+
nLitsL
,
nLitsR
,
nConfLimit
);
for
(
i
=
0
;
i
<
nLitsL
;
i
++
)
for
(
i
=
0
;
i
<
nLitsL
;
i
++
)
sat_solver_pop
(
s
);
sat_solver_pop
(
s
);
// swap literals
// swap literals
...
@@ -2238,8 +2244,17 @@ int sat_solver_minimize_assumptions( sat_solver* s, int * pLits, int nLits, int
...
@@ -2238,8 +2244,17 @@ int sat_solver_minimize_assumptions( sat_solver* s, int * pLits, int nLits, int
sat_solver_pop
(
s
);
sat_solver_pop
(
s
);
return
sat_solver_minimize_assumptions
(
s
,
pLits
,
i
+
1
,
nConfLimit
);
return
sat_solver_minimize_assumptions
(
s
,
pLits
,
i
+
1
,
nConfLimit
);
}
}
// solve with these assumptions
if
(
nConfLimit
)
s
->
nConfLimit
=
s
->
stats
.
conflicts
+
nConfLimit
;
status
=
sat_solver_solve_internal
(
s
);
if
(
status
==
l_False
)
// these are enough
{
for
(
i
=
0
;
i
<
nResL
;
i
++
)
sat_solver_pop
(
s
);
return
nResL
;
}
// solve for the left lits
// solve for the left lits
nResR
=
sat_solver_minimize_assumptions
(
s
,
pLits
+
nResL
,
nLitsL
,
nConfLimit
);
nResR
=
nLitsL
==
1
?
1
:
sat_solver_minimize_assumptions
(
s
,
pLits
+
nResL
,
nLitsL
,
nConfLimit
);
for
(
i
=
0
;
i
<
nResL
;
i
++
)
for
(
i
=
0
;
i
<
nResL
;
i
++
)
sat_solver_pop
(
s
);
sat_solver_pop
(
s
);
return
nResL
+
nResR
;
return
nResL
+
nResR
;
...
...
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