Complete.Org: Mailing Lists: Archives: freeciv-ai: March 2003:
[freeciv-ai] [RFC] Advisors cleanup
Home

[freeciv-ai] [RFC] Advisors cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv AI development <freeciv-ai@xxxxxxxxxxx>
Subject: [freeciv-ai] [RFC] Advisors cleanup
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sat, 1 Mar 2003 17:52:51 +0000 (GMT)

On Sun, 23 Feb 2003, Jordi Negrevernis i Font wrote:

> En/na Gregory Berkolaiko ha escrit:
> 
> >This is the idea I have:
> >in ai_manage_cities we currently call different advisors who often overwrite
> >each other's choice.  I want to change each advisor so it writes it's choice
> >into a separate structure and then there is a function which does comparison
> >between the requests (national tendencies can go here) and chooses the best 
> >one.
> >It is better for debugging, for putting it new advisors, for changing 
> >existing ones.
> >
> >We should discuss initial division into advisors.  I think we should split
> >military into defence and attack (to be later substituted by army_advisor), 
> >but
> >what else? new_cities, terrain improvements, attitude, trade?  Please give 
> >your
> >suggestions.
> >
>     Yes, i think this is a great idea :-)

Good.  Here is the general design I propose to work toward:


Highest level advisors:
=======================

1. Defence Advisor
2. Expansion Advisor
3. Domestic Advisor
4. Global Advisor


Responsibilities:
=================

1. Defence Advisor should be responsible for the defence of the city, 
including 
  (a) traditional defence (e.g. Mech Inf), 
  (b) defensive structures (e.g.  City Walls),
  (c) defensive diplomats
  (d) preemptive defence (e.g. Stealth Fighters as Transport Hunters)

2. Expansion Advisor should be responsible for building F_CITIES units to 
build new cities.

3. Domestic Advisor should be responsible for all things related to 
domestic output, including
  (a) terrain improvements sub-advisor
  (b) trade sub-advisor further divided into:
    (i) general trade improvements (e.g. Highway, inc. local wonders 
                                   such as Colossus)
    (ii) tax/lux improvements (e.g. Bank, inc. local wonders)
    (iii) science improvements (e.g. Library, inc. local wonders)
  (c) production sub-advisor (e.g. Factory, inc. local wonders)
  (d) attitude sub-advisor (e.g. Temple, inc. local wonders)

4. Global Advisor should be responsible for building things 
requested on the higher level, including
  (a) military units for armies
  (b) ferries
  (c) global wonders
  (d) caravans for wonder-helping
etc.


Notes: 
======

1. Global Advisor is probably the hardest to design/implement.  In theory, 
other advisors will say "this is what our city needs" and GA will say 
"this is what our nation needs" and then they see whose want is bigger.
But optimisation question will arise such as "what if another city is 
better for the job" etc.

2. Above is just one of the possible divisions.  One can argue that
expansion (via new cities) belongs more to the Global Advisor, that
Marketplace is a tool to improve attitude as well as to increase tax and
so on.  I don't think it's possible to divide the decision making into
completely disjoint sets.  It should be noted that it's OK if two
different advisors demand Marketplace to be built (perhaps in this case
two wants should be added).

3. I see three possibilities for the decision-making:
  (a) max-tree: 
    (i) lowest level sub-advisors make their decisions, 
    (ii) they are multiplied by weights, 
    (iii) the _maximal_ becomes the decision of the mid-level 
          sub-advisor  
    and so on
  (b) common additive list:
    (i) the list of all possible builds is prepared and all wants are set 
        to 0
    (ii) each advisor goes through the list, evaluating his want for each 
         item
    (iii) the want, modified by the advisors weight is added to item's 
          want
    (iv) the item with overall maximal want is selected.
  (c) mixed method:
    (i) additive list to bring together opinions of subadvisors
    (ii) each higher level advisor selects his choice from his list
    (iii) choices are modified by weight, the maximal is selected

Personally, I favour the mixed method with additive list for buildings and
max for units.  This leaves the possibility to remember previous wants and
also, for the built unit, remeber who and why requested it (e.g. Global
Advisor to help wonder in city A).

Anyway, more I think about it, harder it all seems, so it's time for me to 
stop.

G.



[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] [RFC] Advisors cleanup, Gregory Berkolaiko <=