Coder Social home page Coder Social logo

maxfield's People

Contributors

erichschroeter avatar jpeterbaker avatar maletin avatar mrngm avatar mvinni avatar pwiecz avatar tvwenger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maxfield's Issues

how can i solve this error

root@VM-104-3-ubuntu:~/maxfield-master# python makePlan.py --help
Traceback (most recent call last):
File "makePlan.py", line 43, in
import pandas as pd
File "/usr/local/lib/python2.7/dist-packages/pandas/init.py", line 22, in
from pandas.compat.numpy import *
ImportError: No module named compat.numpy

Python 2.7.12
Requirement already satisfied: distribute>=0.7.3 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 1))
Requirement already satisfied: matplotlib>=1.3.1 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2))
Requirement already satisfied: networkx==1.8.1 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 3))
Requirement already satisfied: numpy>=1.8.1 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 4))
Requirement already satisfied: docopt>=0.6.1 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 5))
Requirement already satisfied: pandas>=0.14.1 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 6))
Requirement already satisfied: pebble>=3.1.14 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 7))
Requirement already satisfied: setuptools>=0.7 in /usr/lib/python2.7/dist-packages (from distribute>=0.7.3->-r requirements.txt (line 1))
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: functools32 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: six>=1.10 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: pytz in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: pyparsing!=2.0.0,!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: subprocess32 in /usr/local/lib/python2.7/dist-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))

Improve performance for large number of portals

I was playing recently with maxfield for a large number of portals (150) and found out that it was extremely slow. The slow part was generating a feasible triangulation.
I've found a way to change the triangulate method to work quickly on my set of portals, but as I don't understand the existing algorithm well enough, I don't know if I don't break some property of the solution.

Right now the algorithm produces the triangulations of the perimeter portals such that the "final" portal for each triangle is never shared between two triangles.
If I dropped this requirement and tried all the possible positions of the "final" portal when I split off a Triangle from the perimeter, the algorithm finds a triangulation of the 150 portals within a second.
Actually, if I use another triangulation strategy which also don't care about the position of the final portal on the perimeter, I am able to triangulate even faster and usually generate solutions with shorter expected walk time, but that's beside the point.

My question is, where does this requirement about positions of the final vertices on the perimeter come from?
I think it's worth having an option to ignore this requirement at least behind a flag, so that we can feasibly run maxfield for large portal sets.

What are your thought?

ImportError: cannot import name process

root@2dabae3b9bae:/maxfield# pip install -r requirements.txt 
Requirement already satisfied: distribute>=0.7.3 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: matplotlib>=1.3.1 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied: networkx==1.8.1 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 3))
Requirement already satisfied: numpy>=1.8.1 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 4))
Requirement already satisfied: docopt>=0.6.1 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 5))
Requirement already satisfied: pandas>=0.14.1 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 6))
Requirement already satisfied: pebble>=3.1.14 in /usr/local/lib/python2.7/site-packages (from -r requirements.txt (line 7))
Requirement already satisfied: setuptools>=0.7 in /usr/local/lib/python2.7/site-packages (from distribute>=0.7.3->-r requirements.txt (line 1))
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python2.7/site-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: python-dateutil>=2.0 in /usr/local/lib/python2.7/site-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: backports.functools-lru-cache in /usr/local/lib/python2.7/site-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: subprocess32 in /usr/local/lib/python2.7/site-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: pytz in /usr/local/lib/python2.7/site-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: six>=1.10 in /usr/local/lib/python2.7/site-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python2.7/site-packages (from matplotlib>=1.3.1->-r requirements.txt (line 2))
Requirement already satisfied: futures; python_version < "3" in /usr/local/lib/python2.7/site-packages (from pebble>=3.1.14->-r requirements.txt (line 7))
root@2dabae3b9bae:/maxfield# python makePlan.py 
Traceback (most recent call last):
  File "makePlan.py", line 48, in <module>
    from pebble import process, TimeoutError # to handle timeout
ImportError: cannot import name process
root@2dabae3b9bae:/maxfield# python -V
Python 2.7.14

Error: cannot import name process

I have copy the file on my computer and install the dependency
when i run the command : python makePlan.py --help i got an error :

