-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
1230 lines (842 loc) · 26.5 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*********************************************************************
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*********************************************************************/
/*********************************************************************
* File: main.c
* Description: The main routine for the Metric-FastForward Planner.
* Modified July 2011 to allow more command-line search
* confiogurations, including improved cost-minimization
*
* Author: original version Joerg Hoffmann 2001/2002
* modified version Joerg Hoffmann 2012
*
*********************************************************************/
#include "ff.h"
#include "memory.h"
#include "output.h"
#include "parse.h"
#include "expressions.h"
#include "inst_pre.h"
#include "inst_easy.h"
#include "inst_hard.h"
#include "inst_final.h"
#include "relax.h"
#include "search.h"
/*
* ----------------------------- GLOBAL VARIABLES ----------------------------
*/
/*******************
* GENERAL HELPERS *
*******************/
/* used to time the different stages of the planner
*/
float gtempl_time = 0, greach_time = 0, grelev_time = 0, gconn_time = 0;
float gLNF_time = 0, gsearch_time = 0;
/* the command line inputs
*/
struct _command_line gcmd_line;
/* number of states that got heuristically evaluated
*/
int gevaluated_states = 0;
/* maximal depth of breadth first search
*/
int gmax_search_depth = 0;
/***********
* PARSING *
***********/
/* used for pddl parsing, flex only allows global variables
*/
int gbracket_count;
char *gproblem_name;
/* The current input line number
*/
int lineno = 1;
/* The current input filename
*/
char *gact_filename;
/* The pddl domain name
*/
char *gdomain_name = NULL;
/* loaded, uninstantiated operators
*/
PlOperator *gloaded_ops = NULL;
/* stores initials as fact_list
*/
PlNode *gorig_initial_facts = NULL;
/* not yet preprocessed goal facts
*/
PlNode *gorig_goal_facts = NULL;
/* axioms as in UCPOP before being changed to ops
*/
PlOperator *gloaded_axioms = NULL;
/* the types, as defined in the domain file
*/
TypedList *gparse_types = NULL;
/* the constants, as defined in domain file
*/
TypedList *gparse_constants = NULL;
/* the predicates and their arg types, as defined in the domain file
*/
TypedListList *gparse_predicates = NULL;
/* the functions and their arg types, as defined in the domain file
*/
TypedListList *gparse_functions = NULL;
/* the objects, declared in the problem file
*/
TypedList *gparse_objects = NULL;
/* the metric
*/
Token gparse_optimization;
ParseExpNode *gparse_metric = NULL;
/* connection to instantiation ( except ops, goal, initial )
*/
/* all typed objects
*/
FactList *gorig_constant_list = NULL;
/* the predicates and their types
*/
FactList *gpredicates_and_types = NULL;
/* the functions and their types
*/
FactList *gfunctions_and_types = NULL;
/*****************
* INSTANTIATING *
*****************/
/* global arrays of constant names,
* type names (with their constants),
* predicate names,
* predicate aritys,
* defined types of predicate args
*/
Token gconstants[MAX_CONSTANTS];
int gnum_constants = 0;
Token gtype_names[MAX_TYPES];
int gtype_consts[MAX_TYPES][MAX_TYPE];
Bool gis_member[MAX_CONSTANTS][MAX_TYPES];
int gmember_nr[MAX_CONSTANTS][MAX_TYPES];/* nr of object within a type */
int gtype_size[MAX_TYPES];
int gnum_types = 0;
Token gpredicates[MAX_PREDICATES];
int garity[MAX_PREDICATES];
Bool gaxiom_added[MAX_PREDICATES];
int gpredicates_args_type[MAX_PREDICATES][MAX_ARITY];
int gnum_predicates = 0;
Token gfunctions[MAX_FUNCTIONS];
int gf_arity[MAX_FUNCTIONS];
int gfunctions_args_type[MAX_FUNCTIONS][MAX_ARITY];
int gnum_functions = 0;
/* the domain in integer (Fact) representation
*/
Operator_pointer goperators[MAX_OPERATORS];
int gnum_operators = 0;
Fact *gfull_initial;
int gnum_full_initial = 0;
FluentValue *gfull_fluents_initial;
int gnum_full_fluents_initial = 0;
WffNode *ggoal = NULL;
ExpNode *gmetric = NULL;
/* stores inertia - information: is any occurence of the predicate
* added / deleted in the uninstantiated ops ?
*/
Bool gis_added[MAX_PREDICATES];
Bool gis_deleted[MAX_PREDICATES];
/* for functions we *might* want to say, symmetrically, whether it is
* increased resp. decreased at all.
*
* that is, however, somewhat involved because the right hand
* sides can be arbirtray expressions, so we have no guarantee
* that increasing really does adds to a functions value...
*
* thus (for the time being), we settle for "is the function changed at all?"
*/
Bool gis_changed[MAX_FUNCTIONS];
/* splitted initial state:
* initial non static facts,
* initial static facts, divided into predicates
* (will be two dimensional array, allocated directly before need)
*/
Facts *ginitial = NULL;
int gnum_initial = 0;
Fact **ginitial_predicate;
int *gnum_initial_predicate;
/* same thing for functions
*/
FluentValues *gf_initial;
int gnum_f_initial = 0;
FluentValue **ginitial_function;
int *gnum_initial_function;
/* the type numbers corresponding to any unary inertia
*/
int gtype_to_predicate[MAX_PREDICATES];
int gpredicate_to_type[MAX_TYPES];
/* (ordered) numbers of types that new type is intersection of
*/
TypeArray gintersected_types[MAX_TYPES];
int gnum_intersected_types[MAX_TYPES];
/* splitted domain: hard n easy ops
*/
Operator_pointer *ghard_operators;
int gnum_hard_operators;
NormOperator_pointer *geasy_operators;
int gnum_easy_operators;
/* so called Templates for easy ops: possible inertia constrained
* instantiation constants
*/
EasyTemplate *geasy_templates;
int gnum_easy_templates;
/* first step for hard ops: create mixed operators, with conjunctive
* precondition and arbitrary effects
*/
MixedOperator *ghard_mixed_operators;
int gnum_hard_mixed_operators;
/* hard ''templates'' : pseudo actions
*/
PseudoAction_pointer *ghard_templates;
int gnum_hard_templates;
/* store the final "relevant facts"
*/
Fact grelevant_facts[MAX_RELEVANT_FACTS];
int gnum_relevant_facts = 0;
int gnum_pp_facts = 0;
/* store the "relevant fluents"
*/
Fluent grelevant_fluents[MAX_RELEVANT_FLUENTS];
int gnum_relevant_fluents = 0;
Token grelevant_fluents_name[MAX_RELEVANT_FLUENTS];
/* this is NULL for normal, and the LNF for
* artificial fluents.
*/
LnfExpNode_pointer grelevant_fluents_lnf[MAX_RELEVANT_FLUENTS];
/* the final actions and problem representation
*/
Action *gactions = NULL;
int gnum_actions;
State ginitial_state;
int *glogic_goal = NULL;
int gnum_logic_goal = 0;
Comparator *gnumeric_goal_comp = NULL;
ExpNode_pointer *gnumeric_goal_lh = NULL, *gnumeric_goal_rh = NULL;
int gnum_numeric_goal = 0;
/* direct numeric goal access
*/
Comparator *gnumeric_goal_direct_comp;
float *gnumeric_goal_direct_c;
/* to avoid memory leaks; too complicated to identify
* the exact state of the action to throw away (during construction),
* memory gain not worth the implementation effort.
*/
Action *gtrash_actions = NULL;
/* additional lnf step between finalized inst and
* conn graph
*/
Comparator *glnf_goal_comp = NULL;
LnfExpNode_pointer *glnf_goal_lh = NULL;
float *glnf_goal_rh = NULL;
int gnum_lnf_goal = 0;
LnfExpNode glnf_metric;
Bool goptimization_established = FALSE;
/**********************
* CONNECTIVITY GRAPH *
**********************/
/* one ops (actions) array ...
*/
OpConn *gop_conn;
int gnum_op_conn;
/* one effects array ...
*/
EfConn *gef_conn;
int gnum_ef_conn;
/* one facts array.
*/
FtConn *gft_conn;
int gnum_ft_conn;
/* and: one fluents array.
*/
FlConn *gfl_conn;
int gnum_fl_conn;
int gnum_real_fl_conn;/* number of non-artificial ones */
/* final goal is also transformed one more step.
*/
int *gflogic_goal = NULL;
int gnum_flogic_goal = 0;
Comparator *gfnumeric_goal_comp = NULL;
int *gfnumeric_goal_fl = NULL;
float *gfnumeric_goal_c = NULL;
int gnum_fnumeric_goal = 0;
/* direct access (by relevant fluents)
*/
Comparator *gfnumeric_goal_direct_comp = NULL;
float *gfnumeric_goal_direct_c = NULL;
/*******************
* SEARCHING NEEDS *
*******************/
/* applicable actions
*/
int *gA;/* non-axioms */
int gnum_A;
int *gA_axioms; /* axioms */
int gnum_A_axioms;
/* communication from extract 1.P. to search engine:
* 1P action choice
*/
int *gH;
int gnum_H;
/* added cost of relaxed plan
*/
float gh_cost;
/* hmax value
*/
float ghmax;
/* to store plan
*/
int gplan_ops[MAX_PLAN_LENGTH];
int gnum_plan_ops = 0;
/* stores the states that the current plan goes through
* ( for knowing where new agenda entry starts from )
*/
State gplan_states[MAX_PLAN_LENGTH + 1];
/* dirty: multiplic. of total-time in final metric LNF
*/
float gtt;
/* the mneed structures
*/
Bool **gassign_influence;
Bool **gTassign_influence;
/* the real var input to the mneed computation.
*/
Bool *gmneed_start_D;
float *gmneed_start_V;
/* does this contain conditional effects?
* (if it does then the state hashing has to be made more
* cautiously)
*/
Bool gconditional_effects;
/* easier to question: are we optimizing or no?
*/
Bool gcost_minimizing;
/* stores current A* weight: this is initially given by user,
* but changes during anytime search.
*/
float gw;
/* this is the minimum weight, ie we'll stop once the weight update
* does/would yield a value <= this.
* if no such minim weight is given, this will be -1
*/
float gmin_w = -1;
/* this one says whether or not we are actually using
* cost-minimizing rplans.
* this will be the case by default if we're running cost-
* minimizing searches. it can be switched off by a flag;
* it is automatically switched off in case there are
* numeric preconditions/goals: for this case,
* cost-minimizing rplans are not implemented (a numeric prec
* may cause an action to come in "later" on in the RPG although
* its logical pres are easy. in that case, any new effects will
* have a smaller RPGcost value than facts we already have waiting.
* in other words, the "Dijsktra" nature breaks.
*
* ... I suppose there may be a generic solution to this that
* can handle numeric precs/goals. Doesn't seem important enough
* to bother.
*/
Bool gcost_rplans;
/*
* ----------------------------- HEADERS FOR PARSING ----------------------------
* ( fns defined in the scan-* files )
*/
void get_fct_file_name( char *filename );
void load_ops_file( char *filename );
void load_fct_file( char *filename );
/*
* ----------------------------- MAIN ROUTINE ----------------------------
*/
struct tms lstart, lend;
int main( int argc, char *argv[] )
{
/* resulting name for ops file
*/
char ops_file[MAX_LENGTH] = "";
/* same for fct file
*/
char fct_file[MAX_LENGTH] = "";
struct tms start, end;
Bool found_plan;
int i;
float cost;
Bool prev_gcost_rplans;
times ( &lstart );
/* command line treatment
*/
gcmd_line.display_info = 1;
gcmd_line.debug = 0;
/* search settings
*/
gcmd_line.search_config = 5;
gcmd_line.cost_rplans = TRUE;
gcmd_line.w = 5;
gcmd_line.cost_bound = -1;
memset(gcmd_line.ops_file_name, 0, MAX_LENGTH);
memset(gcmd_line.fct_file_name, 0, MAX_LENGTH);
memset(gcmd_line.path, 0, MAX_LENGTH);
if ( argc == 1 || ( argc == 2 && *++argv[0] == '?' ) ) {
ff_usage();
exit( 1 );
}
if ( !process_command_line( argc, argv ) ) {
ff_usage();
exit( 1 );
}
/* make file names
*/
/* one input name missing
*/
if ( !gcmd_line.ops_file_name[0] ||
!gcmd_line.fct_file_name[0] ) {
fprintf(stdout, "\nff: two input files needed\n\n");
ff_usage();
exit( 1 );
}
/* add path info, complete file names will be stored in
* ops_file and fct_file
*/
sprintf(ops_file, "%s%s", gcmd_line.path, gcmd_line.ops_file_name);
sprintf(fct_file, "%s%s", gcmd_line.path, gcmd_line.fct_file_name);
/* parse the input files
*/
/* start parse & instantiation timing
*/
times( &start );
/* domain file (ops)
*/
if ( gcmd_line.display_info >= 1 ) {
printf("\nff: parsing domain file");
}
/* it is important for the pddl language to define the domain before
* reading the problem
*/
load_ops_file( ops_file );
/* problem file (facts)
*/
if ( gcmd_line.display_info >= 1 ) {
printf(" ... done.\nff: parsing problem file");
}
load_fct_file( fct_file );
if ( gcmd_line.display_info >= 1 ) {
printf(" ... done.\n\n");
}
/* This is needed to get all types.
*/
build_orig_constant_list();
/* last step of parsing: see if it's an ADL domain!
*/
if ( !make_adl_domain() ) {
printf("\nff: this is not an ADL problem!");
printf("\n can't be handled by this version.\n\n");
exit( 1 );
}
/* now instantiate operators;
*/
/**************************
* first do PREPROCESSING *
**************************/
/* start by collecting all strings and thereby encoding
* the domain in integers.
*/
encode_domain_in_integers();
/* inertia preprocessing, first step:
* - collect inertia information
* - split initial state into
* - arrays for individual predicates
* - arrays for all static relations
* - array containing non - static relations
*/
do_inertia_preprocessing_step_1();
/* normalize all PL1 formulae in domain description:
* (goal, preconds and effect conditions)
* - simplify formula
* - expand quantifiers
* - NOTs down
*/
normalize_all_wffs();
/* translate negative preconds: introduce symmetric new predicate
* NOT-p(..) (e.g., not-in(?ob) in briefcaseworld)
*/
translate_negative_preconds();
/* split domain in easy (disjunction of conjunctive preconds)
* and hard (non DNF preconds) part, to apply
* different instantiation algorithms
*/
split_domain();
/***********************************************
* PREPROCESSING FINISHED *
* *
* NOW MULTIPLY PARAMETERS IN EFFECTIVE MANNER *
***********************************************/
build_easy_action_templates();
build_hard_action_templates();
times( &end );
TIME( gtempl_time );
times( &start );
/* perform reachability analysis in terms of relaxed
* fixpoint
*/
perform_reachability_analysis();
times( &end );
TIME( greach_time );
times( &start );
/* collect the relevant facts and build final domain
* and problem representations.
*/
collect_relevant_facts_and_fluents();
times( &end );
TIME( grelev_time );
/* now transform problem to additive normal form,
* if possible
*/
times( &start );
if ( !transform_to_LNF() ) {
printf("\n\nThis is not a linear task!\n\n");
exit( 1 );
}
times( &end );
TIME( gLNF_time );
times( &start );
/* now build globally accessable connectivity graph
*/
build_connectivity_graph();
/* now check for acyclic := effects (in expressions.c)
*/
check_assigncycles();
/* set the relevanc info (in expressions.c)
*/
determine_fl_relevance();
times( &end );
TIME( gconn_time );
/***********************************************************
* we are finally through with preprocessing and can worry *
* bout finding a plan instead. *
***********************************************************/
if ( gcmd_line.display_info ) {
printf("\n\nff: search configuration is ");
switch ( gcmd_line.search_config ) {
case 0:
printf("Enforced Hill-Climbing, if that fails then best-first search.\nMetric is plan length.");
printf("\nNO COST MINIMIZATION");
if ( !gcost_rplans ) {
printf(" (and no cost-minimizing relaxed plans).");
} else {
printf("\nDEBUG ME: cost min rplans in non-cost minimizing search config?\n\n");
exit( 1 );
}
break;
case 1:
printf("best-first search.\nMetric is plan length.");
printf("\nNO COST MINIMIZATION");
if ( !gcost_rplans ) {
printf(" (and no cost-minimizing relaxed plans).");
} else {
printf("\nDEBUG ME: cost min rplans in non-cost minimizing search config?\n\n");
exit( 1 );
}
break;
case 2:
printf("best-first search with helpful actions pruning.\nMetric is plan length.");
printf("\nNO COST MINIMIZATION.");
if ( !gcost_rplans ) {
printf(" (and no cost-minimizing relaxed plans).");
} else {
printf("\nDEBUG ME: cost min rplans in non-cost minimizing search config?\n\n");
exit( 1 );
}
break;
case 3:
printf("weighted A* with weight %d.", gcmd_line.w);
if ( goptimization_established ) {
printf("\nMetric is ");
print_LnfExpNode( &glnf_metric );
} else {
printf(" plan length");
}
printf("\nCOST MINIMIZATION DONE");
if ( !gcost_rplans ) {
printf(" (WITHOUT cost-minimizing relaxed plans).");
} else {
printf(" (WITH cost-minimizing relaxed plans).");
}
break;
case 4:
printf("A*epsilon with weight %d.", gcmd_line.w);
if ( goptimization_established ) {
printf("\nMetric is ");
print_LnfExpNode( &glnf_metric );
} else {
printf("\nError! Optimization criterion not established.\nA*epsilon not defined.\n\n");
exit( 1 );
}
printf("\nCOST MINIMIZATION DONE");
if ( !gcost_rplans ) {
printf(" (WITHOUT cost-minimizing relaxed plans).");
} else {
printf(" (WITH cost-minimizing relaxed plans).");
}
break;
case 5:
printf("Enforced Hill-Climbing, then A*epsilon with weight %d.", gcmd_line.w);
if ( goptimization_established ) {
printf("\nMetric is ");
print_LnfExpNode( &glnf_metric );
} else {
printf("\nError! Optimization criterion not established.\nA*epsilon not defined.\n\n");
exit( 1 );
}
printf("\nCOST MINIMIZATION DONE");
if ( !gcost_rplans ) {
printf(" (WITHOUT cost-minimizing relaxed plans).");
} else {
printf(" (WITH cost-minimizing relaxed plans).");
}
break;
default:
printf("\n\nUnknown search configuration: %d\n\n", gcmd_line.search_config );
exit( 1 );
}
} else {
if ( gcmd_line.search_config == 4 && !goptimization_established ) {
exit( 1 );
}
}
times( &start );
/* need to evaluate derived predicates in initial state!
*/
do_axiom_update( &ginitial_state );
if ( !gcost_rplans ) {
gcmd_line.cost_bound = -1;
}
switch ( gcmd_line.search_config ) {
case 0:
found_plan = do_enforced_hill_climbing();
if ( found_plan ) {
if ( gcmd_line.display_info ) {
print_plan();
}
} else {
if ( gcmd_line.display_info ) {
printf("\n\nEnforced Hill-climbing failed !");
printf("\nswitching to Best-first Search now.\n");
}
do_best_first_search();
}
break;
case 1:
case 2:
do_best_first_search();
break;
case 3:
do_weighted_Astar();
break;
case 4:
do_Astar_epsilon();
break;
case 5:
/* gcost_rplans controls whether or not we compute cost-minimal relaxed plans
* gcost_minimizing is only used in h fn to decide whether or not we
* need to count the weights of the operators in the relaxed plan.
*
* gcost_rplans may be false even for search options 3,4,5, namely if there are
* numeric preconditions/goals which make this relaxed plan variant invalid.
* hence we need to remember, when switching it off for EHC, whether or not
* it was previously on.
*/
prev_gcost_rplans = gcost_rplans;
gcost_rplans = FALSE;
gcost_minimizing = FALSE;
found_plan = do_enforced_hill_climbing();
if ( found_plan ) {
print_plan();
} else {
if ( gcmd_line.display_info ) {
printf("\n\nEnforced Hill-climbing not successful.");
printf("\nSwitching to A*epsilon now.");