我正在使用Z3来提取不可满足的配方的不饱和核心.我正在使用Z3 @Rise界面(基于Web)编写以下代码,
(set-logic QF_LIA)
(set-option :produce-unsat-cores true)
(declare-fun ph1 () Int)
(declare-fun ph1p () Int)
(declare-fun ph3 () Int)
(declare-fun ph3p () Int)
(declare-fun ph4 () Int)
(declare-fun ph4p () Int)
(define-fun one () Bool (= ph3p (+ ph1 1)))
(define-fun two () Bool (= ph3 (+ ph1 1)))
(define-fun three () Bool (= ph1p (+ ph1 1)))
(define-fun four () Bool (= ph4p (+ ph1p 1)))
(define-fun five () Bool (>= ph1 0))
(define-fun six () Bool (>= ph4 …Run Code Online (Sandbox Code Playgroud) 我有自己的国际象棋引擎使用minimax算法搜索国际象棋移动的问题我使用5层深度搜索并且只有材料/奖励/移动性评估,但它也会使愚蠢的动作和牺牲有价值的棋子,即使我给他们无限(这肯定是一个搜索问题),我没有使用任何类型的修剪,并在几秒钟内提供5深度搜索结果.
我坚持这个问题一个星期,我确定问题是回溯而不是国际象棋逻辑(因此任何没有国际象棋背景的人都会解决这个:))我搜索了很多这是我在Stack Overflow中的第一个问题我希望你们不要让我失望:)
这是简单的搜索代码
int GameControl::Evaluate(ChessBoard _B)
{
int material=0,bonus=0,mobility=0;
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
{
if(_B.Board[i][j]!=EMPTY)
{
if(_B.Board[i][j]->pieceColor==WHITE){
material+=-_B.Board[i][j]->Weight;
bonus+=-_B.Board[i][j]->bonusPosition[i][j];
mobility+=-_B.Board[i][j]->getPossibleMovesList(i,j,B).size();
}
else {
material+=_B.Board[i][j]->Weight;
bonus+=_B.Board[i][j]->bonusPosition[i][j];
mobility+=_B.Board[i][j]->getPossibleMovesList(i,j,B).size();
}
}
}
return material+bonus/10+mobility/20;
}
pair<pair<int,int>,pair<int,int>> GameControl::minimax( int depth , ChessBoard _B )
{
short int i,j;
int bestValue = -INFINITY;
pair<pair<int,int>,pair<int,int>> bestMove;
vector< pair<int,int> > ::iterator it;
vector< pair<int,int> > Z;
for( i = 0; i < 8; i++ )
for( j = 0; j < 8; j++ )
{
if(_B.Board[i][j]!=EMPTY …Run Code Online (Sandbox Code Playgroud) 我刚开始学习C编程.在我的书中有这段代码:
/*Code Start*/
/*This code is use to find the simple interest*/
main ()
{
int p, n;
float r, si;
p = 1000;
n = 3;
r = 8.5;
si= p*n*r/100;
printf("%f", si);
}
/*Code end*/
Run Code Online (Sandbox Code Playgroud)
我得到的输出是"255.000000"
我虽然我会用scanf函数修改它所以我写了这个:
/*Code Start*/
main ()
{
int p, n;
float r, si;
printf("Enter value for p: \n");
scanf("%d", &p);
printf("Enter value for n: \n\n");
scanf("%d", &n);
printf("Enter valuse for r: \n\n");
scanf("%d", &r);
si= p*n*r/100;
printf("\nYour Simple Interest is %f\n\n", si);
} …Run Code Online (Sandbox Code Playgroud) 我试图在MATLAB中使用remez交换算法找到正弦和余弦的minimax多项式近似.因为我正在实现IEEE-754浮点的正弦和余弦函数,所以需要精度到23位.
在这里使用此链接(参见第8页到第15页),给出了使用Mathematica和Maple查找多项式的指令,但是,我不确定如何为MATLAB推断这些方法.
根据表3,我需要使用5阶或6阶多项式来获得~23位(小数点后)的精度.
我计划首先将所有输入θ的范围缩小到-pi/4到+ pi/4之间,然后根据需要执行正弦或余弦函数(最终目标是实现exp(i*x)= cos( x)+ i*sin(x).
我也许可以自己遵循本文的说明,但我不知道如何在这里使用remez函数.另外,我不遵循为什么作者使用等式(6)(第9页),也不理解k的等式(第11页)是如何确定的(2796201来自哪里?)为什么定义我们希望最终改变为sin9x的多项式的形式= x + kx ^ 3 + x ^ 5*P(x ^ 2).
是否更好地使用firpm函数(因为remez已被弃用)?
谢谢,非常感谢所有帮助和指导,以及编辑,以确保我的问题可能得到最好的答案.
backtracking ×1
c ×1
c++ ×1
chess ×1
core ×1
math ×1
matlab ×1
minimax ×1
sat-solvers ×1
smt ×1
trigonometry ×1
z3 ×1