Traceback (most recent call last):
  File "makePlan.py", line 48, in <module>
    from pebble import process, TimeoutError # to handle timeout
ImportError: cannot import name process

i run the script with python 2.7.14+ on kali linux

ValueError: total size of new array must be unchanged

When I try to run the script (tested with two different input files), the script exits without output and I get this error:

python makePlan.py -n 1 -d portals.csv 
Found 35 portals in portal list.
Traceback (most recent call last):
  File "makePlan.py", line 375, in <module>
    main(**args)
  File "makePlan.py", line 163, in main
    xyz  = geometry.radstoxyz(locs)
  File "######/maxfield/lib/geometry.py", line 32, in radstoxyz
    pts = pts.reshape([-1,2])
ValueError: total size of new array must be unchanged

I can run the original script from jpeterbaker without problems.
Might be a problem on my side though, as I have little to no python experience...

Using the google map option, an exception is thrown

OSX 10.11.5 -- python installed via #brew

$ python makePlan.py strang.csv -g -d strang/
Traceback (most recent call last):
  File "makePlan.py", line 397, in <module>
    main(args)
  File "makePlan.py", line 317, in main
    best_PP.planMap(useGoogle=useGoogle)
  File "/Users/tcrowder/maxfield2/lib/PlanPrinterMap.py", line 312, in planMap
    implot = plt.imshow(self.google_image,extent=self.xylims,origin='upper')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 2892, in imshow
    imlim=imlim, resample=resample, url=url, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/axes.py", line 7300, in imshow
    im.set_data(X)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/image.py", line 419, in set_data
    self._A = pil_to_array(A)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/image.py", line 1347, in pil_to_array
    x = toarray(im)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/image.py", line 1313, in toarray
    x_str = im.tostring('raw', im.mode)
  File "/Library/Python/2.7/site-packages/PIL/Image.py", line 699, in tostring
    "Please call tobytes() instead.")
Exception: tostring() has been removed. Please call tobytes() instead.
$ pip list
altgraph (0.10.2)
awscli (1.10.15)
backports-abc (0.4)
backports.ssl-match-hostname (3.5.0.1)
bdist-mpkg (0.5.0)
bonjour-py (0.3)
botocore (1.4.6)
certifi (2016.2.28)
colorama (0.3.3)
decorator (4.0.9)
distribute (0.7.3)
docutils (0.12)
futures (3.0.5)
jmespath (0.9.0)
macholib (1.5.1)
matplotlib (1.3.1)
modulegraph (0.10.4)
mysql-utilities (1.5.6)
networkx (1.11)
nose (1.3.7)
numpy (1.8.0rc1)
pandas (0.18.1)
Pebble (3.1.14)
Pillow (3.2.0)
pip (8.1.2)
py2app (0.7.3)
pyasn1 (0.1.9)
pyobjc-core (2.5.1)
pyobjc-framework-Accounts (2.5.1)
pyobjc-framework-AddressBook (2.5.1)
pyobjc-framework-AppleScriptKit (2.5.1)
pyobjc-framework-AppleScriptObjC (2.5.1)
pyobjc-framework-Automator (2.5.1)
pyobjc-framework-CFNetwork (2.5.1)
pyobjc-framework-Cocoa (2.5.1)
pyobjc-framework-Collaboration (2.5.1)
pyobjc-framework-CoreData (2.5.1)
pyobjc-framework-CoreLocation (2.5.1)
pyobjc-framework-CoreText (2.5.1)
pyobjc-framework-DictionaryServices (2.5.1)
pyobjc-framework-EventKit (2.5.1)
pyobjc-framework-ExceptionHandling (2.5.1)
pyobjc-framework-FSEvents (2.5.1)
pyobjc-framework-InputMethodKit (2.5.1)
pyobjc-framework-InstallerPlugins (2.5.1)
pyobjc-framework-InstantMessage (2.5.1)
pyobjc-framework-LatentSemanticMapping (2.5.1)
pyobjc-framework-LaunchServices (2.5.1)
pyobjc-framework-Message (2.5.1)
pyobjc-framework-OpenDirectory (2.5.1)
pyobjc-framework-PreferencePanes (2.5.1)
pyobjc-framework-PubSub (2.5.1)
pyobjc-framework-QTKit (2.5.1)
pyobjc-framework-Quartz (2.5.1)
pyobjc-framework-ScreenSaver (2.5.1)
pyobjc-framework-ScriptingBridge (2.5.1)
pyobjc-framework-SearchKit (2.5.1)
pyobjc-framework-ServiceManagement (2.5.1)
pyobjc-framework-Social (2.5.1)
pyobjc-framework-SyncServices (2.5.1)
pyobjc-framework-SystemConfiguration (2.5.1)
pyobjc-framework-WebKit (2.5.1)
pyOpenSSL (0.13.1)
pyparsing (2.0.1)
python-dateutil (1.5)
pytz (2013.7)
rsa (3.3)
s3transfer (0.0.1)
scipy (0.13.0b1)
setuptools (1.1.6)
singledispatch (3.4.0.3)
six (1.4.1)
tornado (4.3)
vboxapi (1.0)
wheel (0.29.0)
xattr (0.6.4)
zope.interface (4.1.1)

ortools requiring protobuf>=4.21.5.

while executing: maxfield-plan portals16.txt --num_agents 1 --num_field_iteration 100000 --num_cpus 0 --max_route_runtime 3600 --verbose --output_csv
ortools requiring protobuf>=4.21.5
while using:

  1. github code spaces
  2. WSL2 ubuntu

pkg_resources.ContextualVersionConflict: (protobuf 3.19.4 (/usr/local/python/3.10.4/lib/python3.10/site-packages/protobuf-3.19.4-py3.10.egg), Requirement.parse('protobuf>=4.21.5'), {'ortools'})
Teminal log.txt

Any workaround would be helpful

Add fixed links for calculation

First of all: Thx for your work, I love it :D

But actually I wasn't able to use it for my populated home area with a high density of portals because there are always some links from other people.
Might it possible to implement a feature to feed the algorithm with fixed links as a base for the following random sequence?
Maybe at the end of the portal list beginning with a "+" followed by the linked portals.

For example:
+1;10
+1;12
+10;11

This would be the most important of my wishlist ^^

Another nice feature would be if links could be given as a frontier which mustn't be crossed, e.g. when links from out of the planned area go into the planned one.
Portals for that exclusion list (X-list) could be given like the other ones but with a trailing "-X;" like:
-X;Funny Portal;https://intel.ingress.com/intel?ll=1.234567,1.122333&z=19&pll=1.234567,1.122333 #--> will be X0
-X;Happy Portal;https://intel.ingress.com/intel?ll=2.234567,3.122333&z=19&pll=2.234567,3.122333 #--> will be X1
...

Followed by X-list which can contain normal portals, too:
-X0;X1
-X1;10
-2;X1

freetype not found, although freetype6 is installed

Bad nomenclature aside, I have libfreetype6 (2.6.1-0.1ubuntu2.3) installed, but it seems the requirements file looks strictly for version 2, which isn't in Ubuntu's repositories, having been superseded by newer versions.

The output claims I can edit setup.cfg to change the build options, but there doesn't seem to be a setup.cfg file. Likewise, no version of freetype is specified in requirements.txt and I cannot append freetype==2.6.1 without creating an error:

Collecting freetype==2.6.1 (from -r requirements.txt (line 2)) Could not find a version that satisfies the requirement freetype==2.6.1 (from -r requirements.txt (line 2)) (from versions: ) No matching distribution found for freetype==2.6.1 (from -r requirements.txt (line 2))

Am I missing a way to tell pip I do have freetype installed, or is something else going on here? Freetype seems to be the only required dependency failing, but here is my full log from running the install command.

============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.3.1]
                python: yes [2.7.12 (default, Dec  4 2017, 14:50:18)  [GCC
                        5.4.0 20160609]]
              platform: yes [linux2]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.11.0]
              dateutil: yes [dateutil was not found. It is required for date
                        axis support. pip/easy_install may attempt to
                        install it after matplotlib.]
               tornado: yes [using tornado version 4.5.1]
             pyparsing: yes [pyparsing was not found. It is required for
                        mathtext support. pip/easy_install may attempt to
                        install it after matplotlib.]
                 pycxx: yes [Couldn't import.  Using local copy.]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: no  [pkg-config information for 'freetype2' could
                        not be found.]
                   png: yes [pkg-config information for 'libpng' could not
                        be found. Using unknown version.]

OPTIONAL SUBPACKAGES
           sample_data: yes [installing]
              toolkits: yes [installing]
                 tests: yes [nose 0.11.1 or later is required to run the
                        matplotlib test suite]

OPTIONAL BACKEND EXTENSIONS
                macosx: no  [Mac OS-X only]
                qt4agg: yes [installing, Qt: 4.8.7, PyQt4: 4.11.4]
               gtk3agg: yes [installing, version 3.9.18]
             gtk3cairo: yes [installing, version 3.9.18]
                gtkagg: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                        be found.  You may need to install the development
                        package.]
                 tkagg: no  [TKAgg requires Tkinter.]
                 wxagg: yes [installing, version 3.0.2.0]
                   gtk: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                        be found.  You may need to install the development
                        package.]
                   agg: yes [installing]
                 cairo: yes [installing, version 1.8.8]
             windowing: no  [Microsoft Windows only]

OPTIONAL LATEX DEPENDENCIES
                dvipng: no
           ghostscript: yes [version 9.18]
                 latex: no
               pdftops: yes [version 0.41.0]

============================================================================
                        * The following required packages can not be built:
                        * freetype

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-p3qziV/matplotlib/`

TamperMonkey script to make getting the portal text easier

Its ugly, its probably not perfect, but it works on everything I've used so far. It just allows you to easily copy the title and link of the portal to your clipboard. Click the portal, click the link button and voila you got it in your clipboard. Wasnt sure where else to share it.

// @name         Ingress Portal Copyer
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://intel.ingress.com/intel?state=GOOGLE&code=4%2F0AY0e-g6DQpl2zaTtquTbcWFZZa_lRG_dE6sWsw8ICgrWbIJtGbshNWdvSWEYrowtnE7hgg&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+openid&authuser=2&prompt=consent
// @grant        none
// ==/UserScript==

(function() {
    function copyToClipboard(text) {
        const elem = document.createElement('textarea');
        elem.value = text;
        document.body.appendChild(elem);
        elem.select();
        document.execCommand('copy');
        document.body.removeChild(elem);
    }

    'use strict';

    let linkButton = document.getElementById("header_maplink");

    linkButton.addEventListener("click", function() {

        let title = "";
        let link = "";
        let portalText = "";

        let titleEl = document.getElementById("portal_primary_title");
        let linkEl = document.getElementById("maplink");

        if (titleEl) {
            title = titleEl.innerHTML.replace(/["]+/g, '').replace(/(&amp;)+/g, "&");
        }
        if (linkEl) {
            link = linkEl.value;
        }

        portalText = title + "; " + link;
        copyToClipboard(portalText);
        console.log(portalText);
    });

})();```

Python error (?)

Hello,
First of all, sorry for the bad title, but I sincerely have no idea what this error is about...

I am a long time maxfield user and have created (and executed) a lot of maxfields over the past years. I even do them when on vacation and I have some spare time...

OK, that's not my issue..

The script was running fine until "something" changed on my system...

I am running Manjaro Linux so the problem is most probably some BC issue, That's just one of the reasons I hate Python...

So here is the output:

maxfield-plan /path/to/waypoints.txt --outdir /path/to/dir --num_agents 1 --output_csv --num_cpus 0 --num_field_iterations 100 --max_route_solutions 100 --skip_step_plots --verbose > /path/to/log.txt

Traceback (most recent call last):
  File "/usr/bin/maxfield-plan", line 4, in <module>
    __import__('pkg_resources').run_script('maxfield==4.0', 'maxfield-plan')
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3243, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 568, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 886, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'maxfield==4.0' distribution was not found and is required by the application

Since this looks oh so pythonic, I decided to go the windows way and just reinstalled the thing with python setup.py install and at least the error changed...

Traceback (most recent call last):
  File "/usr/bin/maxfield-plan", line 4, in <module>
    __import__('pkg_resources').run_script('maxfield==4.0', 'maxfield-plan')
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 651, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1455, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/EGG-INFO/scripts/maxfield-plan", line 29, in <module>
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/maxfield.py", line 30, in <module>
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/plan.py", line 35, in <module>
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 32, in <module>
  File "/usr/lib/python3.10/site-packages/ortools-9.2.9972-py3.10-linux-x86_64.egg/ortools/constraint_solver/routing_enums_pb2.py", line 21, in <module>
    _FIRSTSOLUTIONSTRATEGY = DESCRIPTOR.message_types_by_name['FirstSolutionStrategy']
AttributeError: 'NoneType' object has no attribute 'message_types_by_name'

You may have noticed that I am not a big fan of Python or her cryptic error messages so I hope that you just say "AHA" and fix the thingy ;)

I don't think that the waypoints file is the problem since I tried various that worked before so I omit it here.

P.S.:
While I am here let me first thank you for your work on this.

Second, I have created a kind of "front end" in PHP: https://github.com/elkuku/Frox which I use only on my machine to manage my own portal list.

And another thing in JS here; https://github.com/elkuku/maptest with a (working) demo here: https://elkuku.github.io/maptest/
The thing here is to convert the whole maxfield plan (the "farm keys" list and the "links" list) to a GPX file (which is done by the PHP script above) and then display it on a map with your actual location. To be used when executing the maxfield out in the field.
This could also be loaded into a navigator so you can at least navigate to the portals when playing in unknown areas ;) (not tested)

So, thanks again for your hard work and I hope that you are still playing Ingress.

Link Map and Portal Map

Hi

Checked the --help argument but could see anything to improve quality of images generated. 640 x 480 is a bit small

Any help would be appreciated.

Thanks

Python 3.10 error

So, after #35 has been solved, I now got another cryptic error message...

$ maxfield-plan example_portals.txt --num_agents 3 --num_cpus 0 --verbose --output_csv
Found 18 portals in portal file: example_portals.txt

Starting field generation with 4 CPUs.
Field generation runtime: 236.3 seconds.

==============================
Maxfield Plan Results:
    portals         = 18
    links           = 45
    fields          = 40
    max keys needed = 4
    AP from portals = 31500
    AP from links   = 14085
    AP from fields  = 50000
    TOTAL AP        = 95585
==============================

Optimizing agent link assignments.
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 127, in time_evaluator
  [Previous line repeated 896 more times]
TypeError: 'numpy.float64' object cannot be interpreted as an integer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/maxfield-plan", line 4, in <module>
    __import__('pkg_resources').run_script('maxfield==4.0', 'maxfield-plan')
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 656, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1460, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/EGG-INFO/scripts/maxfield-plan", line 92, in <module>
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/maxfield.py", line 241, in maxfield
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/plan.py", line 232, in route_agents
  File "/usr/lib/python3.10/site-packages/maxfield-4.0-py3.10.egg/maxfield/router.py", line 345, in route_agents
  File "/usr/lib/python3.10/site-packages/ortools/constraint_solver/pywrapcp.py", line 5413, in CloseModelWithParameters
    return _pywrapcp.RoutingModel_CloseModelWithParameters(self, search_parameters)
SystemError: <built-in function RoutingModel_CloseModelWithParameters> returned a result with an exception set

error

the errors that python is giving me...


ayezona@ayezona-VM:~/Downloads/maxfield-4.0$ maxfield-plan portals.txt --num_agents 1 --num_cpus 1 --verbose
Found 85 portals in portal file: portals.txt

Starting field generation with 1 CPU.
Traceback (most recent call last):
File "/usr/local/bin/maxfield-plan", line 4, in
import('pkg_resources').run_script('maxfield==4.0', 'maxfield-plan')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 651, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1455, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/EGG-INFO/scripts/maxfield-plan", line 88, in
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/maxfield.py", line 212, in maxfield
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/plan.py", line 142, in optimize
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/plan.py", line 142, in
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/generator.py", line 110, in generate
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/fielder.py", line 132, in make_fields
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 324, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 324, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 324, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 320, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 320, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 320, in build_links
[Previous line repeated 1 more time]
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 323, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 320, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 320, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 320, in build_links
[Previous line repeated 970 more times]
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 307, in build_links
File "/usr/local/lib/python3.9/dist-packages/maxfield-4.0-py3.9.egg/maxfield/field.py", line 263, in split
File "mtrand.pyx", line 962, in numpy.random.mtrand.RandomState.choice
File "mtrand.pyx", line 748, in numpy.random.mtrand.RandomState.randint
File "_bounded_integers.pyx", line 1228, in numpy.random._bounded_integers._rand_int64
File "<array_function internals>", line 5, in prod
File "/home/ayezona/.local/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 3051, in prod
return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out,
File "/home/ayezona/.local/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 70, in _wrapreduction
passkwargs = {k: v for k, v in kwargs.items()
RecursionError: maximum recursion depth exceeded while calling a Python object


No gif gen on ngress-maxfield.com

Hi,

Unsure if that's on purpose but there is no gif gen when using ngress-maxfield.com
It does generate when using the project locally.

Thanks you for the nice tool !

Cheers

ImportError: cannot import name ERROR

python2.7 makePlan.py -n 4 EXAMPLE.portals -d out/ -f output.pkl


Traceback (most recent call last):
  File "makePlan.py", line 48, in <module>
    from pebble import process, TimeoutError # to handle timeout
  File "/usr/lib/python2.7/site-packages/pebble/process/__init__.py", line 3, in <module>
    from pebble.process.pool import Pool
  File "/usr/lib/python2.7/site-packages/pebble/process/pool.py", line 24, in <module>
    from pebble import thread
  File "/usr/lib/python2.7/site-packages/pebble/thread/__init__.py", line 3, in <module>
    from pebble.thread.pool import Pool
  File "/usr/lib/python2.7/site-packages/pebble/thread/pool.py", line 21, in <module>
    from pebble.pool import ERROR, RUNNING, SLEEP_UNIT
ImportError: cannot import name ERROR

Any way to solve this?

Inbound-only portals?

Hi!

Thanks for continuing support of this great tool, as a somewhat new player I use it a lot!

Have a question. Would it be possible to mark portals as inbound only? In our area we have a few strategic portals that 99% of the time are inaccesible to be within their range to make outbound links. Therefore they can be used only as link destinations.

I've read the code. The algorithm checks if a portal can make any more outbound links. If such portal would have the number of available outgoing links overridden to 0, is my thinking correct that the algorithm as it is right now, would simply find other portals to link to it?

New install - pebble not included

It looks like pebble needs to be included in the requirements.txt file as a dependency.
pebble>=3.1.14

my solution for one installation:
%sudo pip install pebble

This installed Pebble (3.1.14)

The error message below is when running the example script the first time.
After manually installing pebble, the script completed without error, and generated the expected output. I do not know what the absolute minimum version of pebble that is required, so I referenced the version pip installed for me on 3/15/2016.

Reference output:
% python makePlan.py -n 4 EXAMPLE.portals -d out/ -f output.pkl
/usr/local/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
Traceback (most recent call last):
File "makePlan.py", line 48, in
from pebble import process, TimeoutError # to handle timeout
ImportError: No module named pebble

Excessive Maps API Calls

Ideally the Google Maps API call should be held to the end and queried for the optimal found solution rather than making the call on each pass. I discovered the hard way that can get expensive.

ImportError: No module named networkx

C:\Python27\maxfield-master>python makePlan.py -b 2 Example.csv out/ output.pkl
Traceback (most recent call last):
File "makePlan.py", line 43, in
import networkx as nx
ImportError: No module named networkx

Old matplotlib version installs incompatible numpy version

(venv) phoenix@debian-maxfield:~/maxfield$ pip install -r requirements.txt
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting distribute==0.7.3 (from -r requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip
Collecting matplotlib==1.3.1 (from -r requirements.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/d4/d0/17f17792a4d50994397052220dbe3ac9850ecbde0297b7572933fa4a5c98/matplotlib-1.3.1.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.3.1]
                    python: yes [2.7.16 (default, Apr  6 2019, 01:42:57)  [GCC
                            8.3.0]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [not found. pip may install it below.]
                  dateutil: yes [dateutil was not found. It is required for date
                            axis support. pip/easy_install may attempt to
                            install it after matplotlib.]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                     pycxx: yes [Couldn't import.  Using local copy.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: yes [version 22.1.16]
                       png: yes [version 1.6.36]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt4agg: no  [PyQt4 not found]
                   gtk3agg: no  [Requires pygobject to be installed.]
                 gtk3cairo: no  [Requires cairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: no  [TKAgg requires Tkinter.]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairo not found]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: no
                     latex: no
                   pdftops: no

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-BpDEhz/matplotlib/setup.py", line 268, in <module>
        **extra_args
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 717, in fetch_build_eggs
        replace_conflicting=True,
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 784, in fetch_build_egg
        return cmd.easy_install(req)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 679, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1158, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
        run_setup(setup_script, args)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 253, in run_setup
        raise
      File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-_UMBCn/numpy-1.17.0rc2/setup.py", line 31, in <module>
        try:
    RuntimeError: Python version >= 3.5 required.
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-
(venv) phoenix@debian-maxfield:~/maxfield$ python --version
Python 2.7.16

This is on a fresh Debian Buster system.

Numpy 1.16 is the last to support 2.7, yet this old version of matplotlib tries to install numpy 1.5 or greater, which gets 1.17: https://github.com/matplotlib/matplotlib/blob/v1.3.1/setupext.py#L761

Trying to install 1.8.1 separately before doing the rest of requirements.txt doesn't work either:

(venv) phoenix@debian-maxfield:~/maxfield$ python makePlan.py -n 4 EXAMPLE.portals -d out/ -f output.pkl
numpy.dtype has the wrong size, try recompiling
Traceback (most recent call last):
  File "makePlan.py", line 43, in <module>
    import pandas as pd
  File "/home/phoenix/maxfield/venv/local/lib/python2.7/site-packages/pandas/__init__.py", line 6, in <module>
    from . import hashtable, tslib, lib
  File "numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:22150)
ValueError: numpy.dtype has the wrong size, try recompiling
(venv) phoenix@debian-maxfield:~/maxfield$

Not really sure how to get this running on modern systems


More broadly, are there any plans to update the codebase to Python 3? EOL for Python 2 is 5 months and change from now, and it shows.

Build failing due to broken dependency pygifsicle.

This is currently failing to build due to pygifsicle.

Processing dependencies for maxfield==4.0
Searching for pygifsicle
Reading https://pypi.org/simple/pygifsicle/
Downloading https://files.pythonhosted.org/packages/03/4f/bde532b426d1f3969c74a1dfee79dde0a32c38005e29751d39c606f0334c/pygifsicle-1.0.4.tar.gz#sha256=a4332c461ee4a7564c22ef52000bcf9a624771b0c7376b4bf6fcf1ee1c3ecfcb
Best match: pygifsicle 1.0.4
Processing pygifsicle-1.0.4.tar.gz
Writing /tmp/easy_install-scf7v3lr/pygifsicle-1.0.4/setup.cfg
Running pygifsicle-1.0.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-scf7v3lr/pygifsicle-1.0.4/egg-dist-tmp-2gri4llp
Installing gifsicle on Linux requires sudo!
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 152, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 193, in setup_context
    yield
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 254, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 43, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-scf7v3lr/pygifsicle-1.0.4/setup.py", line 52, in <module>
AttributeError: module 'platform' has no attribute 'linux_distribution'

To workaround the problem, I grabbed https://github.com/kohler/gifsicle and removed the dependency requirement from setup.py.

Make KML instead of png plots

Often those png images are too small to distinguish links/numbers at dense areas.
Instead of rendering png I propose to make output to KML-file, which could be visualized with any scale/zoom, using some GIS-software, e.g. Google Earth.

Also, as stated at http://www.ingress-maxfield.com/:

A bottleneck in the plan generation was the creation of the link-by-link images

In case of KML it's easy to incorporate all sequence of linking, in same raw-xml file, and thus all the linking story could be browsed step by step.

P.S.
All additional data tables also could be included in KML, but it is much less important than links plots.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.