id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3268076 | # -*- coding: utf-8 -*-
"""Test that closed File and SifData instances behave as expected.
"""
import os
import unittest
import freesif as fs
FILES = os.path.join(os.path.dirname(__file__), 'files')
hydrodata_methods_and_args = [('get_addedmass', ()),
('get_angular_freqs', ()),
('get_bodymass', ()),
('get_bodyproperties', ()),
('get_directions', ()),
('get_excitationforce_raos', ()),
('get_fluidkinematics_raos', ()),
('get_hydrostatic_restoring', ()),
('get_mooring_restoring', ()),
('get_motion_raos', ()),
('get_periods', ()),
('get_points', ()),
('get_potentialdamping', ()),
('get_sectionforce_raos', ()),
('get_sections', ()),
('get_timesteps', ()),
('get_viscousdamping', ()),
('get_meandrift', ()),
('get_horiz_meandrift', ())]
strucdata_methods_and_args = [('get_setnames', ()),
('get_nodes', ()),
('get_nodenumbers', ()),
('get_noderesults', ('displacement',)),
('get_elements', ()),
('get_elementnumbers', ()),
('get_elementresults', ('generalstress',))]
file_methods_and_args = [('__contains__', ('key',)),
('__getitem__', ('key',)),
('__iter__', ()),
('get', ('key',)),
('items', ()),
('keys', ()),
('values', ())]
class TestHydroData(unittest.TestCase):
@classmethod
def setUpClass(cls):
# establish a closed HydroData instance
cls._data = fs.open_sif(os.path.join(FILES, 'hydro', 'slowdrift_G1.SIF'))
cls._data.close()
def test_methods(self):
# all methods should raise ClosedFileError
for method, args in hydrodata_methods_and_args:
self.assertRaises(fs.exceptions.ClosedFileError,
getattr(self._data, method),
*args)
def test_close(self):
# calling close() on an already closed SifData should return None
self.assertIsNone(self._data.close())
class TestStrucData(unittest.TestCase):
@classmethod
def setUpClass(cls):
# establish a closed StrucData instance (single sup. elem.)
cls._data = fs.open_sif(os.path.join(FILES, 'struc', 'single_super_elem', 'test01_1stord_linstat_R1.SIU'))
cls._data.close()
def test_methods(self):
# all methods should raise ClosedFileError
for method, args in strucdata_methods_and_args:
self.assertRaises(fs.exceptions.ClosedFileError,
getattr(self._data, method),
*args)
def test_close(self):
# calling close() on an already closed SifData should return None
self.assertIsNone(self._data.close())
class TestFile(unittest.TestCase):
@classmethod
def setUpClass(cls):
# establish a closed File instance
cls._fname = fs.sif2hdf5(os.path.join(FILES, 'hydro', 'slowdrift_G1.SIF'))
cls._file = fs.open_hdf5(cls._fname)
cls._file.close()
@classmethod
def tearDownClass(cls):
os.remove(cls._fname)
def test_methods(self):
# all methods should raise ClosedFileError
for method, args in file_methods_and_args:
self.assertRaises(fs.exceptions.ClosedFileError,
getattr(self._file, method),
*args)
def test_close(self):
# calling close() on an already closed File should return None
self.assertIsNone(self._file.close())
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
3398447 | #!/usr/bin/env python
# coding: utf-8
# monthlyMetrics.py
#
# Inputs
# investType: Investment type -> fund or ETF
# filename: spreadsheet to output data, can be left blank
# month: month to collect data points for, can be left blank
# year: year to collect data points for, can be left blank
#
# Examples
# python3 monthlyMetrics.py -> outputs funds data in fundMonthly.xlsx
# python3 monthlyMetrics.py etf -> outputs etf data in etfMonthly.xlsx
# python3 monthlyMetrics.py fund data.xlsx-> outputs fund data in data.xlsx
# Notes: Run after the first business day of the month
# python3 monthlyMetrics.py etf march.xlsx 3
# Notes: Collect data for March of this year, outputs in march.xlsx
# python3 monthlyMetrics.py fund dec2020fund.xlsx 12 2020
#
# Rev History:
# 0.1 210303 Initial Functionality
# 0.2 210403 Added previous month lookup
# 0.21 210403 Cleaned up code flow for one path
# 0.25 210405 Added year
# 0.26 210410 Adding significantly more symbols
# 0.3 210418 Cleaning up code significantly
# 0.31 210425 Cleaning up display
# 0.32 210425 InvestingMetrics - moved getMetrics
# 0.35 210501 Enhance symbol input
# 0.4 210726 Switch between funds & ETFs
import pandas as pd
from InvestingBase import readFunds, sortSymbols, seralizeData
from InvestingMetrics import getMetrics
def monthlyMetric(investType, filename, month, year):
# Get symbols of interest & sort -> Update Fund vs ETF
if(investType.lower().strip() == 'fund'):
symbols = readFunds('Symbols.csv')
#symbols = readFunds('SymbolsDebug.csv')
elif(investType.lower().strip() == 'etf'):
symbols = readFunds('SymbolsETF.csv')
#symbols = readFunds('SymbolsETFDebug.csv')
else:
print('Type should be fund or etf')
return
sortSymbols(symbols) # Sort symbols & remove duplicates
dataList = [] # Allocate variable name
for symbol in symbols.index: # Lookup symbols
symbol = symbol.strip()
print(symbol)
dataList.append(getMetrics(symbol, month, year))
cols = ['Symbol', 'Month Start', 'Month End', 'PERC']
seralizeData(filename, dataList, cols) # Seralize data
if __name__ == "__main__":
import sys
investType = 'fund'
if(len(sys.argv) >= 2):
investType = sys.argv[1]
filename = 'etfMonthly.xlsx' # File name to seralize data
if(investType == 'fund'):
filename = 'fundMonthly.xlsx'
if(len(sys.argv) >= 3):
filename = sys.argv[2]
month = None # month to lookup
if(len(sys.argv) >= 4):
month = sys.argv[3]
year = None # month to lookup
if(len(sys.argv) >= 5):
year = sys.argv[4]
monthlyMetric(investType, filename, month, year) # run monthMetrics to collect data
| StarcoderdataPython |
3311278 | <filename>cannabis_api/api/migrations/0002_auto_20190409_2107.py
# Generated by Django 2.2 on 2019-04-09 21:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='strain',
name='strain_type',
field=models.CharField(blank=True, choices=[('Sativa', 'Sativa'), ('Hybrid', 'Hybrid'), ('Indica', 'Indica')], max_length=6),
),
]
| StarcoderdataPython |
139219 | <reponame>joel-mb/Scenic
"""Support for checking Scenic types."""
import sys
import inspect
import numbers
import typing
from scenic.core.distributions import (Distribution, RejectionException, StarredDistribution,
distributionFunction)
from scenic.core.lazy_eval import (DelayedArgument, valueInContext, requiredProperties,
needsLazyEvaluation, toDelayedArgument)
from scenic.core.vectors import Vector
from scenic.core.errors import RuntimeParseError, saveErrorLocation
# Typing and coercion rules:
#
# coercible to a scalar:
# instances of numbers.Real (by calling float())
# coercible to a heading:
# anything coercible to a scalar
# anything with a toHeading() method
# coercible to a Vector:
# tuples/lists of length 2
# anything with a toVector() method
# coercible to an object of type T:
# instances of T
#
# Finally, Distributions are coercible to T iff their valueType is.
## Basic types
class Heading(float):
"""Dummy class used as a target for type coercions to headings."""
pass
def underlyingType(thing):
"""What type this value ultimately evaluates to, if we can tell."""
if isinstance(thing, Distribution):
return thing.valueType
elif isinstance(thing, TypeChecker) and len(thing.types) == 1:
return thing.types[0]
else:
return type(thing)
def isA(thing, ty):
"""Does this evaluate to a member of the given Scenic type?"""
return issubclass(underlyingType(thing), ty)
def unifyingType(opts): # TODO improve?
"""Most specific type unifying the given types."""
types = []
for opt in opts:
if isinstance(opt, StarredDistribution):
ty = underlyingType(opt)
typeargs = typing.get_args(ty)
if typeargs == ():
types.append(ty)
else:
for ty in typeargs:
if ty is not Ellipsis:
types.append(ty)
else:
types.append(underlyingType(opt))
if all(issubclass(ty, numbers.Real) for ty in types):
return float
mro = inspect.getmro(types[0])
for parent in mro:
if all(issubclass(ty, parent) for ty in types):
return parent
raise RuntimeError(f'broken MRO for types {types}')
## Type coercions (for internal use -- see the type checking API below)
def canCoerceType(typeA, typeB):
"""Can values of typeA be coerced into typeB?"""
import scenic.syntax.veneer as veneer # TODO improve
if typing.get_origin(typeA) is typing.Union:
# only raise an error now if none of the possible types will work;
# we'll do more careful checking at runtime
return any(canCoerceType(ty, typeB) for ty in typing.get_args(typeA))
if typeB is float:
return issubclass(typeA, numbers.Real)
elif typeB is Heading:
return canCoerceType(typeA, float) or hasattr(typeA, 'toHeading')
elif typeB is Vector:
return issubclass(typeA, (tuple, list)) or hasattr(typeA, 'toVector')
elif typeB is veneer.Behavior:
return issubclass(typeA, typeB) or typeA in (type, type(None))
else:
return issubclass(typeA, typeB)
def canCoerce(thing, ty):
"""Can this value be coerced into the given type?"""
tt = underlyingType(thing)
if canCoerceType(tt, ty):
return True
elif isinstance(thing, Distribution) and tt is object:
return True # fall back on type-checking at runtime
else:
return False
def coerce(thing, ty, error='wrong type'):
"""Coerce something into the given type."""
assert canCoerce(thing, ty), (thing, ty)
import scenic.syntax.veneer as veneer # TODO improve?
realType = ty
if ty is float:
coercer = coerceToFloat
elif ty is Heading:
coercer = coerceToHeading
ty = numbers.Real
realType = float
elif ty is Vector:
coercer = coerceToVector
elif ty is veneer.Behavior:
coercer = coerceToBehavior
else:
coercer = None
if isinstance(thing, Distribution):
vt = thing.valueType
if typing.get_origin(vt) is typing.Union:
possibleTypes = typing.get_args(vt)
else:
possibleTypes = (vt,)
if all(issubclass(possible, ty) for possible in possibleTypes):
return thing # no coercion necessary
else:
return TypecheckedDistribution(thing, realType, error, coercer=coercer)
elif coercer:
try:
return coercer(thing)
except CoercionFailure as e:
raise RuntimeParseError(f'{error} ({e.args[0]})') from None
else:
return thing
class CoercionFailure(Exception):
pass
def coerceToFloat(thing) -> float:
return float(thing)
def coerceToHeading(thing) -> float:
if hasattr(thing, 'toHeading'):
return thing.toHeading()
return float(thing)
def coerceToVector(thing) -> Vector:
if isinstance(thing, (tuple, list)):
l = len(thing)
if l != 2:
raise CoercionFailure('expected 2D vector, got '
f'{type(thing).__name__} of length {l}')
return Vector(*thing)
else:
return thing.toVector()
def coerceToBehavior(thing):
import scenic.syntax.veneer as veneer # TODO improve
if thing is None or isinstance(thing, veneer.Behavior):
return thing
else:
assert issubclass(thing, veneer.Behavior)
return thing()
class TypecheckedDistribution(Distribution):
def __init__(self, dist, ty, errorMessage, coercer=None):
super().__init__(dist, valueType=ty)
self.dist = dist
self.errorMessage = errorMessage
self.coercer = coercer
self.loc = saveErrorLocation()
def sampleGiven(self, value):
val = value[self.dist]
suffix = None
if self.coercer:
if canCoerceType(type(val), self.valueType):
try:
return self.coercer(val)
except CoercionFailure as e:
suffix = f' ({e.args[0]})'
elif isinstance(val, self.valueType):
return val
if suffix is None:
suffix = f' (expected {self.valueType.__name__}, got {type(val).__name__})'
raise RuntimeParseError(self.errorMessage + suffix, self.loc)
def conditionTo(self, value):
self.dist.conditionTo(value)
def __repr__(self):
return f'TypecheckedDistribution({self.dist}, {self.valueType})'
def coerceToAny(thing, types, error):
"""Coerce something into any of the given types, printing an error if impossible."""
for ty in types:
if canCoerce(thing, ty):
return coerce(thing, ty, error)
from scenic.syntax.veneer import verbosePrint
verbosePrint(f'Failed to coerce {thing} of type {underlyingType(thing)} to {types}',
file=sys.stderr)
raise RuntimeParseError(error)
## Top-level type checking/conversion API
def toTypes(thing, types, typeError='wrong type'):
"""Convert something to any of the given types, printing an error if impossible."""
if needsLazyEvaluation(thing):
# cannot check the type now; create proxy object to check type after evaluation
return TypeChecker(thing, types, typeError)
else:
return coerceToAny(thing, types, typeError)
def toType(thing, ty, typeError='wrong type'):
"""Convert something to a given type, printing an error if impossible."""
return toTypes(thing, (ty,), typeError)
def toScalar(thing, typeError='non-scalar in scalar context'):
"""Convert something to a scalar, printing an error if impossible."""
return toType(thing, float, typeError)
def toHeading(thing, typeError='non-heading in heading context'):
"""Convert something to a heading, printing an error if impossible."""
return toType(thing, Heading, typeError)
def toVector(thing, typeError='non-vector in vector context'):
"""Convert something to a vector, printing an error if impossible."""
return toType(thing, Vector, typeError)
def evaluateRequiringEqualTypes(func, thingA, thingB, typeError='type mismatch'):
"""Evaluate the func, assuming thingA and thingB have the same type.
If func produces a lazy value, it should not have any required properties beyond
those of thingA and thingB."""
if not needsLazyEvaluation(thingA) and not needsLazyEvaluation(thingB):
if underlyingType(thingA) is not underlyingType(thingB):
raise RuntimeParseError(typeError)
return func()
else:
# cannot check the types now; create proxy object to check types after evaluation
return TypeEqualityChecker(func, thingA, thingB, typeError)
## Proxy objects for lazy type checking
class TypeChecker(DelayedArgument):
"""Checks that a given lazy value has one of a given list of types."""
def __init__(self, arg, types, error):
def check(context):
val = arg.evaluateIn(context)
return coerceToAny(val, types, error)
super().__init__(requiredProperties(arg), check)
self.inner = arg
self.types = types
def __str__(self):
return f'TypeChecker({self.inner},{self.types})'
class TypeEqualityChecker(DelayedArgument):
"""Lazily evaluates a function, after checking that two lazy values have the same type."""
def __init__(self, func, checkA, checkB, error):
props = requiredProperties(checkA) | requiredProperties(checkB)
def check(context):
ca = valueInContext(checkA, context)
cb = valueInContext(checkB, context)
if underlyingType(ca) is not underlyingType(cb):
raise RuntimeParseError(error)
return valueInContext(func(), context)
super().__init__(props, check)
self.inner = func
self.checkA = checkA
self.checkB = checkB
def __str__(self):
return f'TypeEqualityChecker({self.inner},{self.checkA},{self.checkB})'
| StarcoderdataPython |
4826630 | <gh_stars>100-1000
import cocotb
import re
class uvm_hdl():
dut = None
re_brackets = re.compile(r'(\w+)\[(\d+)\]')
@classmethod
def set_dut(cls, dut):
cls.dut = dut
cls.SIM_NAME = cocotb.SIM_NAME
@classmethod
def split_hdl_path(cls, path):
if cls.SIM_NAME == 'Verilator':
res = []
spl = path.split('.')
for name in spl:
match = cls.re_brackets.search(name)
if match is not None:
res.append(match[1])
# Throw exception if Conversion fails
res.append(int(match[2]))
else:
res.append(name)
return res
else:
return path.split('.')
@classmethod
def uvm_hdl_read(cls, path, value):
if cls.dut is not None:
curr_obj = cls.dut
#split = path.split('.')
split = cls.split_hdl_path(path)
for spl in split:
curr_obj = cls.get_next_obj(curr_obj, spl)
if curr_obj is not None:
value.append(int(curr_obj))
return 1
return 0
else:
raise Exception("dut is None. Use uvm_hdl.set_dut(dut) in your @cocotb.test()")
@classmethod
def uvm_hdl_deposit(cls, path, value):
if cls.dut is not None:
curr_obj = cls.dut
#split = path.split('.')
split = cls.split_hdl_path(path)
for spl in split:
curr_obj = cls.get_next_obj(curr_obj, spl)
#if hasattr(curr_obj, spl):
# curr_obj = getattr(curr_obj, spl)
#else:
# continue
if curr_obj is not None:
curr_obj.value = value
return 1
return 0
else:
raise Exception("dut is None. Use uvm_hdl.set_dut(dut) in your @cocotb.test()")
@classmethod
def get_next_obj(cls, curr_obj, spl):
if isinstance(spl, int):
#return curr_obj[spl]
return curr_obj[spl]
elif hasattr(curr_obj, spl):
curr_obj = getattr(curr_obj, spl)
return curr_obj
| StarcoderdataPython |
1657424 | from typing import Iterable, Mapping, TypeVar, Union, Callable
T = TypeVar('T')
R = TypeVar('R')
def iterable_or_varargs(
args: Union[Iterable[T], Iterable[Iterable[T]]],
dispatch: Callable[[Iterable[T]], R] = lambda x: x
) -> R:
assert isinstance(args, Iterable)
if len(args) == 1:
item = args[0]
if isinstance(item, Iterable):
return dispatch(item)
else:
return dispatch([item])
else:
return dispatch(args)
def dict_or_keyword_args(
dictionary: Mapping[str, T],
kwargs: Mapping[str, T],
dispatch: Callable[[Mapping[str, T]], R] = lambda x: x
) -> R:
all_data = dict()
for k in dictionary:
all_data[k] = dictionary[k]
for k in kwargs:
all_data[k] = kwargs[k]
return dispatch(all_data)
def and_then(continuation):
def call_and_then_continue(function):
def wrapper(*args, **kwargs):
result = function(*args, **kwargs)
return continuation(result)
return wrapper
return call_and_then_continue
def apply_to_result(consumer):
def call_and_then_apply(function):
def wrapper(*args, **kwargs):
result = function(*args, **kwargs)
consumer(result)
return result
return wrapper
return call_and_then_apply
| StarcoderdataPython |
157640 | <gh_stars>10-100
from __future__ import annotations
from jsonclasses import jsonclass, types
def check_owner(article: GMArticle, operator: GMAuthor) -> bool:
return article.author.id == operator.id
def check_tier(article: GMArticle, operator: GMAuthor) -> bool:
return operator.paid_user
@jsonclass
class GMAuthor:
id: str
name: str
paid_user: bool
articles: list[GMArticle] = types.listof('GMArticle').linkedby('author') \
.required
@jsonclass(can_create=[check_owner, check_tier])
class GMArticle:
name: str
content: str
author: GMAuthor
| StarcoderdataPython |
1670676 | import matplotlib
matplotlib.use('Agg')
import os
import time
import itertools
import json
import requests
from flask import Blueprint, request, jsonify, render_template, make_response, send_file
from flask_jwt_extended import jwt_required
from utils.connect import client, db, fs
from itertools import chain
from collections import Counter
import matplotlib.pyplot as plt
from fpdf import FPDF
from bson import ObjectId
import seaborn as sns
import pandas as pd
import io
import base64
import datetime
from matplotlib.backends.backend_agg import FigureCanvasAgg
from bson.json_util import dumps
report = Blueprint("report", __name__)
'''-----------------------------------
support functions
-----------------------------------'''
"""Implementation of perl's autovivification feature.(Wrapper-Function)"""
class AutoVivification(dict):
def __getitem__(self, item):
try:
return dict.__getitem__(self, item)
except KeyError:
value = self[item] = type(self)()
return value
class PDF(FPDF):
def header(self):
# Logo
self.image('logo512.png', 10, 8, 15)
# Arial bold 15
self.set_font('Arial', 'B', 16)
# Move to the right
self.cell(80)
# Title
self.cell(30, 10, 'Gearstalk Report', 0, 0, 'C')
# Line break
self.ln(20)
# Page footer
def footer(self):
# Position at 1.5 cm from bottom
self.set_y(-15)
# Arial italic 8
self.set_font('Arial', 'I', 8)
# Page number
self.cell(0, 10, 'Page ' + str(self.page_no()) + '/{nb}', 0, 0, 'C')
def image_to_buffer(plt_image):
buf = io.BytesIO()
plt_image.savefig(buf, format="png", dpi=180)
return buf
def videoPDF_format(video,line_chart,linechart_buf,heatmap_buf,piechart_buf):
pdf=PDF()
pdf.alias_nb_pages()
pdf.add_page()
image_w,image_h = 100,80
pdf.set_font('Times','B',14.0)
pdf.cell(0, 30, txt="A Tabular and Graphical Report of number of people identified in the video", ln = 1, align = 'C')
image_w,image_h = 140,140
data =[]
for x in video:
data.append(["Name of Video",x['name']])
data.append(["Date",x['date']])
data.append(["Time",x['time']])
data.append(["Duration of the video",x['duration']])
location = db.cctv.find({"_id" : ObjectId(x['location_id'])})
for y in location:
# data.append(["Address", y['formatted_address']])
data.append(["Street",y['street']])
data.append(["City", y['city']])
data.append(["State", y['state']])
data.append(["Country", y['country']])
data.append(['Postal Code', y['postal_code']])
data.append(["Latitude", y['latitude']])
data.append(["Longitude", y['longitude']])
df = pd.DataFrame(data,columns=['Question','Answer'])
# print(df)
for i in range(0, len(df)):
pdf.cell(80, 18, '%s' % (df['Question'].iloc[i]), 1, 0, 'C')
pdf.cell(110, 18, '%s' % (df['Answer'].iloc[i]), 1, 1, 'C')
# pdf.cell(-90)
pdf.add_page()
pdf.cell(0, 30, txt="A Tabular and Graphical Report of number of people identified in the video", ln = 1, align = 'C')
pdf.image(piechart_buf, x=35, y=60, w=image_w, h=image_h)
pdf.ln(1*image_h+15)
pdf.multi_cell(0,10, "This pie chart shows the result of a cctv surveillance camera, scanned frame by frame for clothing attributes. The video showcased a number of people wearing various clothing accessories. The different attributes identified are blazers, jeans, sweaters, scarfs, sarees, caps, shirts, jerseys, pants, etc.",0, 3 , 'L')
pdf.add_page()
pdf.cell(0, 30, txt="A Tabular and Graphical Report of Realation between labels and colors in the video", ln = 1, align = 'C')
pdf.image(heatmap_buf, x=25, y=70, w=image_w + 40, h=image_h)
pdf.ln(1*image_h+15)
pdf.multi_cell(0,10,'The heat map is a data visualization technique that shows magnitude of a phenomenon as colour in two dimensions. This one in particular highlights the relationship between labels and their respective colours. The colours of respective clothing accessories like jeans,shirts,sweaters,etc range from various hues of grey,blue,brown and silver.', 0, 1,'L')
pdf.add_page()
pdf.cell(0, 30, txt="A Tabular and Graphical Report of Realation between labels and colors in the video", ln = 1, align = 'C')
pdf.image(linechart_buf, x=25, y=70, w=image_w + 40, h=image_h)
pdf.ln(1*image_h+15)
pdf.multi_cell(0,10,"A line graph is a graphical display of information that changes continuously over time. In this case the graph displays the number of people in the video at particular timestamps.", 0, 1, 'L')
pdf.ln(30)
pdf.cell(0,10," Maximum Number of people in any frame of the video = {}".format(max(line_chart.values())) , 0, 1, "L")
image_array = []
return pdf.output(dest='S')
def searchPDF_format(report, user):
data =[]
for x in report['results']:
instance = []
if not x:
# print("List is empty")
pass
else:
for i in x:
y = {}
y.update({'Date':i['date']})
y.update({'Time':i['time']})
y.update({'City':i['city']})
y.update({'SubLocality':i['sublocality']})
y.update({'State':i['state']})
y.update({'Country':i['country']})
y.update({'Labels':i['labels']})
y.update({'Colours':i['colors']})
instance.append(y)
data.append(instance)
pdf=PDF()
pdf.alias_nb_pages()
pdf.add_page()
pdf.set_font('Arial','B',15)
pdf.cell(71 ,5,'',0,0)
pdf.cell(59 ,5,'',0,0)
pdf.cell(59 ,5,'Details',0,1)
pdf.set_font('Arial','',10)
pdf.cell(130 ,5,'Date: {}'.format(report['Date']),0,0)
pdf.cell(25 ,5,'UserName:',0,0)
pdf.cell(34 ,5,user['first_name'],0,1)
pdf.cell(130 ,5,'Time: {}'.format(report['Time']),0,0)
pdf.cell(25 ,5,'E-mail ID:',0,0)
pdf.cell(34 ,5,user['email'],0,1)
pdf.cell(130 ,5,'',0,0)
pdf.cell(25 ,5,'Report No:',0,0)
pdf.cell(34 ,5,report['name'],0,1)
pdf.set_font('Times','B',15.0)
pdf.cell(0,20, "Search Results", 0, 1, 'C')
for i in range(len(data)):
pdf.set_font('Times','B',14.0)
pdf.cell(150, 10, 'Results for Person '+ str(i+1) +' of Search Query', 0, 2, 'L')
pdf.cell(150, 10,'', 0, 2, 'C')
if data[i]==[]:
pdf.set_x(pdf.get_x()+75)
pdf.set_font('Times','B',14.0)
pdf.cell(0,10,"Person "+str(i+1)+" : NOT FOUND!!", 0, 1, "L")
pdf.cell(0,10," ", 0, 1, "L")
else:
for row in range(len(data[i])):
pdf.set_x(pdf.get_x()+20)
pdf.set_font('Times','',12.0)
pdf.set_fill_color(56, 158, 201)
pdf.cell(150, 10, 'Person: ' + str(row + 1)+ ' Details', 0, 2, 'C', fill=True)
pdf.set_fill_color(224, 224, 224)
pdf.cell(74 ,5,'Date',0,0,'C',fill=True)
pdf.cell(2 ,5,'-',0,0,'C',fill=True)
pdf.cell(74 ,5,data[i][row]['Date'],0,1,'C',fill=True)
pdf.set_x(pdf.get_x()+20)
pdf.cell(74 ,5,'Time',0,0,'C',fill=True)
pdf.cell(2 ,5,'-',0,0,'C',fill=True)
pdf.cell(74 ,5,data[i][row]['Time'],0,1,'C',fill=True)
pdf.set_x(pdf.get_x()+20)
pdf.cell(74 ,5,'SubLocality',0,0,'C',fill=True)
pdf.cell(2 ,5,'-',0,0,'C',fill=True)
pdf.cell(74 ,5,data[i][row]['SubLocality'] +', '+ data[i][row]['City'],0,1,'C',fill=True)
pdf.set_x(pdf.get_x()+20)
pdf.cell(74 ,5,'State',0,0,'C',fill=True)
pdf.cell(2 ,5,'-',0,0,'C',fill=True)
pdf.cell(74 ,5,data[i][row]['State']+', '+ data[i][row]['Country'],0,1,'C',fill=True)
pdf.set_x(pdf.get_x()+20)
pdf.cell(74 ,5,'Labels',0,0,'C',fill=True)
pdf.cell(2 ,5,'-',0,0,'C',fill=True)
pdf.cell(74 ,5,str(", ".join(data[i][row]['Labels'])),0,1,'C',fill=True)
pdf.set_x(pdf.get_x()+20)
pdf.cell(74 ,5,'Colors',0,0,'C',fill=True)
pdf.cell(2 ,5,'-',0,0,'C',fill=True)
pdf.cell(74 ,5,str(", ".join(data[i][row]['Colours'])),0,1,'C',fill=True)
pdf.cell(150, 10,'', 0, 2, 'C')
if(i < len(data)-1):
pdf.add_page()
return pdf.output(dest='S')
'''-----------------------------------
report-crud
-----------------------------------'''
@report.route('/getreport/<oid>', methods=['GET'])
@jwt_required
def getReport(oid):
if oid == None:
return jsonify({"success": False, "message": "No Object Id in param."}), 400
if "report" not in db.list_collection_names():
return jsonify([]), 200
else:
reports = list(db.report.find({"userId": oid}))
return dumps(reports), 200
@report.route('/addreport', methods=['POST'])
@jwt_required
def addReport():
report = json.loads(request.data)
if report == None:
return jsonify({"success": False, "message": "No data found in request."}), 400
# try:
timestamp = datetime.datetime.now()
report['Date'] = datetime.datetime.strftime(timestamp,"%d %B %Y, %A")
report['Time'] = datetime.datetime.strftime(timestamp,"%I:%M %p")
res = db.report.insert_one(report)
oid = res.inserted_id
## Oid received. Generate PDF Report from oid
newReport = db.report.find_one({ "_id": ObjectId(oid)})
user = db.users.find_one({"_id": ObjectId(report['userId'])})
pdf_str = searchPDF_format(newReport, user)
response = make_response(pdf_str)
response.headers['Content-Disposition'] = "attachment; filename='report.pdf"
response.mimetype = 'application/pdf'
return response, 200
@report.route('/generatereport/<oid>', methods=['GET'])
@jwt_required
def generateReport(oid):
try:
if oid == None or len(oid) != 24:
return jsonify({"success": False, "message": "No Object Id in param."}), 400
elif "report" not in db.list_collection_names():
return jsonify({"success": False, "message": "No Collection report."}), 404
else:
report = db.report.find_one({ "_id": ObjectId(oid)})
user = db.users.find_one({"_id": ObjectId(report['userId'])})
#generate report
pdf_str = searchPDF_format(report, user)
response = make_response(pdf_str)
response.headers['Content-Disposition'] = "attachment; filename='report.pdf"
response.mimetype = 'application/pdf'
return response, 200
except Exception as e:
return f"An Error Occured: {e}"
@report.route('/searchreport/<oid>', methods=['GET'])
def search_report(oid):
try:
if oid == None or len(oid) != 24:
return jsonify({"success": False, "message": "No Object Id in param."}), 400
elif "unique_person" not in db.list_collection_names():
return jsonify({"success": False, "message": "No Collection features."}), 404
else:
return jsonify({"status": True, "message": "Report Generated", "Attachment": response}), 200
except Exception as e:
return f"An Error Occured: {e}"
@report.route('/deletereport/<oid>', methods=['DELETE'])
@jwt_required
def deleteReport(oid):
if oid == None:
return jsonify({"success": False, "message": "No Object Id in param."}), 400
else:
if "report" not in db.list_collection_names():
return jsonify({"success": False, "message": "No Collection report."}), 404
else:
result = db.report.delete_one({"_id": ObjectId(oid)})
if (result.deleted_count) > 0:
return jsonify({"success": True, "message": "Report successfully deleted."}), 200
else:
return jsonify({"success": False, "message": "Report with provided id doesn't exist."}), 404
'''-----------------------------------
video-report
-----------------------------------'''
@report.route('/generatevideoreport/<oid>', methods=['GET'])
@jwt_required
def generateVideoReport(oid):
try:
if oid == None or len(oid) != 24:
return jsonify({"success": False, "message": "No Object Id in param."}), 400
elif "unique_person" not in db.list_collection_names():
return jsonify({"success": False, "message": "No Collection features."}), 404
else:
#query db
feature = db.features.find_one({ "video_id": oid})
data = db.unique_person.find({"video_id": oid},{"labels":1, "colors":1,"_id":0})
video = db.video.find({"_id" : ObjectId(oid)})
#line chart
line_chart = { x['frame_sec'] : len(json.loads(x['persons'])) for x in feature['metadata']}
# print(line_chart)
#plotting
plt.plot(list(line_chart.keys()), list(line_chart.values()))
plt.title('TimeFrame Vs No. of persons')
plt.xlabel('TimeFrame')
plt.ylabel('No. of persons')
# plt.savefig("line.pdf")
linechart_buf = image_to_buffer(plt)
#heat Map
new_data = [ [x+','+y for x,y in zip(t['labels'],t['colors'])] for t in data]
meta = [_ for i in range(len(new_data)) for _ in new_data[i]]
cc = Counter(meta)
colors = [ key.split(",")[1] for key in cc]
features=AutoVivification()
for key in cc:
if key.split(",")[0] not in features.keys():
for x in colors:
features[key.split(",")[0]][x] = 0
features[key.split(",")[0]][key.split(",")[1]] = cc[key]
# print(features)
corr = [ list(val.values()) for val in features.values()]
#plotting
fig = plt.figure(figsize=(12,10), dpi= 80,facecolor=(1, 1, 1))
sns.heatmap(corr, xticklabels=list(list(features.values())[0].keys()), yticklabels=list(features.keys()), cmap='RdYlGn', center=0, annot=True)
plt.title('Relationship between Labels and resp. Colors', fontsize=14)
plt.xticks(fontsize=8)
plt.yticks(fontsize=8)
# plt.savefig("heat.pdf")
heatmap_buf = image_to_buffer(plt)
#pie chart
pie_chart = Counter(list(chain(*[ list(chain(*[ x['labels'] for x in json.loads(metadata['persons'])])) for metadata in feature['metadata']])))
#plotting
# print(pie_chart)
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
ax.axis('equal')
ax.pie(list(pie_chart.values()), labels = list(pie_chart.keys()),autopct='%1.2f%%')
# pl.savefig("pie.pdf")
piechart_buf = image_to_buffer(plt)
#generate_pdf
pdf_str = videoPDF_format(video,line_chart,linechart_buf,heatmap_buf,piechart_buf)
response = make_response(pdf_str)
response.headers['Content-Disposition'] = "attachment; filename='report.pdf"
response.mimetype = 'application/pdf'
linechart_buf.truncate(0)
piechart_buf.truncate(0)
heatmap_buf.truncate(0)
plt.clf()
return response, 200
except Exception as e:
return f"An Error Occured: {e}" | StarcoderdataPython |
1601230 | from django.apps import AppConfig
class DemoConfig(AppConfig):
name = "openpersonen.contrib.demo"
verbose_name = "Demo backend"
| StarcoderdataPython |
112651 | <filename>app/services/RelationService.py
from typing import Generator
from rdflib import BNode, Graph, Literal, URIRef
from rdflib.collection import Collection
from rdflib.namespace import OWL, RDF
from rdflib.plugins.sparql import prepareQuery
from rdflib.plugins.sparql.processor import SPARQLResult
from models.namespaces import nhterm
GET_ITEMS_QUERY = """
SELECT DISTINCT ?item
WHERE {
?item a nhterm:Item .
}
"""
GET_RELATIONS_QUERY = """
SELECT DISTINCT ?item ?entity1 ?relation ?entity2
WHERE {
?item nhterm:hasAnnotation/nhterm:hasEntity ?entity1 .
?item nhterm:hasAnnotation/nhterm:hasEntity ?entity2 .
?entity1 owl:sameAs ?entity_external1 .
?entity2 owl:sameAs ?entity_external2 .
?entity_external1 ?relation ?entity_external2 .
}
"""
GET_PC_RELATIONS_QUERY = """
SELECT DISTINCT ?item ?entity1 ?predicate ?entity2 ?obj
WHERE {
?item nhterm:hasAnnotation/nhterm:hasEntity ?entity1 .
?item nhterm:hasAnnotation/nhterm:hasEntity ?entity2 .
?entity1 owl:sameAs ?entity_external1 .
?entity2 owl:sameAs ?entity_external2 .
?entity_external1 ?predicate ?obj .
?entity_external2 ?predicate ?obj .
FILTER(?entity1 != ?entity2)
}
"""
class RelationService:
"""Service used to add RelationAnnotations to the result"""
_ANNOTATOR = URIRef("https://www.wikidata.org/wiki/Q106226082")
def __init__(self, graph: Graph):
self._graph = graph
def _get_items(self) -> Generator[URIRef, None, None]:
"""Generator which yields all item identifiers in the graph"""
qres = self._graph.query(GET_ITEMS_QUERY)
for (item,) in qres:
yield item
def _get_relations(self, item: URIRef) -> SPARQLResult:
"""
Get regular 1:1 relations between two entities whitin the same item.
Return SPARQLResult in the following format: (item, entity1, relation, entity2)
"""
query = prepareQuery(GET_RELATIONS_QUERY, initNs={"nhterm": nhterm, "owl": OWL})
qres = self._graph.query(query, initBindings={'item': item})
return qres
def _get_pc_relations(self, item: URIRef) -> SPARQLResult:
"""Get entities that share a common property and object"""
query = prepareQuery(GET_PC_RELATIONS_QUERY, initNs={"nhterm": nhterm, "owl": OWL})
qres = self._graph.query(query, initBindings={'item': item})
return qres
@staticmethod
def _get_unique_key(*args) -> hash:
"""Hash all arguments, sum the hashes, then return the hash of the sum."""
res = 0
for arg in args:
res += hash(arg)
return hash(res)
def _prepare_pc_relations(self, relations: SPARQLResult) -> dict:
"""
Transform the rdflib SPARQLResult object to a dictionary.
The dictionary uses a hash of some of the variables as keys, the values are dictionaries. (See get_dict())
Example input:
[
{
item: <some GUID>,
entity1: yago4:Paris,
entity2: yago4:Berlin,
predicate: rdfs:type,
object: yago4:City
},
{
item: <some GUID>,
entity1: yago4:London,
entity2: yago4:Oslo,
predicate: rdfs:type,
object: yago4:City
}
]
Produces the following dict:
{
<some hash>: {
predicate: rdfs:type,
obj: yago4:City,
entities: {yago4:Paris, yago4:Berlin, yago4:London, yago4:Oslo},
item: <some GUID>
}
}
"""
prepared_relations = dict()
for (item, entity1, predicate, entity2, obj) in relations:
def get_dict() -> dict:
return {
"predicate": predicate,
"obj": obj,
"entities": set(),
"item": item
}
# Use a hash of predicate, obj and item for the key. Those vaules should stay the same, while the entities may change.
key = self._get_unique_key(predicate, obj, item)
current_item = prepared_relations.setdefault(key, get_dict())
current_item["entities"].update([entity1, entity2])
return prepared_relations
def _add_shared_pc_relations(self, relations: SPARQLResult) -> None:
"""Add the obtained predicate object relations to the graph"""
prepared_relations = self._prepare_pc_relations(relations)
for item in prepared_relations.values():
relationAnnotation = BNode()
self._graph.add((item["item"], nhterm.hasAnnotation, relationAnnotation))
self._graph.add((relationAnnotation, RDF.type, nhterm.SharedPredicateObjectRelation))
self._graph.add((relationAnnotation, nhterm.hasAnnotator, self._ANNOTATOR))
self._graph.add((relationAnnotation, nhterm.predicate, item["predicate"]))
self._graph.add((relationAnnotation, nhterm.object, item["obj"]))
entities = BNode()
self._graph.add((relationAnnotation, nhterm.entities, entities))
Collection(self._graph, entities, list(item["entities"]))
def _add_relations(self, relations: SPARQLResult) -> None:
"""Add the relations to the internal graph"""
for (item, entity1, relation, entity2) in relations:
relationAnnotation = BNode()
self._graph.add((item, nhterm.hasAnnotation, relationAnnotation))
self._graph.add((relationAnnotation, RDF.type, nhterm.StandardRelation))
self._graph.add((relationAnnotation, nhterm.hasAnnotator, self._ANNOTATOR))
self._graph.add((relationAnnotation, nhterm.relationFrom, entity1))
self._graph.add((relationAnnotation, nhterm.relationTo, entity2))
self._graph.add((relationAnnotation, nhterm.hasRelation, relation))
def annotate_relations(self) -> None:
for item in self._get_items():
relations = self._get_relations(item)
self._add_relations(relations)
shared_relations = self._get_pc_relations(item)
self._add_shared_pc_relations(shared_relations)
| StarcoderdataPython |
1698002 | <gh_stars>0
#!/usr/bin/env python
# encoding=utf-8
"""
created by maxuewei2
"""
from PIL import Image, ImageFilter
import os
import math
import time
"""
针对分辨率为1920*1080,分辨率不同请自行修改代码
"""
man_colors = [[85, 77, 125], [64, 66, 91], [86, 76, 124], [64, 51, 86], [54, 60, 102]]
man_colors = [tuple(x) for x in man_colors]
center_point = (560, 980)
Y = 1920
X = 1080
def distance(a, b):
return sum([(a[i] - b[i])**2 for i in range(len(a))])
def is_equal(a, b):
return sum(distance(a[i], b[i]) for i in range(len(a))) < 200
def get_man_point(rgb_im):
bias_nums = [35, 31, 60, 58]
for y in range(700, Y):
for x in range(X):
bias = 0
color = rgb_im.getpixel((x, y))
if distance(color, man_colors[0]) > 50:
continue
colors = []
colors.append(color)
for bias_n in bias_nums:
bias += bias_n
if y + bias >= Y:
break
colors.append(rgb_im.getpixel((x, y + bias)))
if is_equal(colors, man_colors):
y = y + bias - 9
return (x, y)
print('没能找到小人位置,请手动跳一次然后再次运行本程序')
exit(0)
def get_highest_point(rgb_im, man_point):
if man_point[0] < center_point[0]:
start, end = center_point[0], X
else:
start, end = 0, center_point[0]
for i in range(300, Y):
for j in range(start, end):
if distance(rgb_im.getpixel((j, i)), rgb_im.getpixel((start, i))) > 300:
return (j, i)
def get_dest_point(man_point, center_point, highest_x):
slope = (man_point[1] - center_point[1]) / (man_point[0] - center_point[0])
bias = man_point[1] - (slope * man_point[0])
dest_y = slope * highest_x + bias
return (highest_x, dest_y)
if __name__ == '__main__':
scs = os.listdir('.')
scs = [x for x in scs if x.startswith('sc_')]
scs = [x[3:-4] for x in scs]
scs = [int(x) for x in scs]
start_num = max(scs) + 1 if scs else 0
print('screenshot file name starts from ', start_num)
for i in range(10000):
print('第 %d 跳' %(i+1))
imgname = 'sc_' + str(start_num + i) + '.png'
os.system('adb shell screencap -p |sed \'s/\r$//\'>' + imgname)
im = Image.open(imgname)
rgb_im = im.convert('RGB')
man_p = get_man_point(rgb_im)
print('小人:\t', man_p)
highest_p = get_highest_point(rgb_im, man_p)
print('最高点:\t', highest_p)
dest_p = get_dest_point(man_p, center_point, highest_p[0])
print('目标点:\t' ,dest_p)
press_time = int(math.sqrt((man_p[0] - dest_p[0])**2 + (man_p[1] - dest_p[1])**2) * 1.363)
os.system('adb shell input swipe 500 500 500 500 ' + str(press_time))
time.sleep(2)
| StarcoderdataPython |
1610790 | class Queue:
def __init__(self):
self.items = []
def enqueue(self, node):
self.items.append(node)
def sortedEnqueue(self, node):
i = 0
while i < len(self.items) and self.items[i].f <= node.f:
i = i + 1
self.items.insert(i, node)
def dequeue(self):
return self.items.pop(0) # updated
def isEmpty(self):
if len(self.items) == 0 : return True
else: return False
class Problem:
def __init__(self, i, g, m):
self.initState = i
self.goalState = g
self.model = m
def isGoal(self, s):
if self.goalState == s:
return True
else:
return False
def sucFN(self, city):
return self.model.get(city, [])
class Node:
def __init__(self,s, p, c, d, h):
self.state = s
self.parent = p
self.cost = c
self.depth = d
self.f = h + self.cost
def solutionPath(self):
path = self.state
if self.depth == 0:
return path
else:
return path + ' <-- ' + self.parent.solutionPath()
def __str__(self):
return 'S: ' + self.state + ', depth = ' + str(self.depth) + ', cost = ' + str(self.cost)
class Astar:
def __init__(self, p, hmap):
self.numberGeneratedNodes = 0
self.prob = p
self.frontier = Queue()
self.visited = set()
self.hmap = hmap
def expand(self, parent):
children = []
for i in self.prob.sucFN(parent.state):
s = Node(i[0], parent, i[1] + parent.cost, parent.depth + 1, self.hmap[i[0]] )
print('CHILD generated', i[0])
children.append(s)
self.numberGeneratedNodes += len(children)
return children
def solution(self):e
root = Node(self.prob.initState, None, 0, 0, self.hmap[self.prob.initState])
self.frontier.enqueue(root)
while not self.frontier.isEmpty():
parent = self.frontier.dequeue()
self.visited.add(parent.state)
if self.prob.isGoal(parent.state):
return parent
expandedNodes = self.expand(parent)
for i in expandedNodes:
print('CHECKING CHILD', i.state)
if i.state not in self.visited:
self.frontier.sortedEnqueue(i)
print('CHILD ADDED')
return False
| StarcoderdataPython |
4838812 | """Data pipelines based on efficient video reading by nvidia dali package."""
import cv2
from nvidia.dali import pipeline_def
import nvidia.dali.fn as fn
from nvidia.dali.pipeline import Pipeline
from nvidia.dali.plugin.pytorch import DALIGenericIterator
import nvidia.dali.types as types
import torch
from typeguard import typechecked
from typing import List, Optional, Union
from lightning_pose.data import _IMAGENET_MEAN, _IMAGENET_STD
_DALI_DEVICE = "gpu" if torch.cuda.is_available() else "cpu"
# cannot typecheck due to way pipeline_def decorator consumes additional args
@pipeline_def
def video_pipe(
filenames: Union[List[str], str],
resize_dims: Optional[List[int]] = None,
random_shuffle: bool = False,
seed: int = 123456,
sequence_length: int = 16,
pad_sequences: bool = True,
initial_fill: int = 16,
normalization_mean: List[float] = _IMAGENET_MEAN,
normalization_std: List[float] = _IMAGENET_STD,
device: str = _DALI_DEVICE,
name: str = "reader",
# arguments consumed by decorator:
# batch_size,
# num_threads,
# device_id
) -> Pipeline:
"""Generic video reader pipeline that loads videos, resizes, and normalizes.
Args:
filenames: list of absolute paths of video files to feed through
pipeline
resize_dims: [height, width] to resize raw frames
random_shuffle: True to grab random batches of frames from videos;
False to sequential read
seed: random seed when `random_shuffle` is True
sequence_length: number of frames to load per sequence
pad_sequences: allows creation of incomplete sequences if there is an
insufficient number of frames at the very end of the video
initial_fill: size of the buffer that is used for random shuffling
normalization_mean: mean values in (0, 1) to subtract from each channel
normalization_std: standard deviation values to subtract from each
channel
device: "cpu" | "gpu"
name: pipeline name, used to string together DataNode elements
Returns:
pipeline object to be fed to DALIGenericIterator
"""
video = fn.readers.video(
device=device,
filenames=filenames,
random_shuffle=random_shuffle,
seed=seed,
sequence_length=sequence_length,
pad_sequences=pad_sequences,
initial_fill=initial_fill,
normalized=False,
name=name,
dtype=types.DALIDataType.FLOAT,
)
if resize_dims:
video = fn.resize(video, size=resize_dims)
# video pixel range is [0, 255]; transform it to [0, 1].
# happens naturally in the torchvision transform to tensor.
video = video / 255.0
# permute dimensions and normalize to imagenet statistics
transform = fn.crop_mirror_normalize(
video,
output_layout="FCHW",
mean=normalization_mean,
std=normalization_std,
)
return transform
class LightningWrapper(DALIGenericIterator):
"""wrapper around a DALI pipeline to get batches for ptl."""
def __init__(self, *kargs, **kwargs):
# collect number of batches computed outside of class
self.num_batches = kwargs.pop("num_batches", 1)
# call parent
super().__init__(*kargs, **kwargs)
def __len__(self):
return self.num_batches
def __next__(self):
out = super().__next__()
return torch.tensor(
out[0]["x"][0, :, :, :, :], # should be (sequence_length, 3, H, W)
dtype=torch.float,
) # careful: only valid for one sequence, i.e., batch size of 1.
| StarcoderdataPython |
45653 | <filename>tutorials/basics/g_code_listing_01.py
r"""
Basic workflow
==============
This examples demonstrates a basic workflow using the `py-fmas` library code.
.. codeauthor:: <NAME> <<EMAIL>>
"""
###############################################################################
# We start by simply importing the required `fmas` into the current namespace.
#
import fmas
###############################################################################
# If an adequate input file is located within the current working directory,
# the function `read_h5`, located in module `data_io`, can be used to read-in
# the propagation setting stored in the input file `input_file.h5`:
glob = fmas.data_io.read_h5('input_file.h5')
###############################################################################
# Next, the problem specific data structures, given by the computational grid
# and the propagation model, can be initialized:
grid = fmas.grid.Grid(
t_max = glob.t_max,
t_num = glob.t_num,
z_max = glob.z_max,
z_num = glob.z_num)
model = fmas.models.FMAS_S_R(
w = grid.w,
beta_w = glob.beta_w,
n2 = glob.n2,
fR = glob.fR,
tau1 = glob.tau1,
tau2 = glob.tau2)
###############################################################################
# The provided initial condition, which represents the real-valued optical
# field can be converted to the complex-valued analytic signal as shown below:
ic = fmas.analytic_signal.AS(glob.E_0t)
###############################################################################
# Below we implement a user-action function that can be passed to the
# propagation algorithm. Upon propagation it will evaluated at every
# :math:`z`-step
import numpy as np
def Cp(i, zi, w, uw):
Iw = np.abs(uw)**2
return np.sum(Iw[w>0]/w[w>0])
###############################################################################
# Next, we initialzize the :math:`z`-propagation algorithm, given by the
# `Runge-Kutta in the interaction picture` (RK4IP) method, set the initial
# condition, and perform :math:`z`-propagation:
solver = fmas.solver.IFM_RK4IP(
model.Lw, model.Nw,
user_action = Cp)
solver.set_initial_condition(
grid.w, ic.w_rep)
solver.propagate(
z_range = glob.z_max,
n_steps = glob.z_num,
n_skip = glob.z_skip)
###############################################################################
# After the propagation algorithm has terminated, the generated simulation data
# can be stored within an output file in HDF5-format. Therefore, the data is
# organized as dictionary with custom keys for the stored data objects, which
# is then passed to the function `save_h5` implemented in module `data_io`:
res = {
"t": grid.t,
"z": solver.z,
"w": solver.w,
"u": solver.utz,
"Cp": solver.ua_vals}
fmas.data_io.save_h5('out_file.h5', **res)
###############################################################################
# A simple plot of the generated data can be obtained using convenience functions
# implemented in module `tools`:
fmas.tools.plot_evolution(
solver.z, grid.t, solver.utz,
t_lim = (-500,2200), w_lim = (1.,4.))
| StarcoderdataPython |
116148 | <gh_stars>1-10
from setuptools import setup, find_packages
DESCRIPTION = 'Ensures loading of specified app modules.'
LONG_DESCRIPTION = None
setup(name='django-autoload',
version='0.01',
packages=find_packages(exclude=('tests', 'tests.*',
'base_project', 'base_project.*')),
author='<NAME>',
author_email='<EMAIL>',
url='http://www.allbuttonspressed.com/',
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
platforms=['any'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Application Frameworks',
'Topic :: Software Development :: Libraries :: Python Modules',
'License :: OSI Approved :: BSD License',
],
)
| StarcoderdataPython |
1696129 | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Serializers for Masu sources API."""
from rest_framework import serializers
from api.iam.models import Customer
from api.provider.models import Provider
from api.provider.models import ProviderInfrastructureMap
from api.provider.models import Sources
class CustomerSerializer(serializers.Serializer):
"""Serializer for Customer."""
class Meta:
model = Customer
id = serializers.IntegerField()
schema_name = serializers.CharField()
class ProviderInfrastructureSerializer(serializers.Serializer):
"""Serializer for ProviderInfrastructureMap."""
class Meta:
model = ProviderInfrastructureMap
id = serializers.IntegerField()
infrastructure_type = serializers.CharField()
infrastructure_provider_id = serializers.UUIDField()
class ProviderSerializer(serializers.Serializer):
"""Serializer for Provider."""
class Meta:
model = Provider
uuid = serializers.UUIDField()
setup_complete = serializers.BooleanField()
created_timestamp = serializers.DateTimeField()
data_updated_timestamp = serializers.DateTimeField()
active = serializers.BooleanField()
paused = serializers.BooleanField()
customer = CustomerSerializer()
infrastructure = ProviderInfrastructureSerializer(required=False)
class SourceSerializer(serializers.Serializer):
"""Serializer for Soruces."""
class Meta:
model = Sources
source_id = serializers.IntegerField()
source_uuid = serializers.UUIDField()
name = serializers.CharField()
auth_header = serializers.CharField()
offset = serializers.IntegerField()
account_id = serializers.CharField()
source_type = serializers.CharField()
authentication = serializers.JSONField()
billing_source = serializers.JSONField()
koku_uuid = serializers.UUIDField()
pending_delete = serializers.BooleanField()
pending_update = serializers.BooleanField()
out_of_order_delete = serializers.BooleanField()
status = serializers.JSONField()
paused = serializers.BooleanField()
provider = ProviderSerializer()
| StarcoderdataPython |
3387225 | import torch
import torch.nn as nn
from arch_resnet38 import Resnet38
import torch.nn.functional as F
from torchvision import transforms
import numpy as np
import imutils
import os
import re
class BaseModel(nn.Module):
def initialize_weights(self):
for m in self.modules():
if isinstance(m, nn.Conv2d):
nn.init.kaiming_normal(m.weight)
if m.bias is not None:
m.bias.data.zero_()
elif isinstance(m, nn.BatchNorm2d):
m.weight.data.fill_(1)
m.bias.data.zero_()
def load_resnet38_weights(self, filepath):
print(filepath, os.path.exists(filepath))
if os.path.exists(filepath):
state_dict = torch.load(filepath)
new_params = self.state_dict().copy()
for i in new_params:
i_parts = i.split('.')
for i in state_dict:
i_parts = i.split('.')
if re.fullmatch('(fc8)', i_parts[0]):
pass
else:
tmp=i_parts.copy()
tmp.insert(0,'encoder')
tmp='.'.join(tmp)
new_params[tmp] = state_dict[i]
self.load_state_dict(new_params)
def train(self, mode=True):
super().train(mode)
for layer in self.modules():
if isinstance(layer, torch.nn.BatchNorm2d):
layer.eval()
layer.bias.requires_grad = False
layer.weight.requires_grad = False
class SegBaseModel(BaseModel):
def __init__(self, config):
super(SegBaseModel, self).__init__()
self.config = config
self.encoder=Resnet38()
def get_crf(self, img_org, seg, gt_class_mlabel):
img_org=img_org.data.cpu().numpy().astype(np.uint8)
seg_crf=np.zeros((seg.shape[0],seg.shape[1],self.config.OUT_SHAPE[0],self.config.OUT_SHAPE[1]))
for i in range(len(seg)):
prob=[]
for j in range(gt_class_mlabel.shape[1]):
if gt_class_mlabel[i,j].item()==1:
prob.append(seg[i,j:j+1])
prob=F.softmax(torch.cat(prob),dim=0).data.cpu().numpy()
crf_map = imutils.crf_inference(img_org[i].copy(order='C'),prob,labels=prob.shape[0])
cnt=0
for j in range(gt_class_mlabel.shape[1]):
if gt_class_mlabel[i,j].item()==1:
seg_crf[i][j]=crf_map[cnt]
cnt += 1
seg_crf=torch.from_numpy(seg_crf).cuda().float()
_, seg_crf_mask=torch.max(seg_crf,1)
return seg_crf, seg_crf_mask
def get_seg(self, segment_module, x5, gt_class_mlabel):
seg, seg_head = segment_module(x5)
seg_prob=F.softmax(seg,dim=1)
gt_class_mlabel_maps = gt_class_mlabel.view(gt_class_mlabel.shape[0],gt_class_mlabel.shape[1],1,1).repeat(1,1,seg.shape[2],seg.shape[3])
seg_prob=seg_prob*gt_class_mlabel_maps+gt_class_mlabel_maps*1e-4
_,seg_mask = torch.max(seg_prob,1)
return (seg, seg_prob, seg_mask, seg_head)
class SSDDBaseModel(BaseModel):
def __init__(self, config):
super(SSDDBaseModel, self).__init__()
self.config = config
class PascalDataset(torch.utils.data.Dataset):
def __init__(self, dataset, config):
self.image_ids = np.copy(dataset.image_ids)
self.dataset = dataset
self.config = config
self.mean=(0.485, 0.456, 0.406)
self.std=(0.229, 0.224, 0.225)
self.joint_transform_list=[
None,
imutils.RandomHorizontalFlip(),
imutils.RandomResizeLong(512, 832),
imutils.RandomCrop(448),
None,
]
self.img_transform_list=[
transforms.ColorJitter(brightness=0.3, contrast=0.3, saturation=0.3, hue=0.1),
np.asarray,
None,
imutils.Normalize(mean = self.mean, std = self.std),
imutils.HWC_to_CHW
]
def img_label_resize(self, inputs):
for joint_transform, img_transform in zip(self.joint_transform_list, self.img_transform_list):
img_norm = inputs[0]
if img_transform:
img_norm = img_transform(img_norm)
inputs[0]=img_norm
if joint_transform:
outputs = joint_transform(inputs)
inputs=outputs
return inputs
def get_prob_label(self, prob, mlabel):
# prob shape [HxWxC]
# mlabel shape [C]
prob_label=np.zeros((prob.shape[0],prob.shape[1],mlabel.shape[0]))
cnt=0
for i in range(0,mlabel.shape[0]):
if mlabel[i]==1:
prob_label[:,:,i]=prob[:,:,cnt]
cnt+=1
return prob_label
def __len__(self):
return self.image_ids.shape[0]
| StarcoderdataPython |
54239 | import numpy as np
import torch
class ModuleMixin(object):
"""
Adds convenince functions to a torch module
"""
def number_of_parameters(self, trainable=True):
return number_of_parameters(self, trainable)
def number_of_parameters(model, trainable=True):
"""
Returns number of trainable parameters in a torch module
Example:
>>> import netharn as nh
>>> model = nh.models.ToyNet2d()
>>> number_of_parameters(model)
824
"""
if trainable:
model_parameters = filter(lambda p: p.requires_grad, model.parameters())
else:
model_parameters = model.parameters()
n_params = sum([np.prod(p.size()) for p in model_parameters])
return n_params
class grad_context(object):
"""
Context manager for controlling if autograd is enabled.
"""
def __init__(self, flag):
if tuple(map(int, torch.__version__.split('.')[0:2])) < (0, 4):
self.prev = None
self.flag = flag
else:
self.prev = torch.is_grad_enabled()
self.flag = flag
def __enter__(self):
if self.prev is not None:
torch.set_grad_enabled(self.flag)
def __exit__(self, *args):
if self.prev is not None:
torch.set_grad_enabled(self.prev)
return False
class DisableBatchNorm(object):
def __init__(self, model, enabled=True):
self.model = model
self.enabled = enabled
self.previous_state = None
def __enter__(self):
if self.enabled:
self.previous_state = {}
for name, layer in trainable_layers(self.model, names=True):
if isinstance(layer, torch.nn.modules.batchnorm._BatchNorm):
self.previous_state[name] = layer.training
layer.training = False
return self
def __exit__(self, *args):
if self.previous_state:
for name, layer in trainable_layers(self.model, names=True):
if name in self.previous_state:
layer.training = self.previous_state[name]
def trainable_layers(model, names=False):
"""
Example:
>>> import torchvision
>>> model = torchvision.models.AlexNet()
>>> list(trainable_layers(model, names=True))
"""
if names:
stack = [('', '', model)]
while stack:
prefix, basename, item = stack.pop()
name = '.'.join([p for p in [prefix, basename] if p])
if isinstance(item, torch.nn.modules.conv._ConvNd):
yield name, item
elif isinstance(item, torch.nn.modules.batchnorm._BatchNorm):
yield name, item
elif hasattr(item, 'reset_parameters'):
yield name, item
child_prefix = name
for child_basename, child_item in list(item.named_children())[::-1]:
stack.append((child_prefix, child_basename, child_item))
else:
queue = [model]
while queue:
item = queue.pop(0)
# TODO: need to put all trainable layer types here
# (I think this is just everything with reset_parameters)
if isinstance(item, torch.nn.modules.conv._ConvNd):
yield item
elif isinstance(item, torch.nn.modules.batchnorm._BatchNorm):
yield item
elif hasattr(item, 'reset_parameters'):
yield item
# if isinstance(input, torch.nn.modules.Linear):
# yield item
# if isinstance(input, torch.nn.modules.Bilinear):
# yield item
# if isinstance(input, torch.nn.modules.Embedding):
# yield item
# if isinstance(input, torch.nn.modules.EmbeddingBag):
# yield item
for child in item.children():
queue.append(child)
def one_hot_embedding(labels, num_classes, dtype=None):
"""
Embedding labels to one-hot form.
Args:
labels: (LongTensor) class labels, sized [N,].
num_classes: (int) number of classes.
Returns:
(tensor) encoded labels, sized [N,#classes].
References:
https://discuss.pytorch.org/t/convert-int-into-one-hot-format/507/4
CommandLine:
python -m netharn.loss one_hot_embedding
Example:
>>> # each element in target has to have 0 <= value < C
>>> labels = torch.LongTensor([0, 0, 1, 4, 2, 3])
>>> num_classes = max(labels) + 1
>>> t = one_hot_embedding(labels, num_classes)
>>> assert all(row[y] == 1 for row, y in zip(t.numpy(), labels.numpy()))
>>> import ubelt as ub
>>> print(ub.repr2(t.numpy().tolist()))
[
[1.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 1.0],
[0.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
]
>>> t2 = one_hot_embedding(labels.numpy(), num_classes)
>>> assert np.all(t2 == t.numpy())
>>> if torch.cuda.is_available():
>>> t3 = one_hot_embedding(labels.to(0), num_classes)
>>> assert np.all(t3.cpu().numpy() == t.numpy())
"""
if isinstance(labels, np.ndarray):
dtype = dtype or np.float
y = np.eye(num_classes, dtype=dtype)
y_onehot = y[labels]
else: # if torch.is_tensor(labels):
dtype = dtype or torch.float
y = torch.eye(num_classes, device=labels.device, dtype=dtype)
y_onehot = y[labels]
return y_onehot
def one_hot_lookup(probs, labels):
"""
Return probbility of a particular label (usually true labels) for each item
Each item in labels corresonds to a row in probs. Returns the index
specified at each row.
Example:
>>> probs = np.array([
>>> [0, 1, 2],
>>> [3, 4, 5],
>>> [6, 7, 8],
>>> [9, 10, 11],
>>> ])
>>> labels = np.array([0, 1, 2, 1])
>>> one_hot_lookup(probs, labels)
array([ 0, 4, 8, 10])
"""
return probs[np.eye(probs.shape[1], dtype=np.bool)[labels]]
| StarcoderdataPython |
1788966 | <reponame>FernanddoSalas/blog-api<gh_stars>1-10
"""Post Filters."""
# Filters
from django_filters import rest_framework as filter
# Models
from apps.posts.models import Post
class PostFilter(filter.FilterSet):
"""Filter by post's creator (username)."""
username = filter.CharFilter(field_name='user', lookup_expr='username')
class Meta:
"""Meta Options."""
model = Post
fields = ('user',)
| StarcoderdataPython |
1660187 | from output.models.nist_data.atomic.float_pkg.schema_instance.nistschema_sv_iv_atomic_float_white_space_1_xsd.nistschema_sv_iv_atomic_float_white_space_1 import NistschemaSvIvAtomicFloatWhiteSpace1
__all__ = [
"NistschemaSvIvAtomicFloatWhiteSpace1",
]
| StarcoderdataPython |
166994 | # -*- coding: utf-8 -*-
# Copyright 2021 UuuNyaa <<EMAIL>>
# This file is part of x7zipfile.
import glob
import os
import shutil
import stat
import tempfile
import unittest
from tests import x7zipfile
from .archives import ARCHIVES, ARCHIVES_PATH
class TestCase(unittest.TestCase):
def test_archive_list(self):
for archive_name, password, _, expected_infolist in ARCHIVES:
with self.subTest():
with x7zipfile.x7ZipFile(os.path.join(ARCHIVES_PATH, archive_name), pwd=password) as zipfile:
for actual_info, expected_info in zip(zipfile.infolist(), expected_infolist):
actual_info.needs_password()
actual_info.is_dir()
self.assertEqual(actual_info, expected_info)
def test_archive_extractall(self):
for archive_name, password, error_message, expected_infolist in ARCHIVES:
temp_dir = tempfile.mkdtemp()
try:
with self.subTest(f'{archive_name} on {temp_dir}'):
expected_infos = {info.filename: info for info in expected_infolist}
with x7zipfile.x7ZipFile(os.path.join(ARCHIVES_PATH, archive_name), pwd=password) as zipfile:
if error_message:
with self.assertRaisesRegex(x7zipfile.x7ZipExecError, error_message):
zipfile.extractall(temp_dir)
continue
zipfile.extractall(temp_dir)
for root, dirs, files in os.walk(temp_dir, followlinks=False):
for name in files + dirs:
actual_file = os.path.join(root, name)
actual_member = os.path.relpath(actual_file, temp_dir)
try:
_ = zipfile.getinfo(actual_member)
expected_info = expected_infos[actual_member]
del expected_infos[actual_member]
except x7zipfile.x7ZipNoEntry:
expected_info = None
actual_stat = os.lstat(actual_file)
actual_mode = actual_stat.st_mode
if stat.S_ISLNK(actual_mode):
self.assertTrue(expected_info.is_symlink())
elif stat.S_ISDIR(actual_mode):
if expected_info:
self.assertTrue(expected_info.is_dir())
else:
self.assertFalse(expected_info.is_dir())
self.assertEqual(actual_stat.st_size, expected_info.file_size, f'file_size mismatch: {actual_file}')
self.assertEqual(len(expected_infos), 0)
finally:
shutil.rmtree(temp_dir)
| StarcoderdataPython |
1745074 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
from waflib import Utils
from waflib.Configure import conf
@conf
def d_platform_flags(self):
v=self.env
if not v.DEST_OS:
v.DEST_OS=Utils.unversioned_sys_platform()
binfmt=Utils.destos_to_binfmt(self.env.DEST_OS)
if binfmt=='pe':
v['dprogram_PATTERN']='%s.exe'
v['dshlib_PATTERN']='lib%s.dll'
v['dstlib_PATTERN']='lib%s.a'
elif binfmt=='mac-o':
v['dprogram_PATTERN']='%s'
v['dshlib_PATTERN']='lib%s.dylib'
v['dstlib_PATTERN']='lib%s.a'
else:
v['dprogram_PATTERN']='%s'
v['dshlib_PATTERN']='lib%s.so'
v['dstlib_PATTERN']='lib%s.a'
DLIB='''
version(D_Version2) {
import std.stdio;
int main() {
writefln("phobos2");
return 0;
}
} else {
version(Tango) {
import tango.stdc.stdio;
int main() {
printf("tango");
return 0;
}
} else {
import std.stdio;
int main() {
writefln("phobos1");
return 0;
}
}
}
'''
@conf
def check_dlibrary(self,execute=True):
ret=self.check_cc(features='d dprogram',fragment=DLIB,compile_filename='test.d',execute=execute,define_ret=True)
if execute:
self.env.DLIBRARY=ret.strip()
| StarcoderdataPython |
1791001 | from unittest import TestCase
from day7.part1.get_signal_for_wire import get_signal_for_wire
class TestGetSignalForWire(TestCase):
def test_get_signal_for_wire_1(self):
expected_value = 72
instructions = [
"123 -> x",
"456 -> y",
"x AND y -> d"
]
value = get_signal_for_wire(instructions, "d")
self.assertEqual(expected_value, value)
def test_get_signal_for_wire_2(self):
expected_value = 507
instructions = [
"123 -> x",
"456 -> y",
"x OR y -> e"
]
value = get_signal_for_wire(instructions, "e")
self.assertEqual(expected_value, value)
def test_get_signal_for_wire_3(self):
expected_value = 492
instructions = [
"123 -> x",
"456 -> y",
"x LSHIFT 2 -> f"
]
value = get_signal_for_wire(instructions, "f")
self.assertEqual(expected_value, value)
def test_get_signal_for_wire_4(self):
expected_value = 114
instructions = [
"123 -> x",
"456 -> y",
"y RSHIFT 2 -> g"
]
value = get_signal_for_wire(instructions, "g")
self.assertEqual(expected_value, value)
def test_get_signal_for_wire_5(self):
expected_value = -124
instructions = [
"123 -> x",
"456 -> y",
"x AND y -> d",
"x OR y -> e",
"x LSHIFT 2 -> f",
"y RSHIFT 2 -> g",
"NOT x -> h"
]
value = get_signal_for_wire(instructions, "h")
self.assertEqual(expected_value, value)
def test_get_signal_for_wire_6(self):
expected_value = -457
instructions = [
"123 -> x",
"456 -> y",
"x AND y -> d",
"x OR y -> e",
"x LSHIFT 2 -> f",
"y RSHIFT 2 -> g",
"NOT y -> i"
]
value = get_signal_for_wire(instructions, "i")
self.assertEqual(expected_value, value)
| StarcoderdataPython |
4836602 | from keras import backend as K
from overrides import overrides
from ..masked_layer import MaskedLayer
class Multiply(MaskedLayer):
"""
This ``Layer`` performs elementwise multiplication between two tensors, supporting masking. We
literally just call ``tensor_1 * tensor_2``; the only reason this is a ``Layer`` is so that we
can support masking (and because it's slightly nicer to read in a model definition than a
lambda layer).
We also try to be a little bit smart if you're wanting to broadcast the multiplication, by
having the tensors differ in the number of dimensions by one.
Input:
- tensor_1: a tensor of arbitrary shape, with an optional mask of the same shape
- tensor_2: a tensor with the same shape as ``tensor_1`` (or one less or one more
dimension), with an optional mask of the same shape
Output:
- ``tensor_1 * tensor_2``.
"""
def __init__(self, **kwargs):
super(Multiply, self).__init__(**kwargs)
@overrides
def compute_mask(self, inputs, mask=None):
# pylint: disable=unused-argument
tensor_1, tensor_2 = inputs
tensor_1_mask, tensor_2_mask = mask
if tensor_1_mask is None:
tensor_1_mask = K.ones_like(tensor_1)
if tensor_2_mask is None:
tensor_2_mask = K.ones_like(tensor_2)
tensor_1_mask, tensor_2_mask = self.expand_dims_if_necessary(tensor_1_mask, tensor_2_mask)
return K.cast(tensor_1_mask, 'uint8') * K.cast(tensor_2_mask, 'uint8')
@overrides
def compute_output_shape(self, input_shape):
return input_shape[0]
@overrides
def call(self, inputs, mask=None):
tensor_1, tensor_2 = inputs
tensor_1, tensor_2 = self.expand_dims_if_necessary(tensor_1, tensor_2)
return tensor_1 * tensor_2
@staticmethod
def expand_dims_if_necessary(tensor_1, tensor_2):
tensor_1_ndim = K.ndim(tensor_1)
tensor_2_ndim = K.ndim(tensor_2)
if tensor_1_ndim == tensor_2_ndim:
return tensor_1, tensor_2
elif tensor_1_ndim == tensor_2_ndim - 1:
return K.expand_dims(tensor_1), tensor_2
elif tensor_2_ndim == tensor_1_ndim - 1:
return tensor_1, K.expand_dims(tensor_2)
else:
raise RuntimeError("Can't multiply two tensors with ndims "
"{} and {}".format(tensor_1_ndim, tensor_2_ndim))
| StarcoderdataPython |
158360 | import sys
import threading
import logging
import os
import datetime
import time
import socket
import SerialPortController
class TcpSerialPortClient:
def __init__(self, server, client_socket, client_address):
self.logger = logging.getLogger("TcpSerialPortClient-{}".format(client_address))
self.server = server
self.socket = client_socket
self.client_address = client_address
self.run_thread = threading.Thread(target=self.run, args=())
self.run_thread.start()
def run(self):
self.logger.debug("running thread:%s", threading.current_thread().getName())
try:
while not self.server.shutdown:
data = self.socket.recv(1024)
if data is None or data == b"":
break
self.server.serial_port_component.write(data)
except Exception as e:
self.logger.debug("run exception %s", e)
self.logger.debug("shutting down....")
self.socket.close()
self.server.unregister_client(self)
self.logger.debug("terminated")
def stop(self):
self.logger.debug("stopping client:%s ...", self.client_address)
self.socket.close()
def send(self, data):
try:
self.socket.sendall(data)
except Exception as e:
self.logger.debug("send ex:%s", e)
class TcpSerialPortBridge(object):
def __init__(self, port, serial_port_component):
self.logger = logging.getLogger("TcpSerialPortBridge")
self.port = port
self.serial_port_component = serial_port_component
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.settimeout(2.0)
self.shutdown = False
self.lock = threading.Lock()
self.clients = []
def run_serial(self):
self.logger.debug("run_serial started")
try:
while not self.shutdown:
if self.serial_port_component.is_data_ready.isSet():
if self.shutdown:
break
data_len = self.serial_port_component.get_available_bytes()
data = self.serial_port_component.read(data_len)
if self.shutdown:
break
clients = self.clients.copy()
for client in clients:
client.send(data)
time.sleep(0.1) # Wait 100ms
except Exception as ex:
self.logger.debug("run_serial exception ex=%s", ex)
self.logger.debug("run_serial terminated")
def run(self):
try:
last_debug_dt = None
while not self.shutdown:
try:
ds = 1917 if last_debug_dt is None else (datetime.datetime.now()-last_debug_dt).total_seconds()
if ds>=60:
self.logger.debug("waiting for a connection")
last_debug_dt = datetime.datetime.now()
connection, client_address = self.socket.accept()
self.logger.info("accepted client connection from %s", client_address)
client = TcpSerialPortClient(self, connection, client_address)
self.register_client(client)
except socket.timeout as e:
pass
except Exception as ex:
self.shutdown = True
self.logger.debug("run exception ex=%s", ex)
self.logger.debug("shutting down....")
self.socket.close()
self.logger.debug("terminated")
def start(self):
server_address = ("", self.port)
self.logger.debug("starting up on %s", server_address)
self.socket.bind(server_address)
self.socket.listen(1)
self.run_thread = threading.Thread(target=self.run,args=())
self.run_thread.start()
self.run_serial_thread = threading.Thread(target=self.run_serial,args=())
self.run_serial_thread.start()
def stop(self):
self.logger.debug("stopping....")
self.shutdown = True
#self.socket.close()
clients = self.clients.copy()
for client in clients:
client.stop()
self.logger.debug("join th:%s run_thread", self.run_thread.getName())
self.run_thread.join()
for client in clients:
self.logger.debug("join th:%s client:%s", client.run_thread.getName(), client.client_address)
client.run_thread.join()
self.logger.debug("join th:%s run_serial_thread", self.run_serial_thread.getName())
self.run_serial_thread.join()
self.logger.debug("stopped")
def register_client(self, client):
self.lock.acquire()
try:
self.clients.append(client)
self.logger.debug("register client:%s #clients:%s", client.client_address, len(self.clients))
finally:
self.lock.release()
def unregister_client(self, client):
self.lock.acquire()
try:
self.clients.remove(client)
self.logger.debug("unregister client:%s #clients:%s", client.client_address, len(self.clients))
finally:
self.lock.release()
def main():
logging.basicConfig(format="%(process)d-%(name)s-%(levelname)s-%(message)s", level=logging.DEBUG)
logging.info("Starting... platform=%s hostname=%s", sys.platform, socket.gethostname())
SerialPortController.SerialPortController.list_ports()
port_name = None
if sys.platform == "linux" or sys.platform == "linux2":
port_name = "/dev/ttyUSB0"
else:
port_name = "Com38"
uart0_component = SerialPortController.SerialPortController(port_name, 230400)
uart0_component.start()
server = TcpSerialPortBridge(24, uart0_component)
server.start()
time.sleep(3)
input("===> Press Enter to quit...\n")
logging.debug("*** Enter pressed ***")
uart0_component.stop()
server.stop()
logging.info("Terminated")
if __name__ == "__main__":
main()
| StarcoderdataPython |
111658 | <reponame>enisteper1/AWS-Deployed-ML
from django.forms import ModelForm, Textarea
from .models import Data
class DataForm(ModelForm):
class Meta:
model = Data
fields = '__all__'
widgets = {
'body': Textarea()
} | StarcoderdataPython |
4801416 | import Polyamorphic
import ReadFile
import LineMatch
import MyFli
import DelErrorDate
import MyPlot
import WriteExcel
import FindBestGroup
# -----------------------------------------------------------------------------------------------------
# 曲线匹配规则 num:线段长度 num_max:最大估计值
num = 3
num_max = 15
# 线段匹配算法 0:自动选择1-3 1:线段距离 2:R^2拟合优度 3:Rnew拟合优度
line_flag = 0
# 滤波 1:flitflit滤波 系数 0.4 2:滑动滤波 滑动窗口:0.2 0.3 0.5
fli_flag = 2
# 更新拟合数据要求的最低连续数据
update_flag = 5
# path:训练数据 path1:测试数据
path = "E:/input.log"
path1 = "E:/input2.log"
#
polynomial_list = []
# -----------------------------------------------------------------------------------------------------
polynomial = [0, 0, 0, 0]
data_train = []
data_test = []
ReadFile.readfile(path, data_train) # 读取训练数据
ReadFile.readfile(path1, data_test) # 读取测试数据
# MyPlot.myplot(0)
# 拟合多组曲线,系数做递推权重相加
data_fit = []
for data_temp in data_train:
if data_temp != 0:
data_fit.append(data_temp)
else:
DelErrorDate.errordate(data_fit) # 消除数据中异常大幅降低的值
polynomial = Polyamorphic.polyamorphic(MyFli.my_fliter(data_fit, fli_flag), polynomial) # 取得拟合参数
# MyPlot.myplot(2, MyFli.my_fliter(data_fit, fli_flag))
data_fit.clear()
polynomial_list = Polyamorphic.polyamorphic_calculation(polynomial, num_max) # 计算获得参数表
if line_flag == 0:
line_flag = FindBestGroup.findgroup(data_train, polynomial_list, num, num_max)
print('Select the best LineMatch:',line_flag)
# MyPlot.myplot(1, polynomial) # 画拟合曲线
result = []
data_test_temp = []
WriteExcel.initexcel()
for data_temp in data_test:
if data_temp != 0:
data_test_temp.append(data_temp)
else:
DelErrorDate.errordate(data_test_temp) # 消除数据中异常大幅降低的值
if fli_flag == 2:
times = 2
elif fli_flag == 1:
times = 6
for i in range(times, len(data_test_temp)):
temp = []
for ii in range(i+1):
temp.append(data_test_temp[ii])
# 滤波 Flag: 1 flitflit滤波 系数 0.4
# 2 滑动平均 3 权重 0.2 0.3 0.5
data_wave = MyFli.my_fliter(temp, fli_flag)
# 取多点作拟合优度计算,得到剩余数
result_num = LineMatch.linematch(data_wave, polynomial_list, num, num_max, line_flag)
print("Number-->", result_num)
result.append(result_num)
WriteExcel.writeexcel(result) # 将结果写入Excel中
Polyamorphic.polyamorphic_update(result, data_test_temp, polynomial, update_flag) # 更新拟合曲线
polynomial_list = Polyamorphic.polyamorphic_calculation(polynomial, num_max) # 计算获得参数表
result.clear()
data_test_temp.clear()
# myplot.myplot(10)
| StarcoderdataPython |
4828127 | <reponame>sjsucohort6/openstack<gh_stars>0
# Copyright 2012 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Self-validating model for arbitrary objects"""
import copy
import warnings
import jsonpatch
import jsonschema
import six
from . import exceptions
class Model(dict):
def __init__(self, *args, **kwargs):
# we overload setattr so set this manually
d = dict(*args, **kwargs)
try:
self.validate(d)
except exceptions.ValidationError as exc:
raise ValueError(str(exc))
else:
dict.__init__(self, d)
self.__dict__['changes'] = {}
self.__dict__['__original__'] = copy.deepcopy(d)
def __setitem__(self, key, value):
mutation = dict(self.items())
mutation[key] = value
try:
self.validate(mutation)
except exceptions.ValidationError as exc:
msg = ("Unable to set '%s' to '%s'. Reason: %s"
% (key, value, str(exc)))
raise exceptions.InvalidOperation(msg)
dict.__setitem__(self, key, value)
self.__dict__['changes'][key] = value
def __delitem__(self, key):
mutation = dict(self.items())
del mutation[key]
try:
self.validate(mutation)
except exceptions.ValidationError as exc:
msg = ("Unable to delete attribute '%s'. Reason: %s"
% (key, str(exc)))
raise exceptions.InvalidOperation(msg)
dict.__delitem__(self, key)
def __getattr__(self, key):
try:
return self.__getitem__(key)
except KeyError:
raise AttributeError(key)
def __setattr__(self, key, value):
self.__setitem__(key, value)
def __delattr__(self, key):
self.__delitem__(key)
### BEGIN dict compatibility methods ###
def clear(self):
raise exceptions.InvalidOperation()
def pop(self, key, default=None):
raise exceptions.InvalidOperation()
def popitem(self):
raise exceptions.InvalidOperation()
def copy(self):
return copy.deepcopy(dict(self))
def update(self, other):
mutation = dict(self.items())
mutation.update(other)
try:
self.validate(mutation)
except exceptions.ValidationError as exc:
raise exceptions.InvalidOperation(str(exc))
dict.update(self, other)
def iteritems(self):
return six.iteritems(copy.deepcopy(dict(self)))
def items(self):
return copy.deepcopy(dict(self)).items()
def itervalues(self):
return six.itervalues(copy.deepcopy(dict(self)))
def values(self):
return copy.deepcopy(dict(self)).values()
### END dict compatibility methods ###
@property
def patch(self):
"""Return a jsonpatch object representing the delta"""
original = self.__dict__['__original__']
return jsonpatch.make_patch(original, dict(self)).to_string()
@property
def changes(self):
"""Dumber version of 'patch' method"""
deprecation_msg = 'Model.changes will be removed in warlock v2'
warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=2)
return copy.deepcopy(self.__dict__['changes'])
def validate(self, obj):
"""Apply a JSON schema to an object"""
try:
jsonschema.validate(obj, self.schema)
except jsonschema.ValidationError as exc:
raise exceptions.ValidationError(str(exc))
| StarcoderdataPython |
3254419 | <reponame>hellwear/getCryptoPrice
import get_course
if __name__ == '__main__':
get_course.getCurrency() | StarcoderdataPython |
3349206 | text_masked = "The capital of France is {mask}."
text = "The capital of France is Paris."
torch_model_name = "uclanlp/visualbert-nlvr2-coco-pre"
paddle_model_name = "visualbert-nlvr2-coco-pre"
import numpy as np
import paddle
import torch
from paddlenlp.transformers import BertTokenizer as PDBertTokenizer
from paddlenlp.transformers import \
VisualBertForPreTraining as PDVisualBertForPreTraining
from transformers import BertTokenizer as PTBertTokenizer
from transformers import VisualBertForPreTraining as PTVisualBertForPreTraining
torch_model = PTVisualBertForPreTraining.from_pretrained("../checkpoint/" +
torch_model_name)
torch_tokenizer = PTBertTokenizer.from_pretrained("bert-base-uncased")
torch_model.eval()
torch_inputs = torch_tokenizer(
text_masked, return_tensors="pt", max_length=128, padding="max_length")
torch_visual_embeds = torch.ones([100, 1024]).unsqueeze(0)
torch_visual_token_type_ids = torch.ones(
torch_visual_embeds.shape[:-1], dtype=torch.int64)
torch_visual_attention_mask = torch.ones(
torch_visual_embeds.shape[:-1], dtype=torch.int64)
torch_inputs.update({
"visual_embeds": torch_visual_embeds,
"visual_token_type_ids": torch_visual_token_type_ids,
"visual_attention_mask": torch_visual_attention_mask
})
max_length = torch_inputs["input_ids"].shape[-1] + torch_visual_embeds.shape[-2]
torch_labels = torch_tokenizer(
text, return_tensors="pt", padding="max_length",
max_length=max_length)["input_ids"]
torch_sentence_image_labels = torch.tensor(1).unsqueeze(0) # Batch_size
with torch.no_grad():
torch_outputs = torch_model(
**torch_inputs,
labels=torch_labels,
sentence_image_labels=torch_sentence_image_labels)
torch_loss = torch_outputs.loss.cpu().detach().numpy()
torch_prediction_logits = torch_outputs.prediction_logits.cpu().detach().numpy()
torch_seq_relationship_logits = torch_outputs.seq_relationship_logits.cpu(
).detach().numpy()
print("torch_loss:{}".format(torch_loss))
print("torch_prediction_logits shape:{}".format(torch_prediction_logits.shape))
print("torch_prediction_logits:{}".format(torch_prediction_logits))
print("torch_seq_relationship_logits shape:{}".format(
torch_seq_relationship_logits.shape))
print("torch_seq_relationship_logits:{}".format(torch_seq_relationship_logits))
# ========================================================================================================
paddle_model = PDVisualBertForPreTraining.from_pretrained(paddle_model_name)
paddle_tokenizer = PDBertTokenizer.from_pretrained("bert-base-uncased")
paddle_model.eval()
paddle_inputs = paddle_tokenizer(
text_masked,
max_seq_len=128,
pad_to_max_seq_len=True,
return_attention_mask=True)
paddle_inputs['input_ids'] = paddle.to_tensor([paddle_inputs['input_ids']])
paddle_inputs['token_type_ids'] = paddle.to_tensor(
[paddle_inputs['token_type_ids']])
paddle_inputs['attention_mask'] = paddle.to_tensor(
[paddle_inputs['attention_mask']])
paddle_visual_embeds = paddle.ones([100, 1024]).unsqueeze(0)
paddle_visual_token_type_ids = paddle.ones(
paddle_visual_embeds.shape[:-1], dtype=paddle.int64)
paddle_visual_attention_mask = paddle.ones(
paddle_visual_embeds.shape[:-1], dtype=paddle.int64)
return_dict = False
paddle_inputs.update({
"visual_embeds": paddle_visual_embeds,
"visual_token_type_ids": paddle_visual_token_type_ids,
"visual_attention_mask": paddle_visual_attention_mask,
"return_dict": return_dict
})
max_length = paddle_inputs["input_ids"].shape[-1] + paddle_visual_embeds.shape[
-2]
paddle_labels = paddle.to_tensor(
paddle_tokenizer(
text, max_seq_len=max_length, pad_to_max_seq_len=True)["input_ids"])
paddle_sentence_image_labels = paddle.to_tensor(1).unsqueeze(0) # Batch_size
with paddle.no_grad():
paddle_outputs = paddle_model(
**paddle_inputs,
labels=paddle_labels,
sentence_image_labels=paddle_sentence_image_labels)
if not return_dict:
paddle_loss = paddle_outputs[0].cpu().detach().numpy()
paddle_prediction_logits = paddle_outputs[1].cpu().detach().numpy()
paddle_seq_relationship_logits = paddle_outputs[2].cpu().detach().numpy()
else:
paddle_loss = paddle_outputs['loss'].cpu().detach().numpy()
paddle_prediction_logits = paddle_outputs['prediction_logits'].cpu().detach(
).numpy()
paddle_seq_relationship_logits = paddle_outputs[
'seq_relationship_logits'].cpu().detach().numpy()
print("paddle_loss:{}".format(paddle_loss))
print("paddle_prediction_logits shape:{}".format(
paddle_prediction_logits.shape))
print("paddle_prediction_logits:{}".format(paddle_prediction_logits))
print("paddle_seq_relationship_logits shape:{}".format(
paddle_seq_relationship_logits.shape))
print("paddle_seq_relationship_logits:{}".format(
paddle_seq_relationship_logits))
# ==============================================================================
assert torch_prediction_logits.shape == paddle_prediction_logits.shape, "the output logits should have the same shape, but got : {} and {} instead".format(
paddle_prediction_logits.shape, paddle_prediction_logits.shape)
assert torch_seq_relationship_logits.shape == paddle_seq_relationship_logits.shape, "the output logits should have the same shape, but got : {} and {} instead".format(
torch_seq_relationship_logits.shape, paddle_seq_relationship_logits.shape)
prediction_logits_diff = torch_prediction_logits - paddle_prediction_logits
seq_relationship_logits = torch_seq_relationship_logits - paddle_seq_relationship_logits
print("prediction_logits_diff", np.amax(abs(prediction_logits_diff)))
print("prediction_logits_diff_mean", abs(prediction_logits_diff).mean())
print("seq_relationship_logits_diff", np.amax(abs(seq_relationship_logits)))
| StarcoderdataPython |
3303263 | <reponame>heidikira/startables-python
import typing
import numbers
from pyscheme import atoms
Number = typing.NewType('Number', numbers.Complex)
Expression = typing.Union[Number, atoms.Symbol, typing.List['Expression']] | StarcoderdataPython |
1625872 | import torch
import os
import argparse
from glob import glob
import soundfile as sf
from torchaudio.compliance.kaldi import mfcc
from osdc.utils.oladd import overlap_add
import numpy as np
from osdc.features.ola_feats import compute_feats_windowed
import yaml
from train import OSDC_AMI
parser = argparse.ArgumentParser("Single-Channel inference, average logits")
parser.add_argument("exp_dir", type=str)
parser.add_argument("checkpoint_name", type=str)
parser.add_argument("wav_dir", type=str)
parser.add_argument("out_dir", type=str)
parser.add_argument("gpus", type=str, default="0")
parser.add_argument("--window_size", type=int, default=200)
parser.add_argument("--lookahead", type=int, default=200)
parser.add_argument("--lookbehind", type=int, default=200)
parser.add_argument("--regex", type=str, default="")
def plain_single_file_predict(model, wav_dir, train_configs, out_dir, window_size=400, lookahead=200, lookbehind=200, regex=""):
model = model.eval().cuda()
wavs = glob(os.path.join(wav_dir, "**/*{}*.wav".format(regex)), recursive=True)
assert len(wavs) > 0, "No file found"
for wav in wavs:
print("Processing File {}".format(wav))
audio, _ = sf.read(wav)
if train_configs["feats"]["type"] == "mfcc_kaldi":
feats_func = lambda x: mfcc(torch.from_numpy(x.astype("float32").reshape(1, -1)),
**train_configs["mfcc_kaldi"]).transpose(0, 1)
else:
raise NotImplementedError
tot_feats = compute_feats_windowed(feats_func, audio)
tot_feats = tot_feats.detach().cpu().numpy()
pred_func = lambda x : model(torch.from_numpy(x).unsqueeze(0).cuda()).detach().cpu().numpy()
preds = overlap_add(tot_feats, pred_func, window_size, window_size // 2, lookahead=lookahead, lookbehind=lookbehind)
out_file = os.path.join(out_dir, wav.split("/")[-1].split(".wav")[0] + ".logits")
np.save(out_file, preds)
if __name__ == "__main__":
args = parser.parse_args()
with open(os.path.join(args.exp_dir, "confs.yml"), "r") as f:
confs = yaml.load(f)
# test if compatible with lightning
confs.update(args.__dict__)
model = OSDC_AMI(confs)
if confs["checkpoint_name"].startswith("avg"):
state_dict = torch.load(os.path.join(confs["exp_dir"], confs["checkpoint_name"]),
map_location='cpu')
else:
state_dict = torch.load(os.path.join(confs["exp_dir"], confs["checkpoint_name"]),
map_location='cpu')["state_dict"]
model.load_state_dict(state_dict)
model = model.model
os.makedirs(confs["out_dir"], exist_ok=True)
plain_single_file_predict(model, confs["wav_dir"],
confs, confs["out_dir"], window_size=args.window_size,
lookahead=args.lookahead, lookbehind=args.lookbehind, regex=args.regex)
| StarcoderdataPython |
126956 | <gh_stars>0
print("Hello World")
print("Hello Again")
print("I Like typing this")
print("This is fun.")
print("Yay! Printing.")
print("I'd much rather you 'not'.")
print('I"said" do not touch this.')
print("how to fix github")
| StarcoderdataPython |
1698463 | <gh_stars>1-10
from PyQt5.QtWidgets import QDialog, QPushButton, QComboBox, QGridLayout, QStyle, QDoubleSpinBox, QWidget, QMessageBox
from PyQt5.QtGui import QIcon
from enum import Enum, auto
def question_dialog(
title: str,
text: str,
icon: QIcon=QMessageBox.Question,
parent: QWidget=None,
buttons: tuple=None
):
def close_event(event=None):
"""done(0) if reject is false, and set it ture.
This will avoid infinite recursio
"""
nonlocal rejected
if not rejected:
rejected = True
msg_box.done(0)
rejected = False
msg_box = QMessageBox(icon, title, text, parent=parent)
rejected = False
if buttons is None:
buttons = (
(QPushButton(msg_box.style().standardIcon(QStyle.SP_DialogCancelButton), "Cancel"), 0),
(QPushButton(QIcon(":/Images/minus_icon.png"), "Remove"), 2),
(QPushButton(QIcon(":/Images/plus_icon.png"), "Add"), 3),
)
for button, button_role in buttons:
msg_box.addButton(button, button_role)
msg_box.closeEvent = close_event
msg_box.rejected.connect(close_event)
return msg_box.exec_()
def get_item_input_dialog(items: list or tuple, title: str, current_index: int=0, parent: QWidget=None):
dialog = QDialog(parent)
dialog.setWindowTitle(title)
dialog.setMaximumHeight(0)
dialog.setMaximumWidth(0)
dialog.setLayout(QGridLayout())
combobox = QComboBox()
combobox.addItems(items)
combobox.setCurrentIndex(current_index)
ok_btn = QPushButton(dialog.style().standardIcon(QStyle.SP_DialogApplyButton), "OK")
ok_btn.clicked.connect(lambda: dialog.done(1))
cancel_btn = QPushButton(dialog.style().standardIcon(QStyle.SP_DialogCancelButton), "Cancel")
cancel_btn.clicked.connect(lambda: dialog.done(0))
# remove_btn = QPushButton(dialog.style().standardIcon(QStyle.SP_MessageBoxCritical), "Remove")
# remove_btn.clicked.connect(lambda: dialog.done(2))
dialog.layout().addWidget(combobox, 0, 0, 1, 0)
dialog.layout().addWidget(ok_btn, 1, 2)
dialog.layout().addWidget(cancel_btn, 1, 1)
# dialog.layout().addWidget(remove_btn, 1, 0)
return_value = dialog.exec_()
value = combobox.currentText()
# return item, ok/cancel
return value, return_value
def get_double_input_dialog(title: str, value: float=0, minValue: float=0, maxValue: float=10000, decimals: int=1, step: float=0.1, parent: QWidget=None):
dialog = QDialog(parent)
dialog.setWindowTitle(title)
dialog.setMaximumHeight(0)
dialog.setMaximumWidth(0)
dialog.setLayout(QGridLayout())
double_spinbox = QDoubleSpinBox()
double_spinbox.setValue(value)
double_spinbox.setMinimum(minValue)
double_spinbox.setMaximum(maxValue)
double_spinbox.setDecimals(decimals)
double_spinbox.setSingleStep(step)
ok_btn = QPushButton(dialog.style().standardIcon(QStyle.SP_DialogApplyButton), "OK")
ok_btn.clicked.connect(lambda: dialog.done(1))
cancel_btn = QPushButton(dialog.style().standardIcon(QStyle.SP_DialogCancelButton), "Cancel")
cancel_btn.clicked.connect(lambda: dialog.done(0))
# remove_btn = QPushButton(dialog.style().standardIcon(QStyle.SP_MessageBoxCritical), "Remove")
# remove_btn.clicked.connect(lambda: dialog.done(2))
dialog.layout().addWidget(double_spinbox, 0, 0, 1, 0)
dialog.layout().addWidget(ok_btn, 1, 2)
dialog.layout().addWidget(cancel_btn, 1, 1)
# dialog.layout().addWidget(remove_btn, 1, 0)
return_value = dialog.exec_()
value = double_spinbox.value()
#return value, ok/cancel
return round(value, 1), return_value
| StarcoderdataPython |
1670722 | import cobrakbase.core.kbasefba
import cobrakbase.core.kbasebiochem
import cobrakbase.core.kbasegenome
import cobrakbase.core.kbasematrices
from cobrakbase.core.model import KBaseFBAModel
from cobrakbase.core.kbasebiochemmedia import KBaseBiochemMedia
from cobrakbase.core.kbasefbafba import KBaseFBA
from cobrakbase.core.kbasegenomesgenome import KBaseGenome
from cobrakbase.core.build_metabolic_model import build_metabolic_model
| StarcoderdataPython |
1728558 | <gh_stars>1-10
# Genetic algorithm to generate 6 sided shapes. Fitness score is determined by
# regularity of angles. That is, it should generate a near perfect hexagon.
# Chromosones are a list of XY coordinates.
# More or less 6 genes, each with an XY pair defining the vertex.
# Simple roulette wheel selection.
# Fitness score in pseudocode. Lower is better.
# for genes in chromosone:
# total_deviation += math.abs(gene_vertex.angle)
# There'll be 32 members of the population per generation.
# import sys
# import time
import random
import math
from collections import namedtuple
csvgen = True
# import statistics
Vertex = namedtuple('vertex', 'x y')
# This'll make the vertex tuple that we'll use for the chromosones.
# Example chromosone
# [vertex(1, 5), vertex(2, 6), vertex(8, 3), vertex(2, 1), vertex(8, 7),
# vertex(3, 2)]
# class A(object):
# def __init__(self):
# pass
mutation_rate = 2 # (out of 100)
population_size = 32
def chromosonegen():
"""Make random chromosones, coord x, y | 0 < x < 10 """
vert1 = Vertex(round(random.random()*10, 3),
round(random.random()*10, 3))
vert2 = Vertex(round(random.random()*10, 3),
round(random.random()*10, 3))
vert3 = Vertex(round(random.random()*10, 3),
round(random.random()*10, 3))
vert4 = Vertex(round(random.random()*10, 3),
round(random.random()*10, 3))
vert5 = Vertex(round(random.random()*10, 3),
round(random.random()*10, 3))
vert6 = Vertex(round(random.random()*10, 3),
round(random.random()*10, 3))
return [vert1, vert2, vert3, vert4, vert5, vert6]
class Individual():
'Individuals for genetic algorithm. Has chromosone and related functions.'
def __init__(self, input_chromosone=5):
if input_chromosone == 5:
self.chromosone = chromosonegen()
else:
self.chromosone = input_chromosone
def point_swap(chrom1, chrom2):
"""Swaps genes between two points in an input and output chromosone"""
swap_pos = random.randint(0, 6) # Randomly picks pos to swap at
return chrom1[swap_pos:] + chrom2[:swap_pos]
def fragment_return(chromosone, startpos, endpos):
return chromosone[startpos:endpos]
def evaluator(to_eval):
x = to_eval.chromosone # print (to_eval.chromosone)
try:
angle_set = [find_angle(x[5], x[0], x[1]), # Run the find anglefunction
find_angle(x[0], x[1], x[2]), # with all the vertcies
find_angle(x[1], x[2], x[3]),
find_angle(x[2], x[3], x[4]),
find_angle(x[3], x[4], x[5]),
find_angle(x[4], x[5], x[0])]
total_error = 0
for y in angle_set:
total_error += math.fabs(60-y) # Calculate totalerror withabs(60-y)
# print (total_error)
return total_error
except ZeroDivisionError:
return 360
def find_angle(vertA, vertB, vertC):
# AB and BC is leg, CA is hypotenuse
# Find distance of segments between that vertex and neightboring ones
ab_dist = math.sqrt((vertB.x-vertA.x)**2 + (vertB.y - vertA.y)**2)
bc_dist = math.sqrt((vertC.x-vertB.x)**2 + (vertC.y - vertB.y)**2)
ca_dist = math.sqrt((vertA.x-vertC.x)**2 + (vertA.y - vertC.y)**2)
# Calculate the angle (in radians)
rad_angle = math.acos((ab_dist**2 + bc_dist**2 - ca_dist**2) /
(2*(ab_dist*bc_dist)))
deg_angle = rad_angle * (180/math.pi) # Change angle to degrees
return deg_angle
# def roulette_gene_select(obj_set):# obj_set is 1d matrix/list with all objects
# fitness_set = {} # of current generation
# for x in obj_set:
# fitness_set[evaluator(x)] = x
def make_fitness_dict(population_list):
fitness_dict = {}
# print (population_dict)
for x in population_list:
fitness_dict[x] = round(evaluator(x))
# inverse_fitness_dict = {}
# for x in fitness_dict:
# inverse_fitness_dict[fitness_dict[x]] = x
# return inverse_fitness_dict
return fitness_dict
def invert_dict(dict_to_invert):
inverted_dict = {}
for x in dict_to_invert:
inverted_dict[dict_to_invert[x]] = x
return inverted_dict
def fitness_select(fitness_dict):
# How to roulette wheel select:
# 1. Compute "inverse" fitness score (360 - fitness)
# 2. Sort list from low to high fitness (maybe high to low, maybe random)
# 3. find sum of all fitness scores, S
# 4. Find random number r between 0 and S
# 5. If fitness value of first object is smaller than r, add second object
# fitness score. Repeat until greater than r
# 6. Winner = last object whose fitness score was added (first to go over r)
x = 0
fitness_list = []
for x in fitness_dict:
fitness_list.append(fitness_dict[x])
adjusted_fitness_list = []
for x in sorted(fitness_list): # step one & 2, sorting high-low
adjusted_fitness_list.append(360-int(x))
S = 0
for x in adjusted_fitness_list: # Step 3
S += x
r = random.randint(0, S) # Step 4)
adjusted_fitness_list = adjusted_fitness_list[::-1]
s = 0 # Used for summing up values until greater than r
x = 0 # Used for setting lastobj and summing up list stuff
z = invert_dict(fitness_dict)
lastobj = z[(adjusted_fitness_list[x]-360) * -1]
x = 0
while s < r: # Step 5
s += adjusted_fitness_list[x] # Step 5 cont
lastobj = z[(adjusted_fitness_list[x]-360) * -1] # Lastobj
x += 1
winner = lastobj # Step 6
if evaluator(winner) == 360:
winner = fitness_select(fitness_dict)
return winner
def roulette_generate(fitness_dict, genmethod):
'''generates chromosone from roulette wheel selection from a dictionary'''
# genmethod is an int. Specifies how the new gene is generated
# 0 = just copying
# 1 = one-point selection (from two roulette winners)
# 2 = one-point swap (from one roulette winner): TODO
if genmethod == 0:
return fitness_select(fitness_dict).chromosone
elif genmethod == 1:
# print (fitness_select(fitness_dict))
x = fitness_select(fitness_dict).chromosone
y = fitness_select(fitness_dict).chromosone
while checker(x, y):
y = fitness_select(fitness_dict).chromosone
x = fitness_select(fitness_dict).chromosone
return point_swap(x, y)
def checker(a, b):
returns = False
for n in a:
for m in b:
if n == m:
returns = True
return returns
def initiate_population():
''' Returns list of objects '''
population_list = []
for x in range(0, population_size):
y = Individual()
population_list.append(y)
return population_list
def generate_generation(population_list):
# takes fitness dictionary, makes list of new individuals, TODO
for x in range(0, len(population_list)):
population_list[x].chromosone = \
roulette_generate(make_fitness_dict(population_list), 1)
# print ("generated generation " + str(x))
return population_list
def mutation_chance(mutation_rate):
x = random.randint(0, 100)
if x < mutation_rate:
return True
else:
return False
def random_mutation(individual):
x = random.randint(0, 128)
# print (individual.chromosone)
# chromosone_regen(individual)
# if x < 64:
# individual.chromosone = chromosone_scramble(individual)
# else:
# individual.chromosone = chromosone_regen(individual)
# print (individual.chromosone)
if x < 16:
individual.chromosone = bound_mutation(individual)
print("Bonding")
elif x < 32:
individual.chromosone = chromosone_regen(individual)
print("Regening")
elif x < 64:
individual.chromosone = chromosone_scramble(individual)
print ("Scrambling")
else:
# individual.chromosone = arithmatic_mutation(individual)
print ("Arithmatically mutating)")
return individual.chromosone
def bound_mutation(individual):
if random.randint(0, 1) == 0:
# Lower Bound Mutation
y = Vertex(1, 1)
individual.chromosone = [y, y, y, y, y, y]
else:
# upper bound mutation
y = Vertex(10, 10)
individual.chromosone = [y, y, y, y, y, y]
return individual.chromosone
def arithmatic_mutation(individual):
x = random.randint(1, 4)
z = random.randint(1, 10)
a = random.randint(1, 10)
x = 1
temp = []
y = 0
for y in range(len(temp)):
if x == 1:
temp[y] = Vertex(individual.chromosone[y].x + z,
individual.chromosone[y].y + a)
elif x == 2:
temp[y].x = individual.chromosone[y].x - z
temp[y].y = individual.chromosone[y].y - a
elif x == 3:
temp[y].x = individual.chromosone[y].x * z
temp[y].y = individual.chromosone[y].z * a
elif x == 4:
temp[y].x = individual.chromosone[y].x / z
temp[y].y = individual.chromosone[y].z / a
return temp
def return_highest_fitness_value(fitness_dict):
y = []
for x in fitness_dict:
y.append(fitness_dict[x])
return sorted(y)[0]
def return_average_fitness(fitness_dict):
y = 0
for x in fitness_dict:
y += fitness_dict[x]
return (y / len(fitness_dict))
def return_highest_fitness_chromosone(fitness_dict):
max_fitness_object = 360
max_fitness = 360
for x in fitness_dict:
if fitness_dict[x] < max_fitness:
max_fitness_object = x
max_fitness = fitness_dict[max_fitness_object]
return max_fitness_object.chromosone
def chromosone_regen(individual):
individual.chromosone = chromosonegen()
return individual.chromosone
def chromosone_scramble(individual):
# for x in range(random.randint(0, 100)):
return point_swap(individual.chromosone, individual.chromosone)
popset = initiate_population()
# print(generate_generation(make_fitness_dict(popset)))
# for x in popset:
# print (x)
x = make_fitness_dict(popset)
# print (x)
y = fitness_select(x)
# print (y.chromosone)
y = 0
if csvgen:
csv = open('csv.txt', 'w')
csvtemp = ""
exit = False
while exit is False:
y += 1
for n in range(0, len(popset)):
h = mutation_chance(mutation_rate)
# print (h)
if h:
# print ("before: " + str(popset[n].chromosone))
popset[n].chromosone = random_mutation(popset[n])
# print ("after: " + str(popset[n].chromosone))
x = make_fitness_dict(popset)
print ("Generation " + str(y) + ". Top score is " +
str(return_highest_fitness_value(x)) + " with a chromosone of " +
str(return_highest_fitness_chromosone(x)) + ". Avg fit val is " +
str(return_average_fitness(x)))
if csvgen:
csvtemp += str(y) + "," + str(return_highest_fitness_value(x)) + "," +\
str(return_average_fitness(x)) + "\n"
if return_highest_fitness_value(x) < 16:
exit = True
print (return_highest_fitness_chromosone(x))
popset = generate_generation(popset)
if csvgen:
csv.write(csvtemp)
| StarcoderdataPython |
165380 | <reponame>appolimp/Dynamo_scripts
import logging
from base.wrapper import DB, doc
from math import pi
from .my_geom import MyPoints
def calc_angle_to_ver_or_hor_side(main_vector, second_vector):
"""
Calc angle between main and second
Then transform it to main vector or it perpendicular and make angle less than 90
:param main_vector: DB.XYZ
:param second_vector: DB.XYZ, for example UpDirection of view
:return: Angle between main and second < 90
:rtype: float
"""
angle = main_vector.AngleTo(second_vector)
logging.debug('Calc first rotation angle: {:.2f}'.format(angle * 180 / pi))
if pi / 4 < angle <= pi / 2:
angle -= pi / 2
elif pi / 2 < angle <= 3 * pi / 4:
angle += pi / 2 - pi
elif 3 * pi / 4 < angle <= pi:
angle -= pi
logging.debug('Calc change rotation angle: {:.2f}'.format(angle * 180 / pi))
sign_angle = MyPoints.calc_sign(main_vector, second_vector) * angle
logging.debug('Calc sign rotation angle: {:.2f}'.format(sign_angle * 180 / pi))
return sign_angle
def get_depends_elems_id_by_class(view, cur_class):
my_filter = DB.ElementClassFilter(cur_class)
elems_ids = view.GetDependentElements(my_filter)
logging.debug('View #{}. Get {} id elems by class: {}'.format(view.Id, len(elems_ids), cur_class))
return elems_ids
def get_depends_elems_by_class(view, cur_class):
elems_ids = get_depends_elems_id_by_class(view, cur_class)
elems = get_elems_by_ids(elems_ids)
logging.debug('View #{}. Get {} elems by class: {}'.format(view.Id, len(elems), cur_class))
return elems
def get_elems_by_ids(list_ids):
elems = []
for elem_id in list_ids:
elem = doc.GetElement(elem_id)
if elem is not None:
elems.append(elem)
return elems
| StarcoderdataPython |
4806007 | <reponame>libfirm/sisyphus
# Just import the other testsuites
import empty
import simple
import variants
import ctests.testsuite
| StarcoderdataPython |
3276960 | <gh_stars>0
import datetime as dt
from datetime import datetime
import sys
"""
---Trade Module--
1. Query the Tick data from cassandra
2. Check Order type
3. LOGIC : Market Order
3.1 : Check if the row is a block or not not
3.2 : Find the current ask and bid price
3.3 : Buy or Sell at the current price
4. LOGIC : Limit Order
4.1 : Check if the row is a block or not not
4.2 : If ratio is 0.0 then price is automatically calculate on basis of bid and ask price
4.3 : If ratio is given is non zero,price is calculated on only if the ratio gets satisfied
4.4 : If the order is not fullfilled in one hour then we get return value as NOT FOUND
5. LOGIC : Stop Order
5.1 : Place order at the given Price and wait
5.2 : If order is not fulfilled in 1 hour then return Not Found
"""
def Trades(date1,time1,product,size,price,side,Order_type,ratio,keyspace_name,session):
"""_______________________0_____1_____2_____3_____4_____5______6_______7_______8________9______10______11___"""
tick_data_query="select xric,date1,time1,number,type,price,volume,bidprice,bidsize,askprice,asksize,is_block from data where date1=? and time1>=? allow filtering"
prepared_tick_data_query=session.prepare(tick_data_query)
tick_data=session.execute(prepared_tick_data_query,(date1,time1))
execute_trade_list=[]
bidprice=0.0
bidsize=0
askprice=0.0
asksize=0
not_found='Not Found'
if Order_type=='Market':
for item in tick_data:
if item[11]=='True':
pass
else:
bidprice=bidprice if item[7]==None else round(float(item[7]),2)
bidsize=bidsize if item[8]==None else int(item[8])
askprice=askprice if item[9]==None else round(float(item[9]),2)
asksize=asksize if item[10]==None else int(item[10])
if side=='buy' and askprice!=None and askprice!=0.0 :
print "Buy"
k=side,item[2],askprice,size,date1
#print k[1]
execute_trade_list.append(k)
return execute_trade_list
if side=='sell' and bidprice!=None and bidprice!=0.0:
print "Sell"
#print size
k=side,item[2],bidprice,size,date1
#print k[1]
execute_trade_list.append(k)
return execute_trade_list
if Order_type=='Limit':
i=0
j=0
f=str(time1)[:8]
time2=datetime.strptime(f,"%H:%M:%S")+dt.timedelta(hours=1)
#print str(time2)
for item in tick_data:
if item[11]=='True':
pass
else:
f3=str(item[2])[:8]
f2=datetime.strptime(f3,"%H:%M:%S")
#print time2
if f2<=time2:
#print side
bidprice=bidprice if item[7]==None else round(float(item[7]),2)
bidsize=bidsize if item[8]==None else int(item[8])
askprice=askprice if item[9]==None else round(float(item[9]),2)
asksize=asksize if item[10]==None else int(item[10])
# for calculating automated price
if bidprice!=0.0 and side=='buy' and askprice!=0.0:
i+=1
if askprice!=0.0 and side=='sell' and bidprice!=0.0:
j+=1
if ratio!=0.0:
if i==1 and side=='buy':
if ((asksize*1.0)/bidsize)<ratio:
price=askprice
else:
price=bidprice
if j==1 and side=='sell':
if ((bidsize*1.0)/asksize)<ratio:
price=bidprice
else:
price=askprice
else:
if i==1 and side=='buy':
price=bidprice
if j==1 and side=='sell':
price=askprice
if side=='buy' and asksize!=None and price==askprice and askprice!=0.0:
print "Buy"
k=side,item[2],askprice,size,date1
#print k
execute_trade_list.append(k)
return execute_trade_list
if side=='sell' and bidsize!=None and price==bidprice and bidprice!=0.0:
print "Sell"
k=side,item[2],bidprice,size,date1
#print k
execute_trade_list.append(k)
return execute_trade_list
else:
break
execute_trade_list.append(not_found)
return execute_trade_list
if Order_type=='Stop_Buy':
f=str(time1)[:8]
time2=datetime.strptime(f,"%H:%M:%S")+dt.timedelta(hours=1)
for item in tick_data:
if item[11]=='True':
pass
else:
f3=str(item[2])[:8]
f2=datetime.strptime(f3,"%H:%M:%S")
if f2<=time2:
bidprice=bidprice if item[7]==None else round(float(item[7]),2)
bidsize=bidsize if item[8]==None else int(item[8])
askprice=askprice if item[9]==None else round(float(item[9]),2)
asksize=asksize if item[10]==None else int(item[10])
if side=='buy' and asksize!=None and price==askprice:
k=item[2],askprice,size,date1
execute_trade_list.append(k)
return execute_trade_list
else:
break
execute_trade_list.append(not_found)
return execute_trade_list
if Order_type=='Stop_Sell':
f=str(time1)[:8]
time2=datetime.strptime(f,"%H:%M:%S")+dt.timedelta(hours=1)
for item in tick_data:
if item[11]=='True':
pass
else:
f3=str(item[2])[:8]
f2=datetime.strptime(f3,"%H:%M:%S")
if f2<=time2:
bidprice=bidprice if item[7]==None else round(float(item[7]),2)
bidsize=bidsize if item[8]==None else int(item[8])
askprice=askprice if item[9]==None else round(float(item[9]),2)
asksize=asksize if item[10]==None else int(item[10])
if side=='sell' and bidsize!=None and price==bidprice:
k=item[2],bidprice,size,date1
execute_trade_list.append(k)
return execute_trade_list
else:
break
execute_trade_list.append(not_found)
return execute_trade_list
| StarcoderdataPython |
4831537 | from .base import MethodBuilderBase
from collections import OrderedDict
from itertools import chain
class BuilderMethodBuilder(MethodBuilderBase):
"""
Many of Strata's immutable classes are joda beans
constructed using a builder method.
This method builder constructs Excel wrapper methods
for those builder methods.
"""
def __init__(self, cls, method, xlname):
super().__init__(cls, method, xlname)
assert method.is_static, "Builder methods must be static"
self.__method_str = None
def __str__(self):
return self.__method_str
def build(self, all_classes):
builder_cls = all_classes.get(str(self.method.return_type))
if not builder_cls:
raise Exception(f"Builder class {self.method.return_type} not found.")
build = builder_cls.methods.get("build")
build = build[0] if len(build) == 1 else None
if not build:
raise Exception(f"Builder class {self.method.return_type} "
"expected to have exactly one build method.")
return_type = build.return_type
if str(return_type) != str(self.cls.type):
raise Exception(f"Builder class {self.method.return_type}'s "
"build method does not return {self.cls.type}.")
# Find the various set methods on the builder.
# Any set methods taking a collection are translated into
# optional parameters to the excel function.
builder_fragments = OrderedDict()
collection_parameters = OrderedDict() # {name -> type}
for name, methods in builder_cls.methods.items():
for method in methods:
if method.return_type.name == builder_cls.name \
and len(method.parameters) == 1:
pname, ptype = method.parameters[0]
self.imports.update(ptype.imports)
if ptype.package and ptype.package.startswith("com.opengamma.strata"):
if str(ptype) not in all_classes:
raise Exception(f"Class '{ptype}' hasn't been loaded (used by {self.cls.signature}).")
# collections are passed as parameters and the specific collection type
# needs to be constructed
if ptype.name in {"List", "Collection", "Set", "Iterable"}:
collection_parameters[pname] = ptype.arguments[0]
to_collection, imports = self.to_collection(ptype, pname)
self.imports.update(imports)
builder_fragments[pname] = f"""
if (null != {pname}) {{
{ptype.signature} value = {to_collection};
builder = builder.{method.name}(value);
}}
"""
else:
# add the option value to the builder if it hasn't already
# been added (collection arguments take precedence)
if ptype.is_primitive:
ptype = ptype.boxed_type
builder_fragments.setdefault(pname, f"""
Object {pname} = args.get("{pname.lower()}");
if (null != {pname}) {{
{ptype.signature} value;
try {{
value = xl.convertArgument({pname}, {ptype.signature}.class);
}} catch (Exception e) {{
throw new IllegalArgumentException("{pname} could not be converted to {ptype.signature}", e);
}}
builder = builder.{method.name}(value);
usedArgs.add("{pname.lower()}");
}}
""")
self.imports.update({
"com.exceljava.jinx.ExcelFunction",
"com.exceljava.jinx.ExcelArgument",
"com.exceljava.jinx.ExcelArguments",
"static java.util.stream.Collectors.toMap",
"java.util.HashSet",
"java.util.Map",
"java.util.Set",
"java.util.stream.IntStream"
})
self.imports.update(self.method.return_type.imports)
self.imports.update(chain(*(t.imports for n, t in self.method.parameters)))
extra_params = ""
if collection_parameters:
extra_params += ", " + ", ".join(
(f"{t.signature}[] {n}" for n, t in collection_parameters.items()))
method_str = f"""
@ExcelFunction(
value = "{self.xlname}",
category = "{self.category}",
isThreadSafe = true
)
@ExcelArguments({{
@ExcelArgument("keys"),
@ExcelArgument("values")
}})
public {return_type.signature} {self.method.name}(String[] keys, Object[] values{extra_params}) {{
if (keys.length != values.length) {{
throw new IllegalArgumentException("Keys and values must be the same length");
}}
Map<String, Object> args = IntStream
.range(0, keys.length)
.boxed()
.filter(i -> values[i] != null)
.collect(toMap(i -> keys[i].toLowerCase(), i -> values[i]));
Set<String> usedArgs = new HashSet<String>();
{builder_cls.signature} builder = {self.cls.signature}.{self.method.name}();
"""
for fragment in builder_fragments.values():
method_str += fragment
method_str += f"""
return builder.build();
}}
"""
self.__method_str = method_str
return self
| StarcoderdataPython |
3367566 | <reponame>runzezhang/Data-Structure-and-Algorithm-Notebook<filename>lintcode/0993-array-partition-i.py
# Description
# Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible.
# Example
# Input: [1,4,3,2]
# Output: 4
# Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + min(3, 4).
class Solution:
"""
@param nums: an array
@return: the sum of min(ai, bi) for all i from 1 to n
"""
def arrayPairSum(self, nums):
# Write your code here
nums.sort()
return sum(nums[::2]) | StarcoderdataPython |
1720400 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""NAS genotypes (adopted from DARTS)."""
from collections import namedtuple
Genotype = namedtuple('Genotype', 'normal normal_concat reduce reduce_concat')
# NASNet ops
NASNET_OPS = [
'skip_connect',
'conv_3x1_1x3',
'conv_7x1_1x7',
'dil_conv_3x3',
'avg_pool_3x3',
'max_pool_3x3',
'max_pool_5x5',
'max_pool_7x7',
'conv_1x1',
'conv_3x3',
'sep_conv_3x3',
'sep_conv_5x5',
'sep_conv_7x7',
]
# ENAS ops
ENAS_OPS = [
'skip_connect',
'sep_conv_3x3',
'sep_conv_5x5',
'avg_pool_3x3',
'max_pool_3x3',
]
# AmoebaNet ops
AMOEBA_OPS = [
'skip_connect',
'sep_conv_3x3',
'sep_conv_5x5',
'sep_conv_7x7',
'avg_pool_3x3',
'max_pool_3x3',
'dil_sep_conv_3x3',
'conv_7x1_1x7',
]
# NAO ops
NAO_OPS = [
'skip_connect',
'conv_1x1',
'conv_3x3',
'conv_3x1_1x3',
'conv_7x1_1x7',
'max_pool_2x2',
'max_pool_3x3',
'max_pool_5x5',
'avg_pool_2x2',
'avg_pool_3x3',
'avg_pool_5x5',
]
# PNAS ops
PNAS_OPS = [
'sep_conv_3x3',
'sep_conv_5x5',
'sep_conv_7x7',
'conv_7x1_1x7',
'skip_connect',
'avg_pool_3x3',
'max_pool_3x3',
'dil_conv_3x3',
]
# DARTS ops
DARTS_OPS = [
'none',
'max_pool_3x3',
'avg_pool_3x3',
'skip_connect',
'sep_conv_3x3',
'sep_conv_5x5',
'dil_conv_3x3',
'dil_conv_5x5',
]
NASNet = Genotype(
normal=[
('sep_conv_5x5', 1),
('sep_conv_3x3', 0),
('sep_conv_5x5', 0),
('sep_conv_3x3', 0),
('avg_pool_3x3', 1),
('skip_connect', 0),
('avg_pool_3x3', 0),
('avg_pool_3x3', 0),
('sep_conv_3x3', 1),
('skip_connect', 1),
],
normal_concat=[2, 3, 4, 5, 6],
reduce=[
('sep_conv_5x5', 1),
('sep_conv_7x7', 0),
('max_pool_3x3', 1),
('sep_conv_7x7', 0),
('avg_pool_3x3', 1),
('sep_conv_5x5', 0),
('skip_connect', 3),
('avg_pool_3x3', 2),
('sep_conv_3x3', 2),
('max_pool_3x3', 1),
],
reduce_concat=[4, 5, 6],
)
PNASNet = Genotype(
normal=[
('sep_conv_5x5', 0),
('max_pool_3x3', 0),
('sep_conv_7x7', 1),
('max_pool_3x3', 1),
('sep_conv_5x5', 1),
('sep_conv_3x3', 1),
('sep_conv_3x3', 4),
('max_pool_3x3', 1),
('sep_conv_3x3', 0),
('skip_connect', 1),
],
normal_concat=[2, 3, 4, 5, 6],
reduce=[
('sep_conv_5x5', 0),
('max_pool_3x3', 0),
('sep_conv_7x7', 1),
('max_pool_3x3', 1),
('sep_conv_5x5', 1),
('sep_conv_3x3', 1),
('sep_conv_3x3', 4),
('max_pool_3x3', 1),
('sep_conv_3x3', 0),
('skip_connect', 1),
],
reduce_concat=[2, 3, 4, 5, 6],
)
AmoebaNet = Genotype(
normal=[
('avg_pool_3x3', 0),
('max_pool_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_5x5', 2),
('sep_conv_3x3', 0),
('avg_pool_3x3', 3),
('sep_conv_3x3', 1),
('skip_connect', 1),
('skip_connect', 0),
('avg_pool_3x3', 1),
],
normal_concat=[4, 5, 6],
reduce=[
('avg_pool_3x3', 0),
('sep_conv_3x3', 1),
('max_pool_3x3', 0),
('sep_conv_7x7', 2),
('sep_conv_7x7', 0),
('avg_pool_3x3', 1),
('max_pool_3x3', 0),
('max_pool_3x3', 1),
('conv_7x1_1x7', 0),
('sep_conv_3x3', 5),
],
reduce_concat=[3, 4, 6]
)
DARTS_V1 = Genotype(
normal=[
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('skip_connect', 0),
('sep_conv_3x3', 1),
('skip_connect', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('skip_connect', 2)
],
normal_concat=[2, 3, 4, 5],
reduce=[
('max_pool_3x3', 0),
('max_pool_3x3', 1),
('skip_connect', 2),
('max_pool_3x3', 0),
('max_pool_3x3', 0),
('skip_connect', 2),
('skip_connect', 2),
('avg_pool_3x3', 0)
],
reduce_concat=[2, 3, 4, 5]
)
DARTS_V2 = Genotype(
normal=[
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 1),
('skip_connect', 0),
('skip_connect', 0),
('dil_conv_3x3', 2)
],
normal_concat=[2, 3, 4, 5],
reduce=[
('max_pool_3x3', 0),
('max_pool_3x3', 1),
('skip_connect', 2),
('max_pool_3x3', 1),
('max_pool_3x3', 0),
('skip_connect', 2),
('skip_connect', 2),
('max_pool_3x3', 1)
],
reduce_concat=[2, 3, 4, 5]
)
PDARTS = Genotype(
normal=[
('skip_connect', 0),
('dil_conv_3x3', 1),
('skip_connect', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 1),
('sep_conv_3x3', 3),
('sep_conv_3x3', 0),
('dil_conv_5x5', 4)
],
normal_concat=range(2, 6),
reduce=[
('avg_pool_3x3', 0),
('sep_conv_5x5', 1),
('sep_conv_3x3', 0),
('dil_conv_5x5', 2),
('max_pool_3x3', 0),
('dil_conv_3x3', 1),
('dil_conv_3x3', 1),
('dil_conv_5x5', 3)
],
reduce_concat=range(2, 6)
)
PCDARTS_C10 = Genotype(
normal=[
('sep_conv_3x3', 1),
('skip_connect', 0),
('sep_conv_3x3', 0),
('dil_conv_3x3', 1),
('sep_conv_5x5', 0),
('sep_conv_3x3', 1),
('avg_pool_3x3', 0),
('dil_conv_3x3', 1)
],
normal_concat=range(2, 6),
reduce=[
('sep_conv_5x5', 1),
('max_pool_3x3', 0),
('sep_conv_5x5', 1),
('sep_conv_5x5', 2),
('sep_conv_3x3', 0),
('sep_conv_3x3', 3),
('sep_conv_3x3', 1),
('sep_conv_3x3', 2)
],
reduce_concat=range(2, 6)
)
PCDARTS_IN1K = Genotype(
normal=[
('skip_connect', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 0),
('skip_connect', 1),
('sep_conv_3x3', 1),
('sep_conv_3x3', 3),
('sep_conv_3x3', 1),
('dil_conv_5x5', 4)
],
normal_concat=range(2, 6),
reduce=[
('sep_conv_3x3', 0),
('skip_connect', 1),
('dil_conv_5x5', 2),
('max_pool_3x3', 1),
('sep_conv_3x3', 2),
('sep_conv_3x3', 1),
('sep_conv_5x5', 0),
('sep_conv_3x3', 3)
],
reduce_concat=range(2, 6)
)
UNNAS_IMAGENET_CLS = Genotype(
normal=[
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 0),
('sep_conv_3x3', 2),
('sep_conv_5x5', 1),
('sep_conv_3x3', 0)
],
normal_concat=range(2, 6),
reduce=[
('max_pool_3x3', 0),
('skip_connect', 1),
('max_pool_3x3', 0),
('dil_conv_5x5', 2),
('max_pool_3x3', 0),
('sep_conv_3x3', 2),
('sep_conv_3x3', 4),
('dil_conv_5x5', 3)
],
reduce_concat=range(2, 6)
)
UNNAS_IMAGENET_ROT = Genotype(
normal=[
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1)
],
normal_concat=range(2, 6),
reduce=[
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 2),
('sep_conv_3x3', 1),
('sep_conv_3x3', 1),
('sep_conv_3x3', 2),
('sep_conv_3x3', 4),
('sep_conv_5x5', 2)
],
reduce_concat=range(2, 6)
)
UNNAS_IMAGENET_COL = Genotype(
normal=[
('skip_connect', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 1),
('skip_connect', 0),
('sep_conv_3x3', 0),
('sep_conv_3x3', 3),
('sep_conv_3x3', 0),
('sep_conv_3x3', 2)
],
normal_concat=range(2, 6),
reduce=[
('max_pool_3x3', 0),
('sep_conv_3x3', 1),
('max_pool_3x3', 0),
('sep_conv_3x3', 1),
('max_pool_3x3', 0),
('sep_conv_5x5', 3),
('max_pool_3x3', 0),
('sep_conv_3x3', 4)
],
reduce_concat=range(2, 6)
)
UNNAS_IMAGENET_JIG = Genotype(
normal=[
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 3),
('sep_conv_3x3', 1),
('sep_conv_5x5', 0)
],
normal_concat=range(2, 6),
reduce=[
('sep_conv_5x5', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_5x5', 0),
('sep_conv_3x3', 1)
],
reduce_concat=range(2, 6)
)
UNNAS_IMAGENET22K_CLS = Genotype(
normal=[
('sep_conv_3x3', 1),
('skip_connect', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 2),
('sep_conv_3x3', 1),
('sep_conv_3x3', 2),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0)
],
normal_concat=range(2, 6),
reduce=[
('max_pool_3x3', 0),
('max_pool_3x3', 1),
('dil_conv_5x5', 2),
('max_pool_3x3', 0),
('dil_conv_5x5', 3),
('dil_conv_5x5', 2),
('dil_conv_5x5', 4),
('dil_conv_5x5', 3)
],
reduce_concat=range(2, 6)
)
UNNAS_IMAGENET22K_ROT = Genotype(
normal=[
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1)
],
normal_concat=range(2, 6),
reduce=[
('max_pool_3x3', 0),
('sep_conv_5x5', 1),
('dil_conv_5x5', 2),
('sep_conv_5x5', 0),
('dil_conv_5x5', 3),
('sep_conv_3x3', 2),
('sep_conv_3x3', 4),
('sep_conv_3x3', 3)
],
reduce_concat=range(2, 6)
)
UNNAS_IMAGENET22K_COL = Genotype(
normal=[
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 2),
('sep_conv_3x3', 1),
('sep_conv_3x3', 3),
('sep_conv_3x3', 0)
],
normal_concat=range(2, 6),
reduce=[
('max_pool_3x3', 0),
('skip_connect', 1),
('dil_conv_5x5', 2),
('sep_conv_3x3', 0),
('sep_conv_3x3', 3),
('sep_conv_3x3', 0),
('sep_conv_3x3', 4),
('sep_conv_5x5', 1)
],
reduce_concat=range(2, 6)
)
UNNAS_IMAGENET22K_JIG = Genotype(
normal=[
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 0),
('sep_conv_3x3', 4)
],
normal_concat=range(2, 6),
reduce=[
('sep_conv_5x5', 0),
('skip_connect', 1),
('sep_conv_5x5', 0),
('sep_conv_3x3', 2),
('sep_conv_5x5', 0),
('sep_conv_5x5', 3),
('sep_conv_5x5', 0),
('sep_conv_5x5', 4)
],
reduce_concat=range(2, 6)
)
UNNAS_CITYSCAPES_SEG = Genotype(
normal=[
('skip_connect', 0),
('sep_conv_5x5', 1),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1)
],
normal_concat=range(2, 6),
reduce=[
('sep_conv_3x3', 0),
('avg_pool_3x3', 1),
('avg_pool_3x3', 1),
('sep_conv_5x5', 0),
('sep_conv_3x3', 2),
('sep_conv_5x5', 0),
('sep_conv_3x3', 4),
('sep_conv_5x5', 2)
],
reduce_concat=range(2, 6)
)
UNNAS_CITYSCAPES_ROT = Genotype(
normal=[
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 2),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 3),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0)
],
normal_concat=range(2, 6),
reduce=[
('max_pool_3x3', 0),
('sep_conv_5x5', 1),
('sep_conv_5x5', 2),
('sep_conv_5x5', 1),
('sep_conv_5x5', 3),
('dil_conv_5x5', 2),
('sep_conv_5x5', 2),
('sep_conv_5x5', 0)
],
reduce_concat=range(2, 6)
)
UNNAS_CITYSCAPES_COL = Genotype(
normal=[
('dil_conv_3x3', 1),
('sep_conv_3x3', 0),
('skip_connect', 0),
('sep_conv_5x5', 2),
('dil_conv_3x3', 3),
('skip_connect', 0),
('skip_connect', 0),
('sep_conv_3x3', 1)
],
normal_concat=range(2, 6),
reduce=[
('avg_pool_3x3', 1),
('avg_pool_3x3', 0),
('avg_pool_3x3', 1),
('avg_pool_3x3', 0),
('avg_pool_3x3', 1),
('avg_pool_3x3', 0),
('avg_pool_3x3', 1),
('skip_connect', 4)
],
reduce_concat=range(2, 6)
)
UNNAS_CITYSCAPES_JIG = Genotype(
normal=[
('dil_conv_5x5', 1),
('sep_conv_5x5', 0),
('sep_conv_3x3', 0),
('sep_conv_3x3', 1),
('sep_conv_3x3', 0),
('sep_conv_3x3', 2),
('sep_conv_3x3', 0),
('dil_conv_5x5', 1)
],
normal_concat=range(2, 6),
reduce=[
('avg_pool_3x3', 0),
('skip_connect', 1),
('dil_conv_5x5', 1),
('dil_conv_5x5', 2),
('dil_conv_5x5', 2),
('dil_conv_5x5', 0),
('dil_conv_5x5', 3),
('dil_conv_5x5', 2)
],
reduce_concat=range(2, 6)
)
CIFAR10_DEFAULT = Genotype(
normal=[('sep_conv_3x3', 0), ('sep_conv_3x3', 1), ('skip_connect', 0), ('sep_conv_5x5', 1), ('skip_connect', 0), ('dil_conv_3x3', 1), ('skip_connect', 0), ('sep_conv_3x3', 1)],
normal_concat=range(2, 6),
reduce=[('max_pool_3x3', 1), ('max_pool_3x3', 0), ('skip_connect', 2), ('max_pool_3x3', 1), ('dil_conv_3x3', 2), ('max_pool_3x3', 1), ('skip_connect', 2), ('avg_pool_3x3', 1)],
reduce_concat=range(2, 6)
)
CIFAR10_TRAIN_DEFAULT=Genotype(normal=[('sep_conv_3x3', 0), ('sep_conv_3x3', 1), ('max_pool_3x3', 0), ('sep_conv_3x3', 1), ('max_pool_3x3', 0), ('max_pool_3x3', 2), ('max_pool_3x3', 0), ('max_pool_3x3', 2)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('dil_conv_5x5', 2), ('dil_conv_5x5', 2), ('sep_conv_5x5', 3), ('sep_conv_5x5', 4), ('sep_conv_3x3', 3)], reduce_concat=range(2, 6))
CIFAR10_TRAIN_LARGE=Genotype(normal=[('sep_conv_3x3', 1), ('sep_conv_3x3', 0), ('sep_conv_3x3', 1), ('sep_conv_3x3', 2), ('max_pool_3x3', 0), ('sep_conv_3x3', 1), ('max_pool_3x3', 0), ('sep_conv_3x3', 1)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('dil_conv_5x5', 2), ('max_pool_3x3', 0), ('dil_conv_5x5', 2), ('max_pool_3x3', 0), ('dil_conv_5x5', 4)], reduce_concat=range(2, 6))
CIFAR10_TRAIN_LARGER=Genotype(normal=[('sep_conv_3x3', 1), ('sep_conv_3x3', 0), ('max_pool_3x3', 0), ('sep_conv_3x3', 1), ('sep_conv_3x3', 1), ('sep_conv_5x5', 0), ('sep_conv_3x3', 2), ('sep_conv_5x5', 4)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('max_pool_3x3', 1), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('dil_conv_5x5', 3), ('max_pool_3x3', 0), ('dil_conv_5x5', 4), ('sep_conv_5x5', 3)], reduce_concat=range(2, 6))
CIFAR10_TRAIN_SMALL=Genotype(normal=[('sep_conv_3x3', 1), ('sep_conv_3x3', 0), ('sep_conv_3x3', 1), ('sep_conv_3x3', 2), ('sep_conv_3x3', 1), ('max_pool_3x3', 2), ('sep_conv_3x3', 2), ('sep_conv_3x3', 1)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('dil_conv_5x5', 2), ('max_pool_3x3', 0), ('sep_conv_5x5', 2), ('dil_conv_5x5', 3), ('sep_conv_3x3', 3), ('sep_conv_5x5', 4)], reduce_concat=range(2, 6))
CIFAR10_TRAIN_SMALLER=Genotype(normal=[('sep_conv_3x3', 0), ('sep_conv_3x3', 1), ('sep_conv_3x3', 1), ('sep_conv_3x3', 2), ('sep_conv_3x3', 1), ('sep_conv_3x3', 0), ('sep_conv_3x3', 1), ('sep_conv_3x3', 4)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_3x3', 1), ('sep_conv_5x5', 2), ('max_pool_3x3', 0), ('sep_conv_5x5', 3), ('sep_conv_5x5', 2), ('sep_conv_5x5', 4), ('max_pool_3x3', 3)], reduce_concat=range(2, 6))
lr_0p01 = Genotype(normal=[('sep_conv_3x3', 0), ('sep_conv_5x5', 1), ('sep_conv_3x3', 1), ('sep_conv_5x5', 2), ('sep_conv_5x5', 1), ('dil_conv_3x3', 0), ('sep_conv_5x5', 4), ('sep_conv_3x3', 1)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('sep_conv_5x5', 2), ('sep_conv_5x5', 0), ('sep_conv_5x5', 2), ('sep_conv_3x3', 3), ('sep_conv_3x3', 4), ('dil_conv_5x5', 2)], reduce_concat=range(2, 6))
lr_0p1= Genotype(normal=[('skip_connect', 0), ('skip_connect', 1), ('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('sep_conv_3x3', 0), ('dil_conv_5x5', 1), ('max_pool_3x3', 0), ('skip_connect', 1)], normal_concat=range(2, 6), reduce=[('sep_conv_5x5', 0), ('dil_conv_5x5', 1), ('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('dil_conv_3x3', 3), ('max_pool_3x3', 1), ('max_pool_3x3', 3)], reduce_concat=range(2, 6))
lr_0p03= Genotype(normal=[('sep_conv_3x3', 1), ('sep_conv_3x3', 0), ('max_pool_3x3', 0), ('skip_connect', 2), ('sep_conv_3x3', 1), ('dil_conv_3x3', 3), ('dil_conv_3x3', 2), ('sep_conv_5x5', 3)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('max_pool_3x3', 1), ('max_pool_3x3', 0), ('dil_conv_5x5', 2), ('dil_conv_3x3', 3), ('max_pool_3x3', 1), ('sep_conv_5x5', 3), ('sep_conv_3x3', 1)], reduce_concat=range(2, 6))
lr_0p3= Genotype(normal=[('dil_conv_3x3', 0), ('max_pool_3x3', 1), ('dil_conv_5x5', 0), ('dil_conv_3x3', 1), ('dil_conv_5x5', 0), ('skip_connect', 3), ('sep_conv_3x3', 0), ('skip_connect', 2)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('max_pool_3x3', 1), ('sep_conv_3x3', 0), ('dil_conv_5x5', 3), ('dil_conv_5x5', 2), ('skip_connect', 3), ('max_pool_3x3', 1)], reduce_concat=range(2, 6))
small_0p1=Genotype(normal=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('sep_conv_5x5', 0), ('sep_conv_5x5', 2), ('dil_conv_5x5', 2), ('sep_conv_3x3', 1), ('sep_conv_5x5', 0), ('sep_conv_5x5', 2)], normal_concat=range(2, 6), reduce=[('sep_conv_5x5', 1), ('sep_conv_5x5', 0), ('max_pool_3x3', 0), ('sep_conv_5x5', 2), ('dil_conv_5x5', 3), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('dil_conv_5x5', 3)], reduce_concat=range(2, 6))
small_0p01=Genotype(normal=[('max_pool_3x3', 0), ('dil_conv_5x5', 1), ('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('dil_conv_5x5', 2), ('sep_conv_5x5', 0), ('max_pool_3x3', 0), ('dil_conv_3x3', 3)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('dil_conv_5x5', 1), ('max_pool_3x3', 0), ('dil_conv_3x3', 2), ('sep_conv_5x5', 3), ('sep_conv_5x5', 0), ('sep_conv_5x5', 3), ('sep_conv_3x3', 4)], reduce_concat=range(2, 6))
small_0p001=Genotype(normal=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('sep_conv_5x5', 1), ('dil_conv_5x5', 0), ('sep_conv_5x5', 2), ('sep_conv_5x5', 3), ('max_pool_3x3', 0), ('dil_conv_5x5', 4)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('dil_conv_5x5', 2), ('sep_conv_5x5', 1), ('sep_conv_5x5', 0), ('dil_conv_5x5', 3), ('sep_conv_5x5', 4), ('sep_conv_5x5', 3)], reduce_concat=range(2, 6))
small_0p0001=Genotype(normal=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('dil_conv_5x5', 1), ('dil_conv_5x5', 2), ('sep_conv_5x5', 1), ('sep_conv_5x5', 1), ('sep_conv_3x3', 4)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('max_pool_3x3', 1), ('sep_conv_5x5', 2), ('sep_conv_3x3', 1), ('sep_conv_5x5', 0), ('sep_conv_3x3', 2), ('dil_conv_3x3', 1), ('dil_conv_5x5', 0)], reduce_concat=range(2, 6))
small_0p3=Genotype(normal=[('sep_conv_5x5', 1), ('sep_conv_5x5', 0), ('dil_conv_5x5', 0), ('dil_conv_5x5', 2), ('max_pool_3x3', 0), ('sep_conv_5x5', 2), ('sep_conv_5x5', 1), ('sep_conv_5x5', 3)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('max_pool_3x3', 2), ('sep_conv_5x5', 3), ('dil_conv_3x3', 1), ('sep_conv_5x5', 4), ('sep_conv_5x5', 2)], reduce_concat=range(2, 6))
small_0p03=Genotype(normal=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('dil_conv_5x5', 0), ('dil_conv_3x3', 2), ('max_pool_3x3', 0), ('sep_conv_5x5', 3), ('sep_conv_5x5', 2), ('sep_conv_5x5', 3)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('sep_conv_5x5', 2), ('sep_conv_5x5', 1), ('sep_conv_5x5', 3), ('dil_conv_5x5', 2), ('sep_conv_5x5', 2), ('sep_conv_5x5', 4)], reduce_concat=range(2, 6))
small_0p003=Genotype(normal=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('dil_conv_5x5', 2), ('sep_conv_5x5', 1), ('sep_conv_5x5', 3), ('sep_conv_5x5', 2), ('sep_conv_5x5', 1), ('dil_conv_5x5', 4)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 1), ('sep_conv_5x5', 0), ('sep_conv_5x5', 2), ('sep_conv_5x5', 1), ('sep_conv_5x5', 0), ('sep_conv_5x5', 1), ('sep_conv_5x5', 4), ('sep_conv_5x5', 2)], reduce_concat=range(2, 6))
small_0p0003=Genotype(normal=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('dil_conv_5x5', 0), ('dil_conv_5x5', 1), ('sep_conv_5x5', 2), ('sep_conv_5x5', 3), ('max_pool_3x3', 0), ('sep_conv_5x5', 3)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('sep_conv_5x5', 1), ('sep_conv_5x5', 0), ('sep_conv_5x5', 0), ('sep_conv_5x5', 1), ('dil_conv_5x5', 3), ('max_pool_3x3', 0)], reduce_concat=range(2, 6))
small_0p00003=Genotype(normal=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('sep_conv_3x3', 0), ('sep_conv_5x5', 2), ('sep_conv_5x5', 1), ('sep_conv_5x5', 3), ('sep_conv_5x5', 2), ('dil_conv_5x5', 3)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_3x3', 1), ('sep_conv_5x5', 2), ('sep_conv_5x5', 1), ('sep_conv_5x5', 1), ('sep_conv_5x5', 3), ('sep_conv_5x5', 1), ('sep_conv_5x5', 4)], reduce_concat=range(2, 6))
small_default=Genotype(normal=[('sep_conv_5x5', 0), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('sep_conv_3x3', 2), ('dil_conv_5x5', 0), ('sep_conv_3x3', 1), ('max_pool_3x3', 0), ('sep_conv_3x3', 4)], normal_concat=range(2, 6), reduce=[('max_pool_3x3', 0), ('sep_conv_5x5', 1), ('max_pool_3x3', 0), ('max_pool_3x3', 1), ('sep_conv_3x3', 2), ('sep_conv_5x5', 3), ('skip_connect', 1), ('dil_conv_5x5', 4)], reduce_concat=range(2, 6))
# Supported genotypes
GENOTYPES = {
'nas': NASNet,
'pnas': PNASNet,
'amoeba': AmoebaNet,
'darts_v1': DARTS_V1,
'darts_v2': DARTS_V2,
'pdarts': PDARTS,
'pcdarts_c10': PCDARTS_C10,
'pcdarts_in1k': PCDARTS_IN1K,
'unnas_imagenet_cls': UNNAS_IMAGENET_CLS,
'unnas_imagenet_rot': UNNAS_IMAGENET_ROT,
'unnas_imagenet_col': UNNAS_IMAGENET_COL,
'unnas_imagenet_jig': UNNAS_IMAGENET_JIG,
'unnas_imagenet22k_cls': UNNAS_IMAGENET22K_CLS,
'unnas_imagenet22k_rot': UNNAS_IMAGENET22K_ROT,
'unnas_imagenet22k_col': UNNAS_IMAGENET22K_COL,
'unnas_imagenet22k_jig': UNNAS_IMAGENET22K_JIG,
'unnas_cityscapes_seg': UNNAS_CITYSCAPES_SEG,
'unnas_cityscapes_rot': UNNAS_CITYSCAPES_ROT,
'unnas_cityscapes_col': UNNAS_CITYSCAPES_COL,
'unnas_cityscapes_jig': UNNAS_CITYSCAPES_JIG,
'cifar10_default': CIFAR10_DEFAULT,
'cifar10_train_default' : CIFAR10_TRAIN_DEFAULT,
'cifar10_train_large' : CIFAR10_TRAIN_LARGE,
'cifar10_train_larger' : CIFAR10_TRAIN_LARGER,
'cifar10_train_small' : CIFAR10_TRAIN_SMALL,
'cifar10_train_smaller' : CIFAR10_TRAIN_SMALLER,
'lr_0p01' : lr_0p01,
'lr_0p1' : lr_0p1,
'lr_0p03' : lr_0p03,
'lr_0p3' : lr_0p3,
'small_0p1' : small_0p1,
'small_0p01' : small_0p01,
'small_0p001' : small_0p001,
'small_0p0001' : small_0p0001,
'small_0p3' : small_0p3,
'small_0p03' : small_0p03,
'small_0p003' : small_0p003,
'small_0p0003' : small_0p0003,
'small_0p00003' : small_0p00003,
'small_default' : small_default,
'custom': None,
}
| StarcoderdataPython |
125135 | <filename>pycorrel/__init__.py<gh_stars>0
"""Top-level package for pycorrel."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.1'
| StarcoderdataPython |
75612 | <gh_stars>100-1000
# Copyright 2016 Rackspace
# Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import MetaData, select, Table, and_, not_
def has_migrations(engine):
"""Returns true if at least one data row can be migrated.
There are rows left to migrate if:
#1 There exists a row with visibility not set yet.
Or
#2 There exists a private image with active members but its visibility
isn't set to 'shared' yet.
Note: This method can return a false positive if data migrations
are running in the background as it's being called.
"""
meta = MetaData(engine)
images = Table('images', meta, autoload=True)
rows_with_null_visibility = (select([images.c.id])
.where(images.c.visibility == None)
.limit(1)
.execute())
if rows_with_null_visibility.rowcount == 1:
return True
image_members = Table('image_members', meta, autoload=True)
rows_with_pending_shared = (select([images.c.id])
.where(and_(
images.c.visibility == 'private',
images.c.id.in_(
select([image_members.c.image_id])
.distinct()
.where(not_(image_members.c.deleted))))
)
.limit(1)
.execute())
if rows_with_pending_shared.rowcount == 1:
return True
return False
def _mark_all_public_images_with_public_visibility(images):
migrated_rows = (images
.update().values(visibility='public')
.where(images.c.is_public)
.execute())
return migrated_rows.rowcount
def _mark_all_non_public_images_with_private_visibility(images):
migrated_rows = (images
.update().values(visibility='private')
.where(not_(images.c.is_public))
.execute())
return migrated_rows.rowcount
def _mark_all_private_images_with_members_as_shared_visibility(images,
image_members):
migrated_rows = (images
.update().values(visibility='shared')
.where(and_(images.c.visibility == 'private',
images.c.id.in_(
select([image_members.c.image_id])
.distinct()
.where(not_(image_members.c.deleted)))))
.execute())
return migrated_rows.rowcount
def _migrate_all(engine):
meta = MetaData(engine)
images = Table('images', meta, autoload=True)
image_members = Table('image_members', meta, autoload=True)
num_rows = _mark_all_public_images_with_public_visibility(images)
num_rows += _mark_all_non_public_images_with_private_visibility(images)
num_rows += _mark_all_private_images_with_members_as_shared_visibility(
images, image_members)
return num_rows
def migrate(engine):
"""Set visibility column based on is_public and image members."""
return _migrate_all(engine)
| StarcoderdataPython |
1665261 | import datetime
from src import *
import sys,getopt
import os
def align_init(allSymbols,variantTable=None):
if variantTable:
#設定使用 UnicodeTextScoreMatrix
# 帶入異體字表
mUTSM=UnicodeTextScoreMatrix(alphabet=allSymbols,variantTable=variantTable)
else:
#設定使用 UnicodeTextScoreMatrix
mUTSM=UnicodeTextScoreMatrix(alphabet=allSymbols)
# 初始化比對物件,帶入UnicodeTextScoreMatrix
# 尚待處理:加入分數門檻。
alignerObject = Aligner(matrix=mUTSM)
return alignerObject
def align(
refID,refString,qryID,qryString,
msgType = 2, # 可能值為 1: 正式輸出, 2: Debug 輸出
quickMode = False, # Joey Quick Mode
minLen=10, #欲比對/顯示之字串低於此門檻,便停止
distinctChars=None, #預輸入的不重複字 (optional)
variantTable=None, # 異體字比對表,有傳值進來就會啟動異體字比對 (optional)
multipleAlignment=False #是否要進行多次比對
):
#輸出訊息用
num_turns=0
compareTaskQueue=[] #用來存放比較工作的Queue
msg =[] #累計Report
t0 = datetime.datetime.now()
#不重複字元清單
dcs = distinctChars if distinctChars else "".join(set(list(refString)+list(qryString)))
# if distinctChars:
# dcs=distinctChars
# else:
# dcs="".join(set(list(refString)+list(qryString)))
#處始化比對器
aligner = align_init(dcs,variantTable)
#比較句長於MIN_COMP_LENGTH,放入比較範圍Queue
if (len(refString)>=minLen and len(qryString)>=minLen):
compareTaskQueue=[(0,len(refString),0,len(qryString))]
while(len(compareTaskQueue)>0):
num_turns+=1 #迴圈記數
#由Queue中,取出比較範圍
# crBegin 可理解為 compare_ref_begin
# cqBegin 可理解為 compare_qry_begin
comInterval=compareTaskQueue.pop()
crBegin,crEnd,cqBegin,cqEnd=comInterval
#找出本次比較字串
crString=refString[crBegin:crEnd]
cqString=qryString[cqBegin:cqEnd]
# t2 = datetime.datetime.now()
#進行比對,不進行反向比對 (dna 比對專用)
alignment = aligner.align(reference=crString, query=cqString,qMode=quickMode,revcomp=False)
# t3 = datetime.datetime.now()
#print ("第{}次比對,花費:{:.7f} 秒".format(num_turns,(t3 - t2).microseconds*0.000001))
#取得分數與長度
arScore=alignment.score
arLen=alignment.reference_end-alignment.reference_begin
aqLen=alignment.query_end-alignment.query_begin
#比對成果大於需求,表示有找到有效區段
if ((arLen >=minLen) and (aqLen >=minLen)):
msg=alignReport(alignment,refID,crString,qryID,cqString,comInterval,msgType,nturn=num_turns)
#若 multipleAlignment == True 則進行切割與加入Queue
#這部份考慮要廢掉了
# 2020/03/09 先封存
# if (multipleAlignment):
# if ((arBegin-crBegin)>=minLen and (aqBegin-cqBegin)>=minLen):
# compareTaskQueue.append((crBegin,arBegin,cqBegin,aqBegin))
# if ((cqEnd-aqEnd)>=minLen and (crEnd-arEnd)>=minLen):
# compareTaskQueue.append((arEnd,crEnd,aqEnd,cqEnd))
return msg
def alignReport(alignment, refID,crString,qryID,cqString,compareInterval,
msgType=2,nturn=-1):
# msgType = 1, 正式輸出訊息
# msgType = 2, Debug 訊息
# msgType = 3, 原程式Report
crBegin,crEnd,cqBegin,cqEnd=compareInterval
arBegin=alignment.reference_begin+crBegin
arEnd=alignment.reference_end+crBegin
#aqBegin 可理解為 align_qry_begin
aqBegin=alignment.query_begin+cqBegin
aqEnd=alignment.query_end+cqBegin
# arBegin2=alignment.reference_begin2+crBegin
# aqBegin2=alignment.query_begin2+cqBegin
arScore=alignment.score
# arLen=alignment.reference_end-alignment.reference_begin
# aqLen=alignment.query_end-alignment.query_begin
msg =[]
# class Alignment(object):
# def __init__ (self, alignment, query, reference, matrix=None):
#sid1,sid2,score,align1,align2,s1_start,s1_end,s2_start,s2_end
#P1618_001_0007,T1799_001_0034,38,眾生---生死相續皆由不知常住真心,眾生無始生-死相續皆由不知常住真心,23,36,2,17
if (msgType ==1): #判斷 1 的bit 是否有set
m=alignment.alignment
r = [refID,qryID,arScore,m[0].replace("〇","-"),m[2].replace("〇","-"),crBegin,crEnd,cqBegin,cqEnd]
s="\t".join(str(d) for d in r)
msg.append(s)
elif (msgType==2): #判斷 2 的bit 是否有set
msg.append("======== My Report #{} ========== ".format(nturn))
msg.append("比對對象:Ref[{}:{}] (ID:{}):: Query[{}:{}] (ID:{}) ".format(crBegin,crEnd,refID,cqBegin,cqEnd,qryID))
msg.append("[原]最佳比對位置:Ref[{}:{}] :: Query[{}:{}] ".format(arBegin,arEnd,aqBegin,aqEnd))
# msg.append("最佳比對位置:Ref[{}:{}] :: Query[{}:{}] ".format(arBegin2,arEnd,aqBegin2,aqEnd))
# if not (arBegin ==arBegin2) or not (aqBegin ==aqBegin2):
# print("[mismatch] 出發點不同!!")
msg.append("結果:score={}, 比對句:".format(arScore))
# msg.append("結果2:n_score={}, 比對句:".format(alignment.n_score))
# msg.append("------ original align message -----")
msg+=alignment.alignment
# msg.append("------ new align message -----")
# msg+=alignment.alignment_n
# msg.append(" "*4+"Ref [{}:{}]({}) {}".format(arBegin,arEnd,arLen,refString[arBegin:arEnd]))
# msg.append(" "*4+"Qry [{}:{}]({}) {}".format(aqBegin,aqEnd,aqLen,qryString[aqBegin:aqEnd]))
elif (msgType==3):
r=alignment.alignment_report()
#r=alignment.alignment
msg.append(r)
return msg
def usage():
print("usage: mytest.py [-o output FILE ] [-dpqv] FILE1 [FILE2] ")
# main function starts here:
FILE_PATH=os.path.dirname(__file__)
#重要的流程控制參數,與外來參數有關
OUTPUT_filename=None
inputFormat="fullText" # 選項為:fullText 與 sentencePair
variantMode = False # Ture/False 控制是否進行異體字比對
variantFileLocation =os.path.join(FILE_PATH,"data","variants.txt")
mssageType=1 # 1: 正式輸出, 2: Debug輸出 (可由command line 加上-d 來控制)
qMode=False # Joey 加速Mode
try:
opts, args = getopt.getopt(sys.argv[1:], "dqpvo:")
except getopt.GetoptError as err:
# print help information and exit:
print(err) # will print something like "option -a not recognized"
usage()
sys.exit(2)
#抓取 -o 的選項與值
for opt,value in opts:
if "-o" in opt:
OUTPUT_filename = value
if "-p" in opt:
inputFormat = "sentencePair"
if "-v" in opt:
variantMode = True
if "-d" in opt:
mssageType=2
if "-q" in opt:
qMode = True # Joey 加速Mode
#一般讀檔,需要兩個檔
#測試始否給定 FILE1 與 FILE2
if (inputFormat=="fullText" and len(args) !=2) :
print ("Please specify FILE1 and FILE2 for comparsion.")
usage()
sys.exit(2)
elif (inputFormat=="sentencePair" and len(args) !=1) :
print ("Please specify Sentence Pair FILE for comparsion.")
usage()
sys.exit(2)
compareStringArray=[] #紀錄用來比較的Array
if (OUTPUT_filename): print("開始執行比對:")
if inputFormat == "fullText":
#開檔, reference & query
# 2020/03/09 輸入格式改為:id \tab text
with open(args[0],'r') as ifile1, open(args[1],'r') as ifile2:
print("資料模式:兩全文檔比對")
print("Reading Files:{},{}".format(args[0],args[1]))
ref=ifile1.read().strip().split("\t")
qry=ifile2.read().strip().split("\t")
compareStringArray.append((ref[0],ref[1],qry[0],qry[1]))
elif inputFormat == "sentencePair":
# 2020/03/09 輸入格式改為:id1 \tab text1 \tab id2 \tab text2
#開檔,依序讀入需要分割的字串
print("Reading File:{}".format(args[0]))
print("資料模式:Sentence Pair")
with open(args[0],'r') as ifile1:
for s in ifile1:
compareStringArray.append(tuple(s.strip().split("\t")))
vt=None
if variantMode:
vt=VariantTable(variantCSVFile=variantFileLocation)
print("異體字比對:On")
vt=None
if variantMode:
vt=VariantTable(variantCSVFile=variantFileLocation)
loop=0
t0 = datetime.datetime.now()
alignMessges=[]
task_length=len(compareStringArray)
while (len(compareStringArray)):
if (loop%1000)==0:
tnow = datetime.datetime.now()
tms=(tnow-t0).microseconds
progress = loop/task_length*100
speed = (tms)/(loop+1)
expTime = speed*(task_length-loop)*0.000001
#print("\r開始比對... {:.0f}% ({:.2f} ms/pair) (剩餘時間:{:.2} sec)".format(progress,speed,expTime),end="",flush=True)
if (OUTPUT_filename): print("\r開始比對... {:.0f}% ".format(progress),end="",flush=True)
refID,refString,qryID,qryString = compareStringArray.pop()
loop+=1
#print("{},".format(loop),end="")
# endtime = datetime.datetime.now()
# print ("執行完成,花費:{:.6f} 秒".format((endtime-starttime).microseconds*0.000001))
rMsg = align(refID,refString,qryID,qryString,mssageType,quickMode=qMode,variantTable=vt)
alignMessges.extend(rMsg)
if (not OUTPUT_filename):
for m in rMsg:
print(m)
t1= datetime.datetime.now()
print ("")
print ("執行完成,花費:{} 秒".format((t1-t0).seconds))
#取得內建 report 字串
# r=alignment.alignment_report()
# #先用簡單作法,讓字元能夠正確對應,之後會修正
# r=r.replace("|","|").replace("*","*").replace("-","〇")
if (OUTPUT_filename):
print ("結果輸出於:{}".format(OUTPUT_filename))
with open(OUTPUT_filename,'w') as ofile:
ofile.write("\r\n".join(alignMessges)) | StarcoderdataPython |
185100 | <gh_stars>0
from django.urls import path, include
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework.routers import DefaultRouter
from . import views
router = DefaultRouter()
router.register(r"structures", views.StructureViewSet)
urlpatterns = [
# API paths
path(
"import_declarations/add/<str:country_id>",
views.add_multi_import_declarations,
name="api_import_declaration_multi_add",
),
path(
"import_declaration/del/<int:import_declaration_id>",
views.import_declaration_del,
name="api_import_declaration_del",
),
path(
"import_declaration/pro/<int:parent_id>/<int:structure_id>/<int:import_declaration_id>",
views.import_declaration_pro,
name="api_import_declaration_pro",
),
path(
"import_declaration/dec/<int:area_id>/<int:import_declaration_id>",
views.declaration_from_import,
name="api_import_declaration_dec",
),
path(
"areas/add/<int:parent_id>/<int:structure_id>",
views.add_multi_areas,
name="api_area_multi_add",
),
path(
"structure/<int:structure_id>/add_subtree",
views.structure_add_subtree,
name="api_structure_add_subtree",
),
path(
"country/<str:country_code>/population",
views.country_population,
name="api_country_population",
),
path(
"country/<str:country_code>/declarations",
views.country_declarations,
name="api_country_declarations",
),
path(
"country/<str:country_code>/population_timeline",
views.country_population_timeline,
name="api_country_pop_time",
),
path(
"country/<str:country_code>/pop_by_location",
views.country_pop_by_location,
name="api_country_pop_location",
),
path(
"country/<str:country_code>/regenerate_timeline",
views.country_regenerate_timeline,
name="api_country_regen_time",
),
path(
"country/<str:country_code>/trigger_recount",
views.country_trigger_recount,
name="api_country_trigger_recount",
),
path(
"popcount/regenerate",
views.trigger_all_recounts,
name="api_trigger_all_recounts",
),
path("area/del/<int:area_id>", views.area_del, name="api_area_del"),
path("area/<int:area_id>/row", views.area_data, name="api_area_data"),
path(
"structure/del/<int:structure_id>",
views.structure_del,
name="api_structure_del",
),
path(
"declaration/del/<int:declaration_id>",
views.declaration_del,
name="api_declaration_del",
),
path("link/del/<int:link_id>", views.link_del, name="api_link_del"),
path(
"world/population_timeline",
views.world_population_timeline,
name="api_world_pop_time",
),
# DRF API paths
path("area/", views.AreaList.as_view()),
path("area/<int:pk>", views.AreaDetail.as_view()),
path("area/<int:pk>/children/", views.AreaChildren.as_view()),
path("", include(router.urls)),
]
| StarcoderdataPython |
3396952 | import ssl
ctx = ssl._create_unverified_context() # Noncompliant: by default hostname verification is not done
ctx = ssl._create_stdlib_context() # Noncompliant: by default hostname verification is not done
ctx = ssl.create_default_context()
ctx.check_hostname = False # Noncompliant
ctx = ssl._create_default_https_context()
ctx.check_hostname = False # Noncompliant
| StarcoderdataPython |
1714644 |
def main(j, args, params, tags, tasklet):
def chunks(l, n):
""" Yield successive n-sized chunks from l.
"""
for i in xrange(0, len(l), n):
yield l[i:i+n]
page = args.page
params.result = page
if not page._hasmenu:
page.addMessage("**error: Cannot create page because menudropdown macro can only be used if beforehand a menu macro was used")
return params
keyword = args.tags.tagGet('marker', "$$$menuright")
#todo what does this do? (4kds)
if page.body.find(keyword) == -1:
return params
ddcode = """
<li class="dropdown">
<a href="#" class="dropdown-toggle pull-right {klass}" data-toggle="dropdown">{name}<b class="caret"></b></a>
<ul class="dropdown-menu mega-menu" style="min-width: {widthsize}px;">
{items}
</ul>
</li>
"""
items = ""
header = args.tags.tagGet("name", "Admin")
klass = args.tags.tagGet("class", "")
contents = j.core.hrd.get(content=args.cmdstr + '\n')
columns = contents.getDictFromPrefix('column')
amountcolumns = 0
for title, rows in columns.iteritems():
if not isinstance(rows, dict):
continue
chunkedrows = list(chunks(rows.items(), 12))
amountcolumns += len(chunkedrows)
for idx, tenrow in enumerate(chunkedrows):
items += '<li class="mega-menu-column" style="width: {colpercent}%; float: left; padding-left: 10px;">'
if idx == 0:
items += '<ul>'
items += '<li class="dropdown-header">%s</li>' % title
else:
items += '<ul style="padding-top: 34px;">'
for name, target in tenrow:
external = ""
if target.endswith(':external'):
external = "target=\"_blank\""
target = target.rstrip(':external')
if name != "" and name[0] != "#":
name = name.strip()
line = "<li><a href=\"%s\" %s>%s</a></li>" % (target, external, name)
items += "%s\n" % line
items += '</ul></li>'
colpercent = 100 / (amountcolumns or 1)
items = items.format(colpercent=colpercent)
ddcode = ddcode.format(items=items, name=header, klass=klass, widthsize=180*amountcolumns)
ddcode += '$$$menuright'
page.body = page.body.replace(keyword, ddcode)
return params
def match(j, args, params, tags, tasklet):
return True
| StarcoderdataPython |
3350831 | <gh_stars>10-100
from channels.generic.websocket import AsyncJsonWebsocketConsumer, AsyncWebsocketConsumer
import json
from channels.layers import get_channel_layer
from asgiref.sync import async_to_sync
from users.models import User
from config_default import configs
from qiniu import Auth
class ChatConsumer(AsyncJsonWebsocketConsumer):
chats = dict()
async def connect(self):
self.group_name = self.scope['url_route']['kwargs']['group_name']
await self.channel_layer.group_add(self.group_name, self.channel_name)
# 将用户添加至聊天组信息chats中
try:
ChatConsumer.chats[self.group_name].add(self)
except:
ChatConsumer.chats[self.group_name] = set([self])
# print(ChatConsumer.chats)
# 创建连接时调用
await self.accept()
async def disconnect(self, close_code):
# 连接关闭时调用
# 将关闭的连接从群组中移除
await self.channel_layer.group_discard(self.group_name, self.channel_name)
# 将该客户端移除聊天组连接信息
ChatConsumer.chats[self.group_name].remove(self)
await self.close()
async def receive_json(self, message, **kwargs):
# 收到信息时调用
to_user = message.get('to_user')
from_user = message.get('from_user')
time = message.get('time')
# 信息发送
length = len(ChatConsumer.chats[self.group_name])
if length == 2:
# print('两个人')
await self.channel_layer.group_send(
self.group_name,
{
"type": "chat.message",
"message": message.get('message'),
"from_user": from_user,
"to_user": to_user,
"time": time,
},
)
else:
try:
user = User.objects.get(id__exact=from_user)
except User.DoesNotExist:
user = None
q = Auth(configs.get('qiniu').get('AK'), configs.get('qiniu').get('SK'))
avatar_url = q.private_download_url(user.user_image_url, expires=3600)
from_username = user.username
await self.channel_layer.group_send(
to_user,
{
"type": "push.message",
"event": {
'message': message.get('message'),
'group': self.group_name,
'from_user': from_user,
'time': time,
'avatar_url': avatar_url,
'from_username': from_username,
},
},
)
async def chat_message(self, event):
# Handles the "chat.message" event when it's sent to us.
# print(event)
await self.send_json({
"message": event["message"],
"from_user": event["from_user"],
"to_user": event["to_user"],
"time": event["time"],
})
# 推送consumer
class PushConsumer(AsyncWebsocketConsumer):
async def connect(self):
self.group_name = self.scope['url_route']['kwargs']['id']
await self.channel_layer.group_add(
self.group_name,
self.channel_name
)
await self.accept()
async def disconnect(self, close_code):
await self.channel_layer.group_discard(
self.group_name,
self.channel_name
)
# print(PushConsumer.chats)
async def push_message(self, event):
# print(event)
await self.send(text_data=json.dumps({
"event": event['event']
}))
def push(username, event):
channel_layer = get_channel_layer()
async_to_sync(channel_layer.group_send)(
username,
{
"type": "push.message",
"event": event
}
)
| StarcoderdataPython |
71165 | <reponame>MuhammadSulaiman001/Autopilot<gh_stars>0
# # Sunny data
# outFeaturesPath = "models/features_40_sun_only"
# outLabelsPath = "models/labels_sun_only"
# imageFolderName = 'IMG_sun_only'
# features_directory = '../data/'
# labels_file = '../data/driving_log_sun_only.csv'
# modelPath = 'models/MsAutopilot_sun_only.h5'
# NoColumns = 3 # steering value index in csv
# # Foggy data
# outFeaturesPath = "models/features_40_foggy"
# outLabelsPath = "models/labels_foggy"
# imageFolderName = 'IMG_foggy'
# features_directory = '../data/'
# labels_file = '../data/driving_log_foggy.csv'
# modelPath = 'models/MsAutopilot_foggy.h5'
# NoColumns = 6 # steering value index in csv
# # Test data (fog only, no model will be trained, just pickles to extract)
outFeaturesPath = "models/features_40_fog_only"
outLabelsPath = "models/labels_fog_only"
imageFolderName = 'IMG_fog_only'
features_directory = '../data/'
labels_file = '../data/driving_log_fog_only.csv'
NoColumns = 3 # steering value index in csv
modelPathFoggy = 'models/MsAutopilot_foggy.h5'
modelPathSunOnly = 'models/MsAutopilot_sun_only.h5'
| StarcoderdataPython |
3227340 | <reponame>illume/numpy3k
import os
import genapi
types = ['Generic','Number','Integer','SignedInteger','UnsignedInteger',
'Inexact', 'TimeInteger',
'Floating', 'ComplexFloating', 'Flexible', 'Character',
'Byte','Short','Int', 'Long', 'LongLong', 'UByte', 'UShort',
'UInt', 'ULong', 'ULongLong', 'Float', 'Double', 'LongDouble',
'CFloat', 'CDouble', 'CLongDouble', 'Object', 'String', 'Unicode',
'Void', 'Datetime', 'Timedelta']
h_template = r"""
#ifdef _MULTIARRAYMODULE
typedef struct {
PyObject_HEAD
npy_bool obval;
} PyBoolScalarObject;
NPY_NO_EXPORT unsigned int PyArray_GetNDArrayCVersion (void);
#ifdef NPY_ENABLE_SEPARATE_COMPILATION
extern NPY_NO_EXPORT int NPY_NUMUSERTYPES;
extern NPY_NO_EXPORT PyTypeObject PyBigArray_Type;
extern NPY_NO_EXPORT PyTypeObject PyArray_Type;
extern NPY_NO_EXPORT PyTypeObject PyArrayDescr_Type;
extern NPY_NO_EXPORT PyTypeObject PyArrayFlags_Type;
extern NPY_NO_EXPORT PyTypeObject PyArrayIter_Type;
extern NPY_NO_EXPORT PyTypeObject PyArrayMapIter_Type;
extern NPY_NO_EXPORT PyTypeObject PyArrayMultiIter_Type;
extern NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type;
extern NPY_NO_EXPORT PyTypeObject PyBoolArrType_Type;
extern NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2];
#else
NPY_NO_EXPORT int NPY_NUMUSERTYPES;
NPY_NO_EXPORT PyTypeObject PyBigArray_Type;
NPY_NO_EXPORT PyTypeObject PyArray_Type;
NPY_NO_EXPORT PyTypeObject PyArrayDescr_Type;
NPY_NO_EXPORT PyTypeObject PyArrayFlags_Type;
NPY_NO_EXPORT PyTypeObject PyArrayIter_Type;
NPY_NO_EXPORT PyTypeObject PyArrayMapIter_Type;
NPY_NO_EXPORT PyTypeObject PyArrayMultiIter_Type;
NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type;
NPY_NO_EXPORT PyTypeObject PyBoolArrType_Type;
NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2];
#endif
%s
#else
#if defined(PY_ARRAY_UNIQUE_SYMBOL)
#define PyArray_API PY_ARRAY_UNIQUE_SYMBOL
#endif
#if defined(NO_IMPORT) || defined(NO_IMPORT_ARRAY)
extern void **PyArray_API;
#else
#if defined(PY_ARRAY_UNIQUE_SYMBOL)
void **PyArray_API;
#else
static void **PyArray_API=NULL;
#endif
#endif
#define PyArray_GetNDArrayCVersion (*(unsigned int (*)(void)) PyArray_API[0])
#define PyBigArray_Type (*(PyTypeObject *)PyArray_API[1])
#define PyArray_Type (*(PyTypeObject *)PyArray_API[2])
#define PyArrayDescr_Type (*(PyTypeObject *)PyArray_API[3])
#define PyArrayFlags_Type (*(PyTypeObject *)PyArray_API[4])
#define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[5])
#define PyArrayMultiIter_Type (*(PyTypeObject *)PyArray_API[6])
#define NPY_NUMUSERTYPES (*(int *)PyArray_API[7])
#define PyBoolArrType_Type (*(PyTypeObject *)PyArray_API[8])
#define _PyArrayScalar_BoolValues ((PyBoolScalarObject *)PyArray_API[9])
%s
#if !defined(NO_IMPORT_ARRAY) && !defined(NO_IMPORT)
static int
_import_array(void)
{
int st;
PyObject *numpy = PyImport_ImportModule("numpy.core.multiarray");
PyObject *c_api = NULL;
if (numpy == NULL) return -1;
c_api = PyObject_GetAttrString(numpy, "_ARRAY_API");
if (c_api == NULL) {Py_DECREF(numpy); return -1;}
if (PyCObject_Check(c_api)) {
PyArray_API = (void **)PyCObject_AsVoidPtr(c_api);
}
Py_DECREF(c_api);
Py_DECREF(numpy);
if (PyArray_API == NULL) return -1;
/* Perform runtime check of C API version */
if (NPY_VERSION != PyArray_GetNDArrayCVersion()) {
PyErr_Format(PyExc_RuntimeError, "module compiled against "\
"ABI version %%x but this version of numpy is %%x", \
(int) NPY_VERSION, (int) PyArray_GetNDArrayCVersion());
return -1;
}
if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) {
PyErr_Format(PyExc_RuntimeError, "module compiled against "\
"API version %%x but this version of numpy is %%x", \
(int) NPY_FEATURE_VERSION, (int) PyArray_GetNDArrayCFeatureVersion());
return -1;
}
/*
* Perform runtime check of endianness and check it matches the one set by
* the headers (npy_endian.h) as a safeguard
*/
st = PyArray_GetEndianness();
if (st == NPY_CPU_UNKNOWN_ENDIAN) {
PyErr_Format(PyExc_RuntimeError, "FATAL: module compiled as unknown endian");
return -1;
}
#if NPY_BYTE_ORDER ==NPY_BIG_ENDIAN
if (st != NPY_CPU_BIG) {
PyErr_Format(PyExc_RuntimeError, "FATAL: module compiled as "\
"big endian, but detected different endianness at runtime");
return -1;
}
#elif NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN
if (st != NPY_CPU_LITTLE) {
PyErr_Format(PyExc_RuntimeError, "FATAL: module compiled as "\
"little endian, but detected different endianness at runtime");
return -1;
}
#endif
return 0;
}
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return; } }
#define import_array1(ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ret; } }
#define import_array2(msg, ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, msg); return ret; } }
#endif
#endif
"""
c_template = r"""
/* These pointers will be stored in the C-object for use in other
extension modules
*/
void *PyArray_API[] = {
(void *) PyArray_GetNDArrayCVersion,
(void *) &PyBigArray_Type,
(void *) &PyArray_Type,
(void *) &PyArrayDescr_Type,
(void *) &PyArrayFlags_Type,
(void *) &PyArrayIter_Type,
(void *) &PyArrayMultiIter_Type,
(int *) &NPY_NUMUSERTYPES,
(void *) &PyBoolArrType_Type,
(void *) &_PyArrayScalar_BoolValues,
%s
};
"""
c_api_header = """
===========
Numpy C-API
===========
"""
def generate_api(output_dir, force=False):
basename = 'multiarray_api'
h_file = os.path.join(output_dir, '__%s.h' % basename)
c_file = os.path.join(output_dir, '__%s.c' % basename)
d_file = os.path.join(output_dir, '%s.txt' % basename)
targets = (h_file, c_file, d_file)
sources = ['numpy_api_order.txt']
if (not force and not genapi.should_rebuild(targets, sources + [__file__])):
return targets
else:
do_generate_api(targets, sources)
return targets
def do_generate_api(targets, sources):
header_file = targets[0]
c_file = targets[1]
doc_file = targets[2]
numpyapi_list = genapi.get_api_functions('NUMPY_API', sources[0])
# API fixes for __arrayobject_api.h
fixed = 10
numtypes = len(types) + fixed
module_list = []
extension_list = []
init_list = []
# setup types
for k, atype in enumerate(types):
num = fixed + k
astr = " (void *) &Py%sArrType_Type," % types[k]
init_list.append(astr)
astr = """\
#ifdef NPY_ENABLE_SEPARATE_COMPILATION
extern NPY_NO_EXPORT PyTypeObject Py%(type)sArrType_Type;
#else
NPY_NO_EXPORT PyTypeObject Py%(type)sArrType_Type;
#endif
""" % {'type': types[k]}
module_list.append(astr)
astr = "#define Py%sArrType_Type (*(PyTypeObject *)PyArray_API[%d])" % \
(types[k], num)
extension_list.append(astr)
# set up object API
genapi.add_api_list(numtypes, 'PyArray_API', numpyapi_list,
module_list, extension_list, init_list)
# Write to header
fid = open(header_file, 'w')
s = h_template % ('\n'.join(module_list), '\n'.join(extension_list))
fid.write(s)
fid.close()
# Write to c-code
fid = open(c_file, 'w')
s = c_template % '\n'.join(init_list)
fid.write(s)
fid.close()
# write to documentation
fid = open(doc_file, 'w')
fid.write(c_api_header)
for func in numpyapi_list:
fid.write(func.to_ReST())
fid.write('\n\n')
fid.close()
return targets
| StarcoderdataPython |
187918 | <reponame>open-contracting/kingfisher-collect<filename>kingfisher_scrapy/spiders/mexico_inai_base.py
import scrapy
from kingfisher_scrapy.base_spider import SimpleSpider
from kingfisher_scrapy.util import components, handle_http_error, join
class MexicoINAIBase(SimpleSpider):
"""
This class makes it easy to collect data from an API that implements the `Mexico INAI Contrataciones Abiertas
platform <https://github.com/datosabiertosmx/contrataciones-abiertas-infraestructura>`__:
#. Inherit from ``MexicoINAIBase``
#. Set a ``base_url`` class attribute with the portal's domain
#. Set a ``default_from_date`` class attribute with the initial year to scrape when a ``until_date`` argument is
set
.. code-block:: python
from kingfisher_scrapy.spiders.mexico_inai_base import MexicoINAIBase
class MySpider(MexicoINAIBase):
name = 'my_spider'
# BaseSpider
default_from_date = '2020'
# MexicoINAIBase
base_url = 'http://base-url'
"""
# BaseSpider
root_path = 'arrayReleasePackage.item'
date_format = 'year'
# SimpleSpider
data_type = 'release_package'
def start_requests(self):
yield scrapy.Request(f'{self.base_url}/edca/fiscalYears', meta={'file_name': 'list.json'},
callback=self.parse_list)
@handle_http_error
def parse_list(self, response):
fiscal_years = response.json()['fiscalYears']
# The response looks like:
# {
# "fiscalYears": [
# {
# "id": "..",
# "year": "..",
# "status": "..",
# "createdAt": "..",
# "updatedAt": "..",
# }
# ]
# }
for fiscal_year_object in fiscal_years:
fiscal_year = fiscal_year_object['year']
if self.from_date and self.until_date:
if not (self.from_date.year <= fiscal_year <= self.until_date.year):
continue
yield self.build_request(f'{self.base_url}/edca/contractingprocess/{fiscal_year}',
formatter=join(components(-1)))
| StarcoderdataPython |
81585 | from met_brewer.palettes import (
MET_PALETTES, COLORBLIND_PALETTES_NAMES, COLORBLIND_PALETTES,
met_brew, export, is_colorblind_friendly
)
MET_PALETTES
COLORBLIND_PALETTES_NAMES
COLORBLIND_PALETTES
met_brew
export
is_colorblind_friendly
| StarcoderdataPython |
1650023 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# _ooOoo_
# o8888888o
# 88" . "88
# (| -_- |)
# O\ = /O
# ___/`---'\____
# . ' \\| |// `.
# / \\||| : |||// \
# / _||||| -:- |||||- \
# | | \\\ - /// | |
# | \_| ''\---/'' | |
# \ .-\__ `-` ___/-. /
# ___`. .' /--.--\ `. . __
# ."" '< `.___\_<|>_/___.' >'"".
# | | : `- \`.;`\ _ /`;.`/ - ` : | |
# \ \ `-. \_ __\ /__ _/ .-` / /
# ======`-.____`-.___\_____/___.-`____.-'======
# `=---='
# .............................................
# 佛曰:bug泛滥,我已瘫痪!
#
'多线程变量优化,单个线程只是用当前线程的变量'
'一个ThreadLocal变量虽然是全局变量,但每个线程都只能读写自己线程的独立副本' \
',互不干扰。ThreadLocal解决了参数在一个线程中各个函数之间互相传递的问题。'
__author__ = 'click'
__date__ = '2018/7/24 下午5:44'
import threading
threadLocal = threading.local()
class Student(object):
def __init__(self, name):
self.__name = name
def __str__(self):
return 'Student的属性__name的值是 %s' % (self.__name)
# 直接使用str会打印出该对象的内存地址,不能打印出上述格式化的内容,必须调用__repr__代替__str__
__repr__ = __str__
def addStudent():
student = threadLocal.studentName
print('当前线程是%1s,该线程是用的变量student值是%2s' % (threading.current_thread().name, student.__repr__))
def addStudentThread(name):
threadLocal.studentName = Student(name)
addStudent()
print('----------使用了threadlocal-------------')
thread1 = threading.Thread(target=addStudentThread, args=('Jack',))
thread2 = threading.Thread(target=addStudentThread, args=('Tom',))
thread1.start()
thread2.start()
thread2.join()
thread1.join()
print('----------使用了dict-------------------')
global_dict = {}
def addStd(name):
std = Student(name)
global_dict[threading.current_thread()] = std
task1()
def task1():
print('当前线程是%1s,该线程使用的变量是%2s' % (threading.current_thread().name
, global_dict[threading.current_thread()].__repr__))
dicThread1 = threading.Thread(target=addStd, args=('dictTom',))
dicThread2 = threading.Thread(target=addStd, args=('dictJack',))
dicThread1.start()
dicThread2.start()
dicThread1.join()
dicThread2.join()
| StarcoderdataPython |
3297279 | # coding: utf-8
from __future__ import unicode_literals, absolute_import
from . import Rule | StarcoderdataPython |
1624738 | from distutils.core import setup, Extension
setup(
name = 'rpi_hcsr04',
version = '0.1.0',
description = 'Control module hc-sr04 which connected to raspberry pi GPIO.',
author = 'aozk',
author_email = '<EMAIL>',
url = 'https://github.com/aozk/rpi_hcsr04',
ext_modules = [Extension('rpi_hcsr04', ['hcsr04/hcsr04.c'])],
classifiers = [
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Topic :: Software Development',
'Topic :: System :: Hardware',
'Programming Language :: Python :: 3',
'Programming Language :: C',
'Natural Language :: Japanese',
],
)
| StarcoderdataPython |
1719547 | # coding: utf-8
from __future__ import absolute_import
from flask import json
from six import BytesIO
from swagger_server.models.model_class import ModelClass # noqa: E501
from swagger_server.test import BaseTestCase
class TestClassController(BaseTestCase):
"""ClassController integration test stubs"""
def test_add_class(self):
"""Test case for add_class
Add a class to the classdeck
"""
body = ModelClass()
response = self.client.open(
'/pablokvitca/classdeck-api/1.0.0/class/filtered',
method='GET',
data=json.dumps(body),
content_type='application/json')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_get_class_by_id(self):
"""Test case for get_class_by_id
Find class by ID
"""
response = self.client.open(
'/pablokvitca/classdeck-api/1.0.0/class/{class_department}/{class_number}'.format(class_department='class_department_example', class_number=9999),
method='GET')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_list_classes(self):
"""Test case for list_classes
List all classes
"""
response = self.client.open(
'/pablokvitca/classdeck-api/1.0.0/class',
method='GET')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
if __name__ == '__main__':
import unittest
unittest.main()
| StarcoderdataPython |
1736834 | <gh_stars>0
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Tests for getuipy.google.protobuf.internal.service_reflection."""
__author__ = '<EMAIL> (<NAME>)'
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
from getuipy.google.protobuf import unittest_pb2
from getuipy.google.protobuf import service_reflection
from getuipy.google.protobuf import service
class FooUnitTest(unittest.TestCase):
def testService(self):
class MockRpcChannel(service.RpcChannel):
def CallMethod(self, method, controller, request, response, callback):
self.method = method
self.controller = controller
self.request = request
callback(response)
class MockRpcController(service.RpcController):
def SetFailed(self, msg):
self.failure_message = msg
self.callback_response = None
class MyService(unittest_pb2.TestService):
pass
self.callback_response = None
def MyCallback(response):
self.callback_response = response
rpc_controller = MockRpcController()
channel = MockRpcChannel()
srvc = MyService()
srvc.Foo(rpc_controller, unittest_pb2.FooRequest(), MyCallback)
self.assertEqual('Method Foo not implemented.',
rpc_controller.failure_message)
self.assertEqual(None, self.callback_response)
rpc_controller.failure_message = None
service_descriptor = unittest_pb2.TestService.GetDescriptor()
srvc.CallMethod(service_descriptor.methods[1], rpc_controller,
unittest_pb2.BarRequest(), MyCallback)
self.assertTrue(srvc.GetRequestClass(service_descriptor.methods[1]) is
unittest_pb2.BarRequest)
self.assertTrue(srvc.GetResponseClass(service_descriptor.methods[1]) is
unittest_pb2.BarResponse)
self.assertEqual('Method Bar not implemented.',
rpc_controller.failure_message)
self.assertEqual(None, self.callback_response)
class MyServiceImpl(unittest_pb2.TestService):
def Foo(self, rpc_controller, request, done):
self.foo_called = True
def Bar(self, rpc_controller, request, done):
self.bar_called = True
srvc = MyServiceImpl()
rpc_controller.failure_message = None
srvc.Foo(rpc_controller, unittest_pb2.FooRequest(), MyCallback)
self.assertEqual(None, rpc_controller.failure_message)
self.assertEqual(True, srvc.foo_called)
rpc_controller.failure_message = None
srvc.CallMethod(service_descriptor.methods[1], rpc_controller,
unittest_pb2.BarRequest(), MyCallback)
self.assertEqual(None, rpc_controller.failure_message)
self.assertEqual(True, srvc.bar_called)
def testServiceStub(self):
class MockRpcChannel(service.RpcChannel):
def CallMethod(self, method, controller, request,
response_class, callback):
self.method = method
self.controller = controller
self.request = request
callback(response_class())
self.callback_response = None
def MyCallback(response):
self.callback_response = response
channel = MockRpcChannel()
stub = unittest_pb2.TestService_Stub(channel)
rpc_controller = 'controller'
request = 'request'
# GetDescriptor now static, still works as instance method for compatibility
self.assertEqual(unittest_pb2.TestService_Stub.GetDescriptor(),
stub.GetDescriptor())
# Invoke method.
stub.Foo(rpc_controller, request, MyCallback)
self.assertIsInstance(self.callback_response, unittest_pb2.FooResponse)
self.assertEqual(request, channel.request)
self.assertEqual(rpc_controller, channel.controller)
self.assertEqual(stub.GetDescriptor().methods[0], channel.method)
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
1699831 | <reponame>ouyang-w-19/decogo
# NLP written by GAMS Convert at 04/21/18 13:51:01
#
# Equation counts
# Total E G L N X C B
# 1497 1497 0 0 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc si
# Total cont binary integer sos1 sos2 scont sint
# 2094 2094 0 0 0 0 0 0
# FX 113 113 0 0 0 0 0 0
#
# Nonzero counts
# Total const NL DLL
# 6306 2465 3841 0
#
# Reformulation has removed 1 variable and 1 equation
from pyomo.environ import *
model = m = ConcreteModel()
m.x2 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x3 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x4 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x5 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x6 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x7 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x8 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x9 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x10 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x11 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x12 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x13 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x14 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x15 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x16 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x17 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x18 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x19 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x20 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x21 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x22 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x23 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x24 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x25 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x26 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x27 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x28 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x29 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x30 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x31 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x32 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x33 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x34 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x35 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x36 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x37 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x38 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x39 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x40 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x41 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x42 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x43 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x44 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x45 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x46 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x47 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x48 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x49 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x50 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x51 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x52 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x53 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x54 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x55 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x56 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x57 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x58 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x59 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x60 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x61 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x62 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x63 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x64 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x65 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x66 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x67 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x68 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x69 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x70 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x71 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x72 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x73 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x74 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x75 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x76 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x77 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x78 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x79 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x80 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x81 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x82 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x83 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x84 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x85 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x86 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x87 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x88 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x89 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x90 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x91 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x92 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x93 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x94 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x95 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x96 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x97 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x98 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x99 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x100 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x101 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x102 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x103 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x104 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x105 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x106 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x107 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x108 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x109 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x110 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x111 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x112 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x113 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x114 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x115 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x116 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x117 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x118 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x119 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x120 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x121 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x122 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x123 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x124 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x125 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x126 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x127 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x128 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x129 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x130 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x131 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x132 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x133 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x134 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x135 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x136 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x137 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x138 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x139 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x140 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x141 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x142 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x143 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x144 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x145 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x146 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x147 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x148 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x149 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x150 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x151 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x152 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x153 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x154 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x155 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x156 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x157 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x158 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x159 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x160 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x161 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x162 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x163 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x164 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x165 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x166 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x167 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x168 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x169 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x170 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x171 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x172 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x173 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x174 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x175 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x176 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x177 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x178 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x179 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x180 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x181 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x182 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x183 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x184 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x185 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x186 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x187 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x188 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x189 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x190 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x191 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x192 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x193 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x194 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x195 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x196 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x197 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x198 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x199 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x200 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x201 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x202 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x203 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x204 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x205 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x206 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x207 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x208 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x209 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x210 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x211 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x212 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x213 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x214 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x215 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x216 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x217 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x218 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x219 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x220 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x221 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x222 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x223 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x224 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x225 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x226 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x227 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x228 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x229 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x230 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x231 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x232 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x233 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x234 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x235 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x236 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x237 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x238 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x239 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x240 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x241 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x242 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x243 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x244 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x245 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x246 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x247 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x248 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x249 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x250 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x251 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x252 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x253 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x254 = Var(within=Reals,bounds=(-10,1000),initialize=1)
m.x255 = Var(within=Reals,bounds=(0.02165,0.02165),initialize=0.02165)
m.x256 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x257 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x258 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x259 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x260 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x261 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x262 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x263 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x264 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x265 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x266 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x267 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x268 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x269 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x270 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x271 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x272 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x273 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x274 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x275 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x276 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x277 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x278 = Var(within=Reals,bounds=(0.03157,0.03157),initialize=0.03157)
m.x279 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x280 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x281 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x282 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x283 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x284 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x285 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x286 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x287 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x288 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x289 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x290 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x291 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x292 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x293 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x294 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x295 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x296 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x297 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x298 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x299 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x300 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x301 = Var(within=Reals,bounds=(0.02161,0.02161),initialize=0.02161)
m.x302 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x303 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x304 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x305 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x306 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x307 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x308 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x309 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x310 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x311 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x312 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x313 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x314 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x315 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x316 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x317 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x318 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x319 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x320 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x321 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x322 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x323 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x324 = Var(within=Reals,bounds=(0.05416,0.05416),initialize=0.05416)
m.x325 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x326 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x327 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x328 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x329 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x330 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x331 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x332 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x333 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x334 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x335 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x336 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x337 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x338 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x339 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x340 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x341 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x342 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x343 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x344 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x345 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x346 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x347 = Var(within=Reals,bounds=(0.08593,0.08593),initialize=0.08593)
m.x348 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x349 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x350 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x351 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x352 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x353 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x354 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x355 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x356 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x357 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x358 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x359 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x360 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x361 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x362 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x363 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x364 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x365 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x366 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x367 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x368 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x369 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x370 = Var(within=Reals,bounds=(0.04412,0.04412),initialize=0.04412)
m.x371 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x372 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x373 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x374 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x375 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x376 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x377 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x378 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x379 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x380 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x381 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x382 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x383 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x384 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x385 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x386 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x387 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x388 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x389 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x390 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x391 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x392 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x393 = Var(within=Reals,bounds=(0.49749,0.49749),initialize=0.49749)
m.x394 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x395 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x396 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x397 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x398 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x399 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x400 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x401 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x402 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x403 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x404 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x405 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x406 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x407 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x408 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x409 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x410 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x411 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x412 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x413 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x414 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x415 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x416 = Var(within=Reals,bounds=(0.2296,0.2296),initialize=0.2296)
m.x417 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x418 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x419 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x420 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x421 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x422 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x423 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x424 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x425 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x426 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x427 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x428 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x429 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x430 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x431 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x432 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x433 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x434 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x435 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x436 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x437 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x438 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x439 = Var(within=Reals,bounds=(0.04592,0.04592),initialize=0.04592)
m.x440 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x441 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x442 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x443 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x444 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x445 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x446 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x447 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x448 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x449 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x450 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x451 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x452 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x453 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x454 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x455 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x456 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x457 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x458 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x459 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x460 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x461 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x462 = Var(within=Reals,bounds=(0.02941,0.02941),initialize=0.02941)
m.x463 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x464 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x465 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x466 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x467 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x468 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x469 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x470 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x471 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x472 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x473 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x474 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x475 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x476 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x477 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x478 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x479 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x480 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x481 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x482 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x483 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x484 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x485 = Var(within=Reals,bounds=(0.55161,0.55161),initialize=0.55161)
m.x486 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x487 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x488 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x489 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x490 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x491 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x492 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x493 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x494 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x495 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x496 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x497 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x498 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x499 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x500 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x501 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x502 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x503 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x504 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x505 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x506 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x507 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x508 = Var(within=Reals,bounds=(0.002165,0.002165),initialize=0.002165)
m.x509 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x510 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x511 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x512 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x513 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x514 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x515 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x516 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x517 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x518 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x519 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x520 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x521 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x522 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x523 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x524 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x525 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x526 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x527 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x528 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x529 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x530 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x531 = Var(within=Reals,bounds=(0.003157,0.003157),initialize=0.003157)
m.x532 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x533 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x534 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x535 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x536 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x537 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x538 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x539 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x540 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x541 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x542 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x543 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x544 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x545 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x546 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x547 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x548 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x549 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x550 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x551 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x552 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x553 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x554 = Var(within=Reals,bounds=(0.002161,0.002161),initialize=0.002161)
m.x555 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x556 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x557 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x558 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x559 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x560 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x561 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x562 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x563 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x564 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x565 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x566 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x567 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x568 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x569 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x570 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x571 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x572 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x573 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x574 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x575 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x576 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x577 = Var(within=Reals,bounds=(0.005416,0.005416),initialize=0.005416)
m.x578 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x579 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x580 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x581 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x582 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x583 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x584 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x585 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x586 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x587 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x588 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x589 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x590 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x591 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x592 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x593 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x594 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x595 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x596 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x597 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x598 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x599 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x600 = Var(within=Reals,bounds=(0.008593,0.008593),initialize=0.008593)
m.x601 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x602 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x603 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x604 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x605 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x606 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x607 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x608 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x609 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x610 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x611 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x612 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x613 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x614 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x615 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x616 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x617 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x618 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x619 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x620 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x621 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x622 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x623 = Var(within=Reals,bounds=(0.004412,0.004412),initialize=0.004412)
m.x624 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x625 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x626 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x627 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x628 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x629 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x630 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x631 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x632 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x633 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x634 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x635 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x636 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x637 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x638 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x639 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x640 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x641 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x642 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x643 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x644 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x645 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x646 = Var(within=Reals,bounds=(0.049749,0.049749),initialize=0.049749)
m.x647 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x648 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x649 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x650 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x651 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x652 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x653 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x654 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x655 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x656 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x657 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x658 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x659 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x660 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x661 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x662 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x663 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x664 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x665 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x666 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x667 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x668 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x669 = Var(within=Reals,bounds=(0.02296,0.02296),initialize=0.02296)
m.x670 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x671 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x672 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x673 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x674 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x675 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x676 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x677 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x678 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x679 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x680 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x681 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x682 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x683 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x684 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x685 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x686 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x687 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x688 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x689 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x690 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x691 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x692 = Var(within=Reals,bounds=(0.004592,0.004592),initialize=0.004592)
m.x693 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x694 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x695 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x696 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x697 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x698 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x699 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x700 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x701 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x702 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x703 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x704 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x705 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x706 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x707 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x708 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x709 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x710 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x711 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x712 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x713 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x714 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x715 = Var(within=Reals,bounds=(0.002941,0.002941),initialize=0.002941)
m.x716 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x717 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x718 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x719 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x720 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x721 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x722 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x723 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x724 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x725 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x726 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x727 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x728 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x729 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x730 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x731 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x732 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x733 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x734 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x735 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x736 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x737 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x738 = Var(within=Reals,bounds=(0.055161,0.055161),initialize=0.055161)
m.x739 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x740 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x741 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x742 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x743 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x744 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x745 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x746 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x747 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x748 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x749 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x750 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x751 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x752 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x753 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x754 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x755 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x756 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x757 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x758 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x759 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x760 = Var(within=Reals,bounds=(0.0001,500),initialize=1)
m.x761 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x762 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x763 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x764 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x765 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x766 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x767 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x768 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x769 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x770 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x771 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x772 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x773 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x774 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x775 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x776 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x777 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x778 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x779 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x780 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x781 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x782 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x783 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x784 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x785 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x786 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x787 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x788 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x789 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x790 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x791 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x792 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x793 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x794 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x795 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x796 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x797 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x798 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x799 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x800 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x801 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x802 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x803 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x804 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x805 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x806 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x807 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x808 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x809 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x810 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x811 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x812 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x813 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x814 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x815 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x816 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x817 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x818 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x819 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x820 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x821 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x822 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x823 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x824 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x825 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x826 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x827 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x828 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x829 = Var(within=Reals,bounds=(1,1),initialize=1)
m.x830 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x831 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x832 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x833 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x834 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x835 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x836 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x837 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x838 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x839 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x840 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x841 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x842 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x843 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x844 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x845 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x846 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x847 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x848 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x849 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x850 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x851 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x852 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x853 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x854 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x855 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x856 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x857 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x858 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x859 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x860 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x861 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x862 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x863 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x864 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x865 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x866 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x867 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x868 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x869 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x870 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x871 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x872 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x873 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x874 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x875 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x876 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x877 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x878 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x879 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x880 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x881 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x882 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x883 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x884 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x885 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x886 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x887 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x888 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x889 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x890 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x891 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x892 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x893 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x894 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x895 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x896 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x897 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x898 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x899 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x900 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x901 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x902 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x903 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x904 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x905 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x906 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x907 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x908 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x909 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x910 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x911 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x912 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x913 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x914 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x915 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x916 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x917 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x918 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x919 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x920 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x921 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x922 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x923 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x924 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x925 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x926 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x927 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x928 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x929 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x930 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x931 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x932 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x933 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x934 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x935 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x936 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x937 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x938 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x939 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x940 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x941 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x942 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x943 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x944 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x945 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x946 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x947 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x948 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x949 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x950 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x951 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x952 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x953 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x954 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x955 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x956 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x957 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x958 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x959 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x960 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x961 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x962 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x963 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x964 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x965 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x966 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x967 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x968 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x969 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x970 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x971 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x972 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x973 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x974 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x975 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x976 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x977 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x978 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x979 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x980 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x981 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x982 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x983 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x984 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x985 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x986 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x987 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x988 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x989 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x990 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x991 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x992 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x993 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x994 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x995 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x996 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x997 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x998 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x999 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1000 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1001 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1002 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1003 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1004 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1005 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1006 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1007 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1008 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1009 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1010 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1011 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1012 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1013 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1014 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1015 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1016 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1017 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1018 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1019 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1020 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1021 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1022 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1023 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1024 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1025 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1026 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1027 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1028 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1029 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1030 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1031 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1032 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1033 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1034 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1035 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1036 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1037 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1038 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1039 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1040 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1041 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1042 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1043 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1044 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1045 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1046 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1047 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1048 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1049 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1050 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1051 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1052 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1053 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1054 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1055 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1056 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1057 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1058 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1059 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1060 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1061 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1062 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1063 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1064 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1065 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1066 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1067 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1068 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1069 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1070 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1071 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1072 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1073 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1074 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1075 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1076 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1077 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1078 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1079 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1080 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1081 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1082 = Var(within=Reals,bounds=(0.01,500),initialize=20)
m.x1083 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1084 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1085 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1086 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1087 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1088 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1089 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1090 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1091 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1092 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1093 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1094 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1095 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1096 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1097 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1098 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1099 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1100 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1101 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1102 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1103 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1104 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1105 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1106 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1107 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1108 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1109 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1110 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1111 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1112 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1113 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1114 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1115 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1116 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1117 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1118 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1119 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1120 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1121 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1122 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1123 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1124 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1125 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1126 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1127 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1128 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1129 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1130 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1131 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1132 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1133 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1134 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1135 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1136 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1137 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1138 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1139 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1140 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1141 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1142 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1143 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1144 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1145 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1146 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1147 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1148 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1149 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1150 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1151 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1152 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1153 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1154 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1155 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1156 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1157 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1158 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1159 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1160 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1161 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1162 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1163 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1164 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1165 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1166 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1167 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1168 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1169 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1170 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1171 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1172 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1173 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1174 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1175 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1176 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1177 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1178 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1179 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1180 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1181 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1182 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1183 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1184 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1185 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1186 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1187 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1188 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1189 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1190 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1191 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1192 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1193 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1194 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1195 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1196 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1197 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1198 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1199 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1200 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1201 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1202 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1203 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1204 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1205 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1206 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1207 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1208 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1209 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1210 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1211 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1212 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1213 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1214 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1215 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1216 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1217 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1218 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1219 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1220 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1221 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1222 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1223 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1224 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1225 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1226 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1227 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1228 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1229 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1230 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1231 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1232 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1233 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1234 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1235 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1236 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1237 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1238 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1239 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1240 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1241 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1242 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1243 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1244 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1245 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1246 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1247 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1248 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1249 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1250 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1251 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1252 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1253 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1254 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1255 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1256 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1257 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1258 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1259 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1260 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1261 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1262 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1263 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1264 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1265 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1266 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1267 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1268 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1269 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1270 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1271 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1272 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1273 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1274 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1275 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1276 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1277 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1278 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1279 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1280 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1281 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1282 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1283 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1284 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1285 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1286 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1287 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1288 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1289 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1290 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1291 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1292 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1293 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1294 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1295 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1296 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1297 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1298 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1299 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1300 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1301 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1302 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1303 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1304 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1305 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1306 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1307 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1308 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1309 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1310 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1311 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1312 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1313 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1314 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1315 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1316 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1317 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1318 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1319 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1320 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1321 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1322 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1323 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1324 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1325 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1326 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1327 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1328 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1329 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1330 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1331 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1332 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1333 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1334 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1335 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1336 = Var(within=Reals,bounds=(0.0053,0.0053),initialize=0.0053)
m.x1337 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1338 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1339 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1340 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1341 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1342 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1343 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1344 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1345 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1346 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1347 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1348 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1349 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1350 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1351 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1352 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1353 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1354 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1355 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1356 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1357 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1358 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1359 = Var(within=Reals,bounds=(0.00948,0.00948),initialize=0.00948)
m.x1360 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1361 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1362 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1363 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1364 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1365 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1366 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1367 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1368 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1369 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1370 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1371 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1372 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1373 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1374 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1375 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1376 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1377 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1378 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1379 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1380 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1381 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1382 = Var(within=Reals,bounds=(0.00592,0.00592),initialize=0.00592)
m.x1383 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1384 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1385 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1386 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1387 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1388 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1389 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1390 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1391 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1392 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1393 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1394 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1395 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1396 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1397 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1398 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1399 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1400 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1401 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1402 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1403 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1404 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1405 = Var(within=Reals,bounds=(0.0157,0.0157),initialize=0.0157)
m.x1406 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1407 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1408 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1409 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1410 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1411 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1412 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1413 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1414 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1415 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1416 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1417 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1418 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1419 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1420 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1421 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1422 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1423 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1424 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1425 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1426 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1427 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1428 = Var(within=Reals,bounds=(0.0217,0.0217),initialize=0.0217)
m.x1429 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1430 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1431 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1432 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1433 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1434 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1435 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1436 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1437 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1438 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1439 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1440 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1441 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1442 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1443 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1444 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1445 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1446 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1447 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1448 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1449 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1450 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1451 = Var(within=Reals,bounds=(0.01146,0.01146),initialize=0.01146)
m.x1452 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1453 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1454 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1455 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1456 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1457 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1458 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1459 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1460 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1461 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1462 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1463 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1464 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1465 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1466 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1467 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1468 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1469 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1470 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1471 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1472 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1473 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1474 = Var(within=Reals,bounds=(0.12134,0.12134),initialize=0.12134)
m.x1475 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1476 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1477 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1478 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1479 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1480 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1481 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1482 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1483 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1484 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1485 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1486 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1487 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1488 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1489 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1490 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1491 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1492 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1493 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1494 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1495 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1496 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1497 = Var(within=Reals,bounds=(0.0656,0.0656),initialize=0.0656)
m.x1498 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1499 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1500 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1501 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1502 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1503 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1504 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1505 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1506 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1507 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1508 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1509 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1510 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1511 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1512 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1513 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1514 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1515 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1516 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1517 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1518 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1519 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1520 = Var(within=Reals,bounds=(0.01312,0.01312),initialize=0.01312)
m.x1521 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1522 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1523 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1524 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1525 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1526 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1527 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1528 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1529 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1530 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1531 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1532 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1533 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1534 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1535 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1536 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1537 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1538 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1539 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1540 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1541 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1542 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1543 = Var(within=Reals,bounds=(0.00754,0.00754),initialize=0.00754)
m.x1544 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1545 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1546 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1547 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1548 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1549 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1550 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1551 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1552 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1553 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1554 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1555 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1556 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1557 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1558 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1559 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1560 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1561 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1562 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1563 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1564 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1565 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1566 = Var(within=Reals,bounds=(0.14018,0.14018),initialize=0.14018)
m.x1567 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1568 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1569 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1570 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1571 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1572 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1573 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1574 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1575 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1576 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1577 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1578 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1579 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1580 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1581 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1582 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1583 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1584 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1585 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1586 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1587 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1588 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1589 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1590 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1591 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1592 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1593 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1594 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1595 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1596 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1597 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1598 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1599 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1600 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1601 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1602 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1603 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1604 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1605 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1606 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1607 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1608 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1609 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1610 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1611 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1612 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1613 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1614 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1615 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1616 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1617 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1618 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1619 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1620 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1621 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1622 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1623 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1624 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1625 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1626 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1627 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1628 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1629 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1630 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1631 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1632 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1633 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1634 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1635 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1636 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1637 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1638 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1639 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1640 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1641 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1642 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1643 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1644 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1645 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1646 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1647 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1648 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1649 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1650 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1651 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1652 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1653 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1654 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1655 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1656 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1657 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1658 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1659 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1660 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1661 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1662 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1663 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1664 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1665 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1666 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1667 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1668 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1669 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1670 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1671 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1672 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1673 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1674 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1675 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1676 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1677 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1678 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1679 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1680 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1681 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1682 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1683 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1684 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1685 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1686 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1687 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1688 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1689 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1690 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1691 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1692 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1693 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1694 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1695 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1696 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1697 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1698 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1699 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1700 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1701 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1702 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1703 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1704 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1705 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1706 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1707 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1708 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1709 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1710 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1711 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1712 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1713 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1714 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1715 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1716 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1717 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1718 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1719 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1720 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1721 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1722 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1723 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1724 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1725 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1726 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1727 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1728 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1729 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1730 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1731 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1732 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1733 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1734 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1735 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1736 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1737 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1738 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1739 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1740 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1741 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1742 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1743 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1744 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1745 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1746 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1747 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1748 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1749 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1750 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1751 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1752 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1753 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1754 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1755 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1756 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1757 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1758 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1759 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1760 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1761 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1762 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1763 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1764 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1765 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1766 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1767 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1768 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1769 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1770 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1771 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1772 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1773 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1774 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1775 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1776 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1777 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1778 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1779 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1780 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1781 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1782 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1783 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1784 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1785 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1786 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1787 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1788 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1789 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1790 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1791 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1792 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1793 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1794 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1795 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1796 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1797 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1798 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1799 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1800 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1801 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1802 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1803 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1804 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1805 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1806 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1807 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1808 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1809 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1810 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1811 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1812 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1813 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1814 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1815 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1816 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1817 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1818 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1819 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1820 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1821 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1822 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1823 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1824 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1825 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1826 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1827 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1828 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1829 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1830 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1831 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1832 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1833 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1834 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1835 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1836 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1837 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1838 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1839 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1840 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1841 = Var(within=Reals,bounds=(0.01,100),initialize=1)
m.x1842 = Var(within=Reals,bounds=(0.053,0.053),initialize=0.053)
m.x1843 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1844 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1845 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1846 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1847 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1848 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1849 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1850 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1851 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1852 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1853 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1854 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1855 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1856 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1857 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1858 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1859 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1860 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1861 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1862 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1863 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1864 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1865 = Var(within=Reals,bounds=(0.0948,0.0948),initialize=0.0948)
m.x1866 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1867 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1868 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1869 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1870 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1871 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1872 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1873 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1874 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1875 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1876 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1877 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1878 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1879 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1880 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1881 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1882 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1883 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1884 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1885 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1886 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1887 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1888 = Var(within=Reals,bounds=(0.0592,0.0592),initialize=0.0592)
m.x1889 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1890 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1891 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1892 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1893 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1894 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1895 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1896 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1897 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1898 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1899 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1900 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1901 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1902 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1903 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1904 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1905 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1906 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1907 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1908 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1909 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1910 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1911 = Var(within=Reals,bounds=(0.157,0.157),initialize=0.157)
m.x1912 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1913 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1914 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1915 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1916 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1917 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1918 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1919 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1920 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1921 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1922 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1923 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1924 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1925 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1926 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1927 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1928 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1929 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1930 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1931 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1932 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1933 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1934 = Var(within=Reals,bounds=(0.217,0.217),initialize=0.217)
m.x1935 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1936 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1937 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1938 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1939 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1940 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1941 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1942 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1943 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1944 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1945 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1946 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1947 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1948 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1949 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1950 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1951 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1952 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1953 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1954 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1955 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1956 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1957 = Var(within=Reals,bounds=(0.1146,0.1146),initialize=0.1146)
m.x1958 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1959 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1960 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1961 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1962 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1963 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1964 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1965 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1966 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1967 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1968 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1969 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1970 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1971 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1972 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1973 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1974 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1975 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1976 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1977 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1978 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1979 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1980 = Var(within=Reals,bounds=(1.2134,1.2134),initialize=1.2134)
m.x1981 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1982 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1983 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1984 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1985 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1986 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1987 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1988 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1989 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1990 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1991 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1992 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1993 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1994 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1995 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1996 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1997 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1998 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x1999 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2000 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2001 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2002 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2003 = Var(within=Reals,bounds=(0.656,0.656),initialize=0.656)
m.x2004 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2005 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2006 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2007 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2008 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2009 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2010 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2011 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2012 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2013 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2014 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2015 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2016 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2017 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2018 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2019 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2020 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2021 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2022 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2023 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2024 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2025 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2026 = Var(within=Reals,bounds=(0.1312,0.1312),initialize=0.1312)
m.x2027 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2028 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2029 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2030 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2031 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2032 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2033 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2034 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2035 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2036 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2037 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2038 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2039 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2040 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2041 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2042 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2043 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2044 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2045 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2046 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2047 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2048 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2049 = Var(within=Reals,bounds=(0.0754,0.0754),initialize=0.0754)
m.x2050 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2051 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2052 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2053 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2054 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2055 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2056 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2057 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2058 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2059 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2060 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2061 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2062 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2063 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2064 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2065 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2066 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2067 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2068 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2069 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2070 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2071 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2072 = Var(within=Reals,bounds=(1.4018,1.4018),initialize=1.4018)
m.x2073 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2074 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2075 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2076 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2077 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2078 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2079 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2080 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2081 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2082 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2083 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2084 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2085 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2086 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2087 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2088 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2089 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2090 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2091 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2092 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2093 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.x2094 = Var(within=Reals,bounds=(0.001,5000),initialize=1)
m.obj = Objective(expr= - m.x2 - 0.862608784384164*m.x3 - 0.744093914896725*m.x4 - 0.641861947396717*m.x5
- 0.553675754186335*m.x6 - 0.477605569261659*m.x7 - 0.411986759515906*m.x8
- 0.355383397808387*m.x9 - 0.306556840773806*m.x10 - 0.264438623764543*m.x11
- 0.228107079789753*m.x12 - 0.196767170806861*m.x13 - 0.169733090016417*m.x14
- 0.14641325444883*m.x15 - 0.126297359437834*m.x16 - 0.1089452116956*m.x17
- 0.0939770966252168*m.x18 - 0.0810654690798314*m.x19 - 0.0699277857384854*m.x20
- 0.0603203222505512*m.x21 - 0.052032839850209*m.x22 - 0.0448839847312446*m.x23
- 0.0387173195073363*m.x24 - m.x25 - 0.862608784384164*m.x26 - 0.744093914896725*m.x27
- 0.641861947396717*m.x28 - 0.553675754186335*m.x29 - 0.477605569261659*m.x30
- 0.411986759515906*m.x31 - 0.355383397808387*m.x32 - 0.306556840773806*m.x33
- 0.264438623764543*m.x34 - 0.228107079789753*m.x35 - 0.196767170806861*m.x36
- 0.169733090016417*m.x37 - 0.14641325444883*m.x38 - 0.126297359437834*m.x39
- 0.1089452116956*m.x40 - 0.0939770966252168*m.x41 - 0.0810654690798314*m.x42
- 0.0699277857384854*m.x43 - 0.0603203222505512*m.x44 - 0.052032839850209*m.x45
- 0.0448839847312446*m.x46 - 0.0387173195073363*m.x47 - m.x48 - 0.862608784384164*m.x49
- 0.744093914896725*m.x50 - 0.641861947396717*m.x51 - 0.553675754186335*m.x52
- 0.477605569261659*m.x53 - 0.411986759515906*m.x54 - 0.355383397808387*m.x55
- 0.306556840773806*m.x56 - 0.264438623764543*m.x57 - 0.228107079789753*m.x58
- 0.196767170806861*m.x59 - 0.169733090016417*m.x60 - 0.14641325444883*m.x61
- 0.126297359437834*m.x62 - 0.1089452116956*m.x63 - 0.0939770966252168*m.x64
- 0.0810654690798314*m.x65 - 0.0699277857384854*m.x66 - 0.0603203222505512*m.x67
- 0.052032839850209*m.x68 - 0.0448839847312446*m.x69 - 0.0387173195073363*m.x70 - m.x71
- 0.862608784384164*m.x72 - 0.744093914896725*m.x73 - 0.641861947396717*m.x74
- 0.553675754186335*m.x75 - 0.477605569261659*m.x76 - 0.411986759515906*m.x77
- 0.355383397808387*m.x78 - 0.306556840773806*m.x79 - 0.264438623764543*m.x80
- 0.228107079789753*m.x81 - 0.196767170806861*m.x82 - 0.169733090016417*m.x83
- 0.14641325444883*m.x84 - 0.126297359437834*m.x85 - 0.1089452116956*m.x86
- 0.0939770966252168*m.x87 - 0.0810654690798314*m.x88 - 0.0699277857384854*m.x89
- 0.0603203222505512*m.x90 - 0.052032839850209*m.x91 - 0.0448839847312446*m.x92
- 0.0387173195073363*m.x93 - m.x94 - 0.862608784384164*m.x95 - 0.744093914896725*m.x96
- 0.641861947396717*m.x97 - 0.553675754186335*m.x98 - 0.477605569261659*m.x99
- 0.411986759515906*m.x100 - 0.355383397808387*m.x101 - 0.306556840773806*m.x102
- 0.264438623764543*m.x103 - 0.228107079789753*m.x104 - 0.196767170806861*m.x105
- 0.169733090016417*m.x106 - 0.14641325444883*m.x107 - 0.126297359437834*m.x108
- 0.1089452116956*m.x109 - 0.0939770966252168*m.x110 - 0.0810654690798314*m.x111
- 0.0699277857384854*m.x112 - 0.0603203222505512*m.x113 - 0.052032839850209*m.x114
- 0.0448839847312446*m.x115 - 0.0387173195073363*m.x116 - m.x117 - 0.862608784384164*m.x118
- 0.744093914896725*m.x119 - 0.641861947396717*m.x120 - 0.553675754186335*m.x121
- 0.477605569261659*m.x122 - 0.411986759515906*m.x123 - 0.355383397808387*m.x124
- 0.306556840773806*m.x125 - 0.264438623764543*m.x126 - 0.228107079789753*m.x127
- 0.196767170806861*m.x128 - 0.169733090016417*m.x129 - 0.14641325444883*m.x130
- 0.126297359437834*m.x131 - 0.1089452116956*m.x132 - 0.0939770966252168*m.x133
- 0.0810654690798314*m.x134 - 0.0699277857384854*m.x135 - 0.0603203222505512*m.x136
- 0.052032839850209*m.x137 - 0.0448839847312446*m.x138 - 0.0387173195073363*m.x139 - m.x140
- 0.862608784384164*m.x141 - 0.744093914896725*m.x142 - 0.641861947396717*m.x143
- 0.553675754186335*m.x144 - 0.477605569261659*m.x145 - 0.411986759515906*m.x146
- 0.355383397808387*m.x147 - 0.306556840773806*m.x148 - 0.264438623764543*m.x149
- 0.228107079789753*m.x150 - 0.196767170806861*m.x151 - 0.169733090016417*m.x152
- 0.14641325444883*m.x153 - 0.126297359437834*m.x154 - 0.1089452116956*m.x155
- 0.0939770966252168*m.x156 - 0.0810654690798314*m.x157 - 0.0699277857384854*m.x158
- 0.0603203222505512*m.x159 - 0.052032839850209*m.x160 - 0.0448839847312446*m.x161
- 0.0387173195073363*m.x162 - m.x163 - 0.862608784384164*m.x164 - 0.744093914896725*m.x165
- 0.641861947396717*m.x166 - 0.553675754186335*m.x167 - 0.477605569261659*m.x168
- 0.411986759515906*m.x169 - 0.355383397808387*m.x170 - 0.306556840773806*m.x171
- 0.264438623764543*m.x172 - 0.228107079789753*m.x173 - 0.196767170806861*m.x174
- 0.169733090016417*m.x175 - 0.14641325444883*m.x176 - 0.126297359437834*m.x177
- 0.1089452116956*m.x178 - 0.0939770966252168*m.x179 - 0.0810654690798314*m.x180
- 0.0699277857384854*m.x181 - 0.0603203222505512*m.x182 - 0.052032839850209*m.x183
- 0.0448839847312446*m.x184 - 0.0387173195073363*m.x185 - m.x186 - 0.862608784384164*m.x187
- 0.744093914896725*m.x188 - 0.641861947396717*m.x189 - 0.553675754186335*m.x190
- 0.477605569261659*m.x191 - 0.411986759515906*m.x192 - 0.355383397808387*m.x193
- 0.306556840773806*m.x194 - 0.264438623764543*m.x195 - 0.228107079789753*m.x196
- 0.196767170806861*m.x197 - 0.169733090016417*m.x198 - 0.14641325444883*m.x199
- 0.126297359437834*m.x200 - 0.1089452116956*m.x201 - 0.0939770966252168*m.x202
- 0.0810654690798314*m.x203 - 0.0699277857384854*m.x204 - 0.0603203222505512*m.x205
- 0.052032839850209*m.x206 - 0.0448839847312446*m.x207 - 0.0387173195073363*m.x208 - m.x209
- 0.862608784384164*m.x210 - 0.744093914896725*m.x211 - 0.641861947396717*m.x212
- 0.553675754186335*m.x213 - 0.477605569261659*m.x214 - 0.411986759515906*m.x215
- 0.355383397808387*m.x216 - 0.306556840773806*m.x217 - 0.264438623764543*m.x218
- 0.228107079789753*m.x219 - 0.196767170806861*m.x220 - 0.169733090016417*m.x221
- 0.14641325444883*m.x222 - 0.126297359437834*m.x223 - 0.1089452116956*m.x224
- 0.0939770966252168*m.x225 - 0.0810654690798314*m.x226 - 0.0699277857384854*m.x227
- 0.0603203222505512*m.x228 - 0.052032839850209*m.x229 - 0.0448839847312446*m.x230
- 0.0387173195073363*m.x231 - m.x232 - 0.862608784384164*m.x233 - 0.744093914896725*m.x234
- 0.641861947396717*m.x235 - 0.553675754186335*m.x236 - 0.477605569261659*m.x237
- 0.411986759515906*m.x238 - 0.355383397808387*m.x239 - 0.306556840773806*m.x240
- 0.264438623764543*m.x241 - 0.228107079789753*m.x242 - 0.196767170806861*m.x243
- 0.169733090016417*m.x244 - 0.14641325444883*m.x245 - 0.126297359437834*m.x246
- 0.1089452116956*m.x247 - 0.0939770966252168*m.x248 - 0.0810654690798314*m.x249
- 0.0699277857384854*m.x250 - 0.0603203222505512*m.x251 - 0.052032839850209*m.x252
- 0.0448839847312446*m.x253 - 0.0387173195073363*m.x254, sense=minimize)
m.c2 = Constraint(expr=-(m.x255*m.x1589 + m.x508*m.x1083)**0.15*m.x830**0.85 + m.x2 == 0)
m.c3 = Constraint(expr=-(m.x256*m.x1590 + m.x509*m.x1084)**0.15*m.x831**0.85 + m.x3 == 0)
m.c4 = Constraint(expr=-(m.x257*m.x1591 + m.x510*m.x1085)**0.15*m.x832**0.85 + m.x4 == 0)
m.c5 = Constraint(expr=-(m.x258*m.x1592 + m.x511*m.x1086)**0.15*m.x833**0.85 + m.x5 == 0)
m.c6 = Constraint(expr=-(m.x259*m.x1593 + m.x512*m.x1087)**0.15*m.x834**0.85 + m.x6 == 0)
m.c7 = Constraint(expr=-(m.x260*m.x1594 + m.x513*m.x1088)**0.15*m.x835**0.85 + m.x7 == 0)
m.c8 = Constraint(expr=-(m.x261*m.x1595 + m.x514*m.x1089)**0.15*m.x836**0.85 + m.x8 == 0)
m.c9 = Constraint(expr=-(m.x262*m.x1596 + m.x515*m.x1090)**0.15*m.x837**0.85 + m.x9 == 0)
m.c10 = Constraint(expr=-(m.x263*m.x1597 + m.x516*m.x1091)**0.15*m.x838**0.85 + m.x10 == 0)
m.c11 = Constraint(expr=-(m.x264*m.x1598 + m.x517*m.x1092)**0.15*m.x839**0.85 + m.x11 == 0)
m.c12 = Constraint(expr=-(m.x265*m.x1599 + m.x518*m.x1093)**0.15*m.x840**0.85 + m.x12 == 0)
m.c13 = Constraint(expr=-(m.x266*m.x1600 + m.x519*m.x1094)**0.15*m.x841**0.85 + m.x13 == 0)
m.c14 = Constraint(expr=-(m.x267*m.x1601 + m.x520*m.x1095)**0.15*m.x842**0.85 + m.x14 == 0)
m.c15 = Constraint(expr=-(m.x268*m.x1602 + m.x521*m.x1096)**0.15*m.x843**0.85 + m.x15 == 0)
m.c16 = Constraint(expr=-(m.x269*m.x1603 + m.x522*m.x1097)**0.15*m.x844**0.85 + m.x16 == 0)
m.c17 = Constraint(expr=-(m.x270*m.x1604 + m.x523*m.x1098)**0.15*m.x845**0.85 + m.x17 == 0)
m.c18 = Constraint(expr=-(m.x271*m.x1605 + m.x524*m.x1099)**0.15*m.x846**0.85 + m.x18 == 0)
m.c19 = Constraint(expr=-(m.x272*m.x1606 + m.x525*m.x1100)**0.15*m.x847**0.85 + m.x19 == 0)
m.c20 = Constraint(expr=-(m.x273*m.x1607 + m.x526*m.x1101)**0.15*m.x848**0.85 + m.x20 == 0)
m.c21 = Constraint(expr=-(m.x274*m.x1608 + m.x527*m.x1102)**0.15*m.x849**0.85 + m.x21 == 0)
m.c22 = Constraint(expr=-(m.x275*m.x1609 + m.x528*m.x1103)**0.15*m.x850**0.85 + m.x22 == 0)
m.c23 = Constraint(expr=-(m.x276*m.x1610 + m.x529*m.x1104)**0.15*m.x851**0.85 + m.x23 == 0)
m.c24 = Constraint(expr=-(m.x277*m.x1611 + m.x530*m.x1105)**0.15*m.x852**0.85 + m.x24 == 0)
m.c25 = Constraint(expr=-(m.x278*m.x1612 + m.x531*m.x1106)**0.15*m.x853**0.85 + m.x25 == 0)
m.c26 = Constraint(expr=-(m.x279*m.x1613 + m.x532*m.x1107)**0.15*m.x854**0.85 + m.x26 == 0)
m.c27 = Constraint(expr=-(m.x280*m.x1614 + m.x533*m.x1108)**0.15*m.x855**0.85 + m.x27 == 0)
m.c28 = Constraint(expr=-(m.x281*m.x1615 + m.x534*m.x1109)**0.15*m.x856**0.85 + m.x28 == 0)
m.c29 = Constraint(expr=-(m.x282*m.x1616 + m.x535*m.x1110)**0.15*m.x857**0.85 + m.x29 == 0)
m.c30 = Constraint(expr=-(m.x283*m.x1617 + m.x536*m.x1111)**0.15*m.x858**0.85 + m.x30 == 0)
m.c31 = Constraint(expr=-(m.x284*m.x1618 + m.x537*m.x1112)**0.15*m.x859**0.85 + m.x31 == 0)
m.c32 = Constraint(expr=-(m.x285*m.x1619 + m.x538*m.x1113)**0.15*m.x860**0.85 + m.x32 == 0)
m.c33 = Constraint(expr=-(m.x286*m.x1620 + m.x539*m.x1114)**0.15*m.x861**0.85 + m.x33 == 0)
m.c34 = Constraint(expr=-(m.x287*m.x1621 + m.x540*m.x1115)**0.15*m.x862**0.85 + m.x34 == 0)
m.c35 = Constraint(expr=-(m.x288*m.x1622 + m.x541*m.x1116)**0.15*m.x863**0.85 + m.x35 == 0)
m.c36 = Constraint(expr=-(m.x289*m.x1623 + m.x542*m.x1117)**0.15*m.x864**0.85 + m.x36 == 0)
m.c37 = Constraint(expr=-(m.x290*m.x1624 + m.x543*m.x1118)**0.15*m.x865**0.85 + m.x37 == 0)
m.c38 = Constraint(expr=-(m.x291*m.x1625 + m.x544*m.x1119)**0.15*m.x866**0.85 + m.x38 == 0)
m.c39 = Constraint(expr=-(m.x292*m.x1626 + m.x545*m.x1120)**0.15*m.x867**0.85 + m.x39 == 0)
m.c40 = Constraint(expr=-(m.x293*m.x1627 + m.x546*m.x1121)**0.15*m.x868**0.85 + m.x40 == 0)
m.c41 = Constraint(expr=-(m.x294*m.x1628 + m.x547*m.x1122)**0.15*m.x869**0.85 + m.x41 == 0)
m.c42 = Constraint(expr=-(m.x295*m.x1629 + m.x548*m.x1123)**0.15*m.x870**0.85 + m.x42 == 0)
m.c43 = Constraint(expr=-(m.x296*m.x1630 + m.x549*m.x1124)**0.15*m.x871**0.85 + m.x43 == 0)
m.c44 = Constraint(expr=-(m.x297*m.x1631 + m.x550*m.x1125)**0.15*m.x872**0.85 + m.x44 == 0)
m.c45 = Constraint(expr=-(m.x298*m.x1632 + m.x551*m.x1126)**0.15*m.x873**0.85 + m.x45 == 0)
m.c46 = Constraint(expr=-(m.x299*m.x1633 + m.x552*m.x1127)**0.15*m.x874**0.85 + m.x46 == 0)
m.c47 = Constraint(expr=-(m.x300*m.x1634 + m.x553*m.x1128)**0.15*m.x875**0.85 + m.x47 == 0)
m.c48 = Constraint(expr=-(m.x301*m.x1635 + m.x554*m.x1129)**0.15*m.x876**0.85 + m.x48 == 0)
m.c49 = Constraint(expr=-(m.x302*m.x1636 + m.x555*m.x1130)**0.15*m.x877**0.85 + m.x49 == 0)
m.c50 = Constraint(expr=-(m.x303*m.x1637 + m.x556*m.x1131)**0.15*m.x878**0.85 + m.x50 == 0)
m.c51 = Constraint(expr=-(m.x304*m.x1638 + m.x557*m.x1132)**0.15*m.x879**0.85 + m.x51 == 0)
m.c52 = Constraint(expr=-(m.x305*m.x1639 + m.x558*m.x1133)**0.15*m.x880**0.85 + m.x52 == 0)
m.c53 = Constraint(expr=-(m.x306*m.x1640 + m.x559*m.x1134)**0.15*m.x881**0.85 + m.x53 == 0)
m.c54 = Constraint(expr=-(m.x307*m.x1641 + m.x560*m.x1135)**0.15*m.x882**0.85 + m.x54 == 0)
m.c55 = Constraint(expr=-(m.x308*m.x1642 + m.x561*m.x1136)**0.15*m.x883**0.85 + m.x55 == 0)
m.c56 = Constraint(expr=-(m.x309*m.x1643 + m.x562*m.x1137)**0.15*m.x884**0.85 + m.x56 == 0)
m.c57 = Constraint(expr=-(m.x310*m.x1644 + m.x563*m.x1138)**0.15*m.x885**0.85 + m.x57 == 0)
m.c58 = Constraint(expr=-(m.x311*m.x1645 + m.x564*m.x1139)**0.15*m.x886**0.85 + m.x58 == 0)
m.c59 = Constraint(expr=-(m.x312*m.x1646 + m.x565*m.x1140)**0.15*m.x887**0.85 + m.x59 == 0)
m.c60 = Constraint(expr=-(m.x313*m.x1647 + m.x566*m.x1141)**0.15*m.x888**0.85 + m.x60 == 0)
m.c61 = Constraint(expr=-(m.x314*m.x1648 + m.x567*m.x1142)**0.15*m.x889**0.85 + m.x61 == 0)
m.c62 = Constraint(expr=-(m.x315*m.x1649 + m.x568*m.x1143)**0.15*m.x890**0.85 + m.x62 == 0)
m.c63 = Constraint(expr=-(m.x316*m.x1650 + m.x569*m.x1144)**0.15*m.x891**0.85 + m.x63 == 0)
m.c64 = Constraint(expr=-(m.x317*m.x1651 + m.x570*m.x1145)**0.15*m.x892**0.85 + m.x64 == 0)
m.c65 = Constraint(expr=-(m.x318*m.x1652 + m.x571*m.x1146)**0.15*m.x893**0.85 + m.x65 == 0)
m.c66 = Constraint(expr=-(m.x319*m.x1653 + m.x572*m.x1147)**0.15*m.x894**0.85 + m.x66 == 0)
m.c67 = Constraint(expr=-(m.x320*m.x1654 + m.x573*m.x1148)**0.15*m.x895**0.85 + m.x67 == 0)
m.c68 = Constraint(expr=-(m.x321*m.x1655 + m.x574*m.x1149)**0.15*m.x896**0.85 + m.x68 == 0)
m.c69 = Constraint(expr=-(m.x322*m.x1656 + m.x575*m.x1150)**0.15*m.x897**0.85 + m.x69 == 0)
m.c70 = Constraint(expr=-(m.x323*m.x1657 + m.x576*m.x1151)**0.15*m.x898**0.85 + m.x70 == 0)
m.c71 = Constraint(expr=-(m.x324*m.x1658 + m.x577*m.x1152)**0.15*m.x899**0.85 + m.x71 == 0)
m.c72 = Constraint(expr=-(m.x325*m.x1659 + m.x578*m.x1153)**0.15*m.x900**0.85 + m.x72 == 0)
m.c73 = Constraint(expr=-(m.x326*m.x1660 + m.x579*m.x1154)**0.15*m.x901**0.85 + m.x73 == 0)
m.c74 = Constraint(expr=-(m.x327*m.x1661 + m.x580*m.x1155)**0.15*m.x902**0.85 + m.x74 == 0)
m.c75 = Constraint(expr=-(m.x328*m.x1662 + m.x581*m.x1156)**0.15*m.x903**0.85 + m.x75 == 0)
m.c76 = Constraint(expr=-(m.x329*m.x1663 + m.x582*m.x1157)**0.15*m.x904**0.85 + m.x76 == 0)
m.c77 = Constraint(expr=-(m.x330*m.x1664 + m.x583*m.x1158)**0.15*m.x905**0.85 + m.x77 == 0)
m.c78 = Constraint(expr=-(m.x331*m.x1665 + m.x584*m.x1159)**0.15*m.x906**0.85 + m.x78 == 0)
m.c79 = Constraint(expr=-(m.x332*m.x1666 + m.x585*m.x1160)**0.15*m.x907**0.85 + m.x79 == 0)
m.c80 = Constraint(expr=-(m.x333*m.x1667 + m.x586*m.x1161)**0.15*m.x908**0.85 + m.x80 == 0)
m.c81 = Constraint(expr=-(m.x334*m.x1668 + m.x587*m.x1162)**0.15*m.x909**0.85 + m.x81 == 0)
m.c82 = Constraint(expr=-(m.x335*m.x1669 + m.x588*m.x1163)**0.15*m.x910**0.85 + m.x82 == 0)
m.c83 = Constraint(expr=-(m.x336*m.x1670 + m.x589*m.x1164)**0.15*m.x911**0.85 + m.x83 == 0)
m.c84 = Constraint(expr=-(m.x337*m.x1671 + m.x590*m.x1165)**0.15*m.x912**0.85 + m.x84 == 0)
m.c85 = Constraint(expr=-(m.x338*m.x1672 + m.x591*m.x1166)**0.15*m.x913**0.85 + m.x85 == 0)
m.c86 = Constraint(expr=-(m.x339*m.x1673 + m.x592*m.x1167)**0.15*m.x914**0.85 + m.x86 == 0)
m.c87 = Constraint(expr=-(m.x340*m.x1674 + m.x593*m.x1168)**0.15*m.x915**0.85 + m.x87 == 0)
m.c88 = Constraint(expr=-(m.x341*m.x1675 + m.x594*m.x1169)**0.15*m.x916**0.85 + m.x88 == 0)
m.c89 = Constraint(expr=-(m.x342*m.x1676 + m.x595*m.x1170)**0.15*m.x917**0.85 + m.x89 == 0)
m.c90 = Constraint(expr=-(m.x343*m.x1677 + m.x596*m.x1171)**0.15*m.x918**0.85 + m.x90 == 0)
m.c91 = Constraint(expr=-(m.x344*m.x1678 + m.x597*m.x1172)**0.15*m.x919**0.85 + m.x91 == 0)
m.c92 = Constraint(expr=-(m.x345*m.x1679 + m.x598*m.x1173)**0.15*m.x920**0.85 + m.x92 == 0)
m.c93 = Constraint(expr=-(m.x346*m.x1680 + m.x599*m.x1174)**0.15*m.x921**0.85 + m.x93 == 0)
m.c94 = Constraint(expr=-(m.x347*m.x1681 + m.x600*m.x1175)**0.15*m.x922**0.85 + m.x94 == 0)
m.c95 = Constraint(expr=-(m.x348*m.x1682 + m.x601*m.x1176)**0.15*m.x923**0.85 + m.x95 == 0)
m.c96 = Constraint(expr=-(m.x349*m.x1683 + m.x602*m.x1177)**0.15*m.x924**0.85 + m.x96 == 0)
m.c97 = Constraint(expr=-(m.x350*m.x1684 + m.x603*m.x1178)**0.15*m.x925**0.85 + m.x97 == 0)
m.c98 = Constraint(expr=-(m.x351*m.x1685 + m.x604*m.x1179)**0.15*m.x926**0.85 + m.x98 == 0)
m.c99 = Constraint(expr=-(m.x352*m.x1686 + m.x605*m.x1180)**0.15*m.x927**0.85 + m.x99 == 0)
m.c100 = Constraint(expr=-(m.x353*m.x1687 + m.x606*m.x1181)**0.15*m.x928**0.85 + m.x100 == 0)
m.c101 = Constraint(expr=-(m.x354*m.x1688 + m.x607*m.x1182)**0.15*m.x929**0.85 + m.x101 == 0)
m.c102 = Constraint(expr=-(m.x355*m.x1689 + m.x608*m.x1183)**0.15*m.x930**0.85 + m.x102 == 0)
m.c103 = Constraint(expr=-(m.x356*m.x1690 + m.x609*m.x1184)**0.15*m.x931**0.85 + m.x103 == 0)
m.c104 = Constraint(expr=-(m.x357*m.x1691 + m.x610*m.x1185)**0.15*m.x932**0.85 + m.x104 == 0)
m.c105 = Constraint(expr=-(m.x358*m.x1692 + m.x611*m.x1186)**0.15*m.x933**0.85 + m.x105 == 0)
m.c106 = Constraint(expr=-(m.x359*m.x1693 + m.x612*m.x1187)**0.15*m.x934**0.85 + m.x106 == 0)
m.c107 = Constraint(expr=-(m.x360*m.x1694 + m.x613*m.x1188)**0.15*m.x935**0.85 + m.x107 == 0)
m.c108 = Constraint(expr=-(m.x361*m.x1695 + m.x614*m.x1189)**0.15*m.x936**0.85 + m.x108 == 0)
m.c109 = Constraint(expr=-(m.x362*m.x1696 + m.x615*m.x1190)**0.15*m.x937**0.85 + m.x109 == 0)
m.c110 = Constraint(expr=-(m.x363*m.x1697 + m.x616*m.x1191)**0.15*m.x938**0.85 + m.x110 == 0)
m.c111 = Constraint(expr=-(m.x364*m.x1698 + m.x617*m.x1192)**0.15*m.x939**0.85 + m.x111 == 0)
m.c112 = Constraint(expr=-(m.x365*m.x1699 + m.x618*m.x1193)**0.15*m.x940**0.85 + m.x112 == 0)
m.c113 = Constraint(expr=-(m.x366*m.x1700 + m.x619*m.x1194)**0.15*m.x941**0.85 + m.x113 == 0)
m.c114 = Constraint(expr=-(m.x367*m.x1701 + m.x620*m.x1195)**0.15*m.x942**0.85 + m.x114 == 0)
m.c115 = Constraint(expr=-(m.x368*m.x1702 + m.x621*m.x1196)**0.15*m.x943**0.85 + m.x115 == 0)
m.c116 = Constraint(expr=-(m.x369*m.x1703 + m.x622*m.x1197)**0.15*m.x944**0.85 + m.x116 == 0)
m.c117 = Constraint(expr=-(m.x370*m.x1704 + m.x623*m.x1198)**0.15*m.x945**0.85 + m.x117 == 0)
m.c118 = Constraint(expr=-(m.x371*m.x1705 + m.x624*m.x1199)**0.15*m.x946**0.85 + m.x118 == 0)
m.c119 = Constraint(expr=-(m.x372*m.x1706 + m.x625*m.x1200)**0.15*m.x947**0.85 + m.x119 == 0)
m.c120 = Constraint(expr=-(m.x373*m.x1707 + m.x626*m.x1201)**0.15*m.x948**0.85 + m.x120 == 0)
m.c121 = Constraint(expr=-(m.x374*m.x1708 + m.x627*m.x1202)**0.15*m.x949**0.85 + m.x121 == 0)
m.c122 = Constraint(expr=-(m.x375*m.x1709 + m.x628*m.x1203)**0.15*m.x950**0.85 + m.x122 == 0)
m.c123 = Constraint(expr=-(m.x376*m.x1710 + m.x629*m.x1204)**0.15*m.x951**0.85 + m.x123 == 0)
m.c124 = Constraint(expr=-(m.x377*m.x1711 + m.x630*m.x1205)**0.15*m.x952**0.85 + m.x124 == 0)
m.c125 = Constraint(expr=-(m.x378*m.x1712 + m.x631*m.x1206)**0.15*m.x953**0.85 + m.x125 == 0)
m.c126 = Constraint(expr=-(m.x379*m.x1713 + m.x632*m.x1207)**0.15*m.x954**0.85 + m.x126 == 0)
m.c127 = Constraint(expr=-(m.x380*m.x1714 + m.x633*m.x1208)**0.15*m.x955**0.85 + m.x127 == 0)
m.c128 = Constraint(expr=-(m.x381*m.x1715 + m.x634*m.x1209)**0.15*m.x956**0.85 + m.x128 == 0)
m.c129 = Constraint(expr=-(m.x382*m.x1716 + m.x635*m.x1210)**0.15*m.x957**0.85 + m.x129 == 0)
m.c130 = Constraint(expr=-(m.x383*m.x1717 + m.x636*m.x1211)**0.15*m.x958**0.85 + m.x130 == 0)
m.c131 = Constraint(expr=-(m.x384*m.x1718 + m.x637*m.x1212)**0.15*m.x959**0.85 + m.x131 == 0)
m.c132 = Constraint(expr=-(m.x385*m.x1719 + m.x638*m.x1213)**0.15*m.x960**0.85 + m.x132 == 0)
m.c133 = Constraint(expr=-(m.x386*m.x1720 + m.x639*m.x1214)**0.15*m.x961**0.85 + m.x133 == 0)
m.c134 = Constraint(expr=-(m.x387*m.x1721 + m.x640*m.x1215)**0.15*m.x962**0.85 + m.x134 == 0)
m.c135 = Constraint(expr=-(m.x388*m.x1722 + m.x641*m.x1216)**0.15*m.x963**0.85 + m.x135 == 0)
m.c136 = Constraint(expr=-(m.x389*m.x1723 + m.x642*m.x1217)**0.15*m.x964**0.85 + m.x136 == 0)
m.c137 = Constraint(expr=-(m.x390*m.x1724 + m.x643*m.x1218)**0.15*m.x965**0.85 + m.x137 == 0)
m.c138 = Constraint(expr=-(m.x391*m.x1725 + m.x644*m.x1219)**0.15*m.x966**0.85 + m.x138 == 0)
m.c139 = Constraint(expr=-(m.x392*m.x1726 + m.x645*m.x1220)**0.15*m.x967**0.85 + m.x139 == 0)
m.c140 = Constraint(expr=-(m.x393*m.x1727 + m.x646*m.x1221)**0.15*m.x968**0.85 + m.x140 == 0)
m.c141 = Constraint(expr=-(m.x394*m.x1728 + m.x647*m.x1222)**0.15*m.x969**0.85 + m.x141 == 0)
m.c142 = Constraint(expr=-(m.x395*m.x1729 + m.x648*m.x1223)**0.15*m.x970**0.85 + m.x142 == 0)
m.c143 = Constraint(expr=-(m.x396*m.x1730 + m.x649*m.x1224)**0.15*m.x971**0.85 + m.x143 == 0)
m.c144 = Constraint(expr=-(m.x397*m.x1731 + m.x650*m.x1225)**0.15*m.x972**0.85 + m.x144 == 0)
m.c145 = Constraint(expr=-(m.x398*m.x1732 + m.x651*m.x1226)**0.15*m.x973**0.85 + m.x145 == 0)
m.c146 = Constraint(expr=-(m.x399*m.x1733 + m.x652*m.x1227)**0.15*m.x974**0.85 + m.x146 == 0)
m.c147 = Constraint(expr=-(m.x400*m.x1734 + m.x653*m.x1228)**0.15*m.x975**0.85 + m.x147 == 0)
m.c148 = Constraint(expr=-(m.x401*m.x1735 + m.x654*m.x1229)**0.15*m.x976**0.85 + m.x148 == 0)
m.c149 = Constraint(expr=-(m.x402*m.x1736 + m.x655*m.x1230)**0.15*m.x977**0.85 + m.x149 == 0)
m.c150 = Constraint(expr=-(m.x403*m.x1737 + m.x656*m.x1231)**0.15*m.x978**0.85 + m.x150 == 0)
m.c151 = Constraint(expr=-(m.x404*m.x1738 + m.x657*m.x1232)**0.15*m.x979**0.85 + m.x151 == 0)
m.c152 = Constraint(expr=-(m.x405*m.x1739 + m.x658*m.x1233)**0.15*m.x980**0.85 + m.x152 == 0)
m.c153 = Constraint(expr=-(m.x406*m.x1740 + m.x659*m.x1234)**0.15*m.x981**0.85 + m.x153 == 0)
m.c154 = Constraint(expr=-(m.x407*m.x1741 + m.x660*m.x1235)**0.15*m.x982**0.85 + m.x154 == 0)
m.c155 = Constraint(expr=-(m.x408*m.x1742 + m.x661*m.x1236)**0.15*m.x983**0.85 + m.x155 == 0)
m.c156 = Constraint(expr=-(m.x409*m.x1743 + m.x662*m.x1237)**0.15*m.x984**0.85 + m.x156 == 0)
m.c157 = Constraint(expr=-(m.x410*m.x1744 + m.x663*m.x1238)**0.15*m.x985**0.85 + m.x157 == 0)
m.c158 = Constraint(expr=-(m.x411*m.x1745 + m.x664*m.x1239)**0.15*m.x986**0.85 + m.x158 == 0)
m.c159 = Constraint(expr=-(m.x412*m.x1746 + m.x665*m.x1240)**0.15*m.x987**0.85 + m.x159 == 0)
m.c160 = Constraint(expr=-(m.x413*m.x1747 + m.x666*m.x1241)**0.15*m.x988**0.85 + m.x160 == 0)
m.c161 = Constraint(expr=-(m.x414*m.x1748 + m.x667*m.x1242)**0.15*m.x989**0.85 + m.x161 == 0)
m.c162 = Constraint(expr=-(m.x415*m.x1749 + m.x668*m.x1243)**0.15*m.x990**0.85 + m.x162 == 0)
m.c163 = Constraint(expr=-(m.x416*m.x1750 + m.x669*m.x1244)**0.15*m.x991**0.85 + m.x163 == 0)
m.c164 = Constraint(expr=-(m.x417*m.x1751 + m.x670*m.x1245)**0.15*m.x992**0.85 + m.x164 == 0)
m.c165 = Constraint(expr=-(m.x418*m.x1752 + m.x671*m.x1246)**0.15*m.x993**0.85 + m.x165 == 0)
m.c166 = Constraint(expr=-(m.x419*m.x1753 + m.x672*m.x1247)**0.15*m.x994**0.85 + m.x166 == 0)
m.c167 = Constraint(expr=-(m.x420*m.x1754 + m.x673*m.x1248)**0.15*m.x995**0.85 + m.x167 == 0)
m.c168 = Constraint(expr=-(m.x421*m.x1755 + m.x674*m.x1249)**0.15*m.x996**0.85 + m.x168 == 0)
m.c169 = Constraint(expr=-(m.x422*m.x1756 + m.x675*m.x1250)**0.15*m.x997**0.85 + m.x169 == 0)
m.c170 = Constraint(expr=-(m.x423*m.x1757 + m.x676*m.x1251)**0.15*m.x998**0.85 + m.x170 == 0)
m.c171 = Constraint(expr=-(m.x424*m.x1758 + m.x677*m.x1252)**0.15*m.x999**0.85 + m.x171 == 0)
m.c172 = Constraint(expr=-(m.x425*m.x1759 + m.x678*m.x1253)**0.15*m.x1000**0.85 + m.x172 == 0)
m.c173 = Constraint(expr=-(m.x426*m.x1760 + m.x679*m.x1254)**0.15*m.x1001**0.85 + m.x173 == 0)
m.c174 = Constraint(expr=-(m.x427*m.x1761 + m.x680*m.x1255)**0.15*m.x1002**0.85 + m.x174 == 0)
m.c175 = Constraint(expr=-(m.x428*m.x1762 + m.x681*m.x1256)**0.15*m.x1003**0.85 + m.x175 == 0)
m.c176 = Constraint(expr=-(m.x429*m.x1763 + m.x682*m.x1257)**0.15*m.x1004**0.85 + m.x176 == 0)
m.c177 = Constraint(expr=-(m.x430*m.x1764 + m.x683*m.x1258)**0.15*m.x1005**0.85 + m.x177 == 0)
m.c178 = Constraint(expr=-(m.x431*m.x1765 + m.x684*m.x1259)**0.15*m.x1006**0.85 + m.x178 == 0)
m.c179 = Constraint(expr=-(m.x432*m.x1766 + m.x685*m.x1260)**0.15*m.x1007**0.85 + m.x179 == 0)
m.c180 = Constraint(expr=-(m.x433*m.x1767 + m.x686*m.x1261)**0.15*m.x1008**0.85 + m.x180 == 0)
m.c181 = Constraint(expr=-(m.x434*m.x1768 + m.x687*m.x1262)**0.15*m.x1009**0.85 + m.x181 == 0)
m.c182 = Constraint(expr=-(m.x435*m.x1769 + m.x688*m.x1263)**0.15*m.x1010**0.85 + m.x182 == 0)
m.c183 = Constraint(expr=-(m.x436*m.x1770 + m.x689*m.x1264)**0.15*m.x1011**0.85 + m.x183 == 0)
m.c184 = Constraint(expr=-(m.x437*m.x1771 + m.x690*m.x1265)**0.15*m.x1012**0.85 + m.x184 == 0)
m.c185 = Constraint(expr=-(m.x438*m.x1772 + m.x691*m.x1266)**0.15*m.x1013**0.85 + m.x185 == 0)
m.c186 = Constraint(expr=-(m.x439*m.x1773 + m.x692*m.x1267)**0.15*m.x1014**0.85 + m.x186 == 0)
m.c187 = Constraint(expr=-(m.x440*m.x1774 + m.x693*m.x1268)**0.15*m.x1015**0.85 + m.x187 == 0)
m.c188 = Constraint(expr=-(m.x441*m.x1775 + m.x694*m.x1269)**0.15*m.x1016**0.85 + m.x188 == 0)
m.c189 = Constraint(expr=-(m.x442*m.x1776 + m.x695*m.x1270)**0.15*m.x1017**0.85 + m.x189 == 0)
m.c190 = Constraint(expr=-(m.x443*m.x1777 + m.x696*m.x1271)**0.15*m.x1018**0.85 + m.x190 == 0)
m.c191 = Constraint(expr=-(m.x444*m.x1778 + m.x697*m.x1272)**0.15*m.x1019**0.85 + m.x191 == 0)
m.c192 = Constraint(expr=-(m.x445*m.x1779 + m.x698*m.x1273)**0.15*m.x1020**0.85 + m.x192 == 0)
m.c193 = Constraint(expr=-(m.x446*m.x1780 + m.x699*m.x1274)**0.15*m.x1021**0.85 + m.x193 == 0)
m.c194 = Constraint(expr=-(m.x447*m.x1781 + m.x700*m.x1275)**0.15*m.x1022**0.85 + m.x194 == 0)
m.c195 = Constraint(expr=-(m.x448*m.x1782 + m.x701*m.x1276)**0.15*m.x1023**0.85 + m.x195 == 0)
m.c196 = Constraint(expr=-(m.x449*m.x1783 + m.x702*m.x1277)**0.15*m.x1024**0.85 + m.x196 == 0)
m.c197 = Constraint(expr=-(m.x450*m.x1784 + m.x703*m.x1278)**0.15*m.x1025**0.85 + m.x197 == 0)
m.c198 = Constraint(expr=-(m.x451*m.x1785 + m.x704*m.x1279)**0.15*m.x1026**0.85 + m.x198 == 0)
m.c199 = Constraint(expr=-(m.x452*m.x1786 + m.x705*m.x1280)**0.15*m.x1027**0.85 + m.x199 == 0)
m.c200 = Constraint(expr=-(m.x453*m.x1787 + m.x706*m.x1281)**0.15*m.x1028**0.85 + m.x200 == 0)
m.c201 = Constraint(expr=-(m.x454*m.x1788 + m.x707*m.x1282)**0.15*m.x1029**0.85 + m.x201 == 0)
m.c202 = Constraint(expr=-(m.x455*m.x1789 + m.x708*m.x1283)**0.15*m.x1030**0.85 + m.x202 == 0)
m.c203 = Constraint(expr=-(m.x456*m.x1790 + m.x709*m.x1284)**0.15*m.x1031**0.85 + m.x203 == 0)
m.c204 = Constraint(expr=-(m.x457*m.x1791 + m.x710*m.x1285)**0.15*m.x1032**0.85 + m.x204 == 0)
m.c205 = Constraint(expr=-(m.x458*m.x1792 + m.x711*m.x1286)**0.15*m.x1033**0.85 + m.x205 == 0)
m.c206 = Constraint(expr=-(m.x459*m.x1793 + m.x712*m.x1287)**0.15*m.x1034**0.85 + m.x206 == 0)
m.c207 = Constraint(expr=-(m.x460*m.x1794 + m.x713*m.x1288)**0.15*m.x1035**0.85 + m.x207 == 0)
m.c208 = Constraint(expr=-(m.x461*m.x1795 + m.x714*m.x1289)**0.15*m.x1036**0.85 + m.x208 == 0)
m.c209 = Constraint(expr=-(m.x462*m.x1796 + m.x715*m.x1290)**0.15*m.x1037**0.85 + m.x209 == 0)
m.c210 = Constraint(expr=-(m.x463*m.x1797 + m.x716*m.x1291)**0.15*m.x1038**0.85 + m.x210 == 0)
m.c211 = Constraint(expr=-(m.x464*m.x1798 + m.x717*m.x1292)**0.15*m.x1039**0.85 + m.x211 == 0)
m.c212 = Constraint(expr=-(m.x465*m.x1799 + m.x718*m.x1293)**0.15*m.x1040**0.85 + m.x212 == 0)
m.c213 = Constraint(expr=-(m.x466*m.x1800 + m.x719*m.x1294)**0.15*m.x1041**0.85 + m.x213 == 0)
m.c214 = Constraint(expr=-(m.x467*m.x1801 + m.x720*m.x1295)**0.15*m.x1042**0.85 + m.x214 == 0)
m.c215 = Constraint(expr=-(m.x468*m.x1802 + m.x721*m.x1296)**0.15*m.x1043**0.85 + m.x215 == 0)
m.c216 = Constraint(expr=-(m.x469*m.x1803 + m.x722*m.x1297)**0.15*m.x1044**0.85 + m.x216 == 0)
m.c217 = Constraint(expr=-(m.x470*m.x1804 + m.x723*m.x1298)**0.15*m.x1045**0.85 + m.x217 == 0)
m.c218 = Constraint(expr=-(m.x471*m.x1805 + m.x724*m.x1299)**0.15*m.x1046**0.85 + m.x218 == 0)
m.c219 = Constraint(expr=-(m.x472*m.x1806 + m.x725*m.x1300)**0.15*m.x1047**0.85 + m.x219 == 0)
m.c220 = Constraint(expr=-(m.x473*m.x1807 + m.x726*m.x1301)**0.15*m.x1048**0.85 + m.x220 == 0)
m.c221 = Constraint(expr=-(m.x474*m.x1808 + m.x727*m.x1302)**0.15*m.x1049**0.85 + m.x221 == 0)
m.c222 = Constraint(expr=-(m.x475*m.x1809 + m.x728*m.x1303)**0.15*m.x1050**0.85 + m.x222 == 0)
m.c223 = Constraint(expr=-(m.x476*m.x1810 + m.x729*m.x1304)**0.15*m.x1051**0.85 + m.x223 == 0)
m.c224 = Constraint(expr=-(m.x477*m.x1811 + m.x730*m.x1305)**0.15*m.x1052**0.85 + m.x224 == 0)
m.c225 = Constraint(expr=-(m.x478*m.x1812 + m.x731*m.x1306)**0.15*m.x1053**0.85 + m.x225 == 0)
m.c226 = Constraint(expr=-(m.x479*m.x1813 + m.x732*m.x1307)**0.15*m.x1054**0.85 + m.x226 == 0)
m.c227 = Constraint(expr=-(m.x480*m.x1814 + m.x733*m.x1308)**0.15*m.x1055**0.85 + m.x227 == 0)
m.c228 = Constraint(expr=-(m.x481*m.x1815 + m.x734*m.x1309)**0.15*m.x1056**0.85 + m.x228 == 0)
m.c229 = Constraint(expr=-(m.x482*m.x1816 + m.x735*m.x1310)**0.15*m.x1057**0.85 + m.x229 == 0)
m.c230 = Constraint(expr=-(m.x483*m.x1817 + m.x736*m.x1311)**0.15*m.x1058**0.85 + m.x230 == 0)
m.c231 = Constraint(expr=-(m.x484*m.x1818 + m.x737*m.x1312)**0.15*m.x1059**0.85 + m.x231 == 0)
m.c232 = Constraint(expr=-(m.x485*m.x1819 + m.x738*m.x1313)**0.15*m.x1060**0.85 + m.x232 == 0)
m.c233 = Constraint(expr=-(m.x486*m.x1820 + m.x739*m.x1314)**0.15*m.x1061**0.85 + m.x233 == 0)
m.c234 = Constraint(expr=-(m.x487*m.x1821 + m.x740*m.x1315)**0.15*m.x1062**0.85 + m.x234 == 0)
m.c235 = Constraint(expr=-(m.x488*m.x1822 + m.x741*m.x1316)**0.15*m.x1063**0.85 + m.x235 == 0)
m.c236 = Constraint(expr=-(m.x489*m.x1823 + m.x742*m.x1317)**0.15*m.x1064**0.85 + m.x236 == 0)
m.c237 = Constraint(expr=-(m.x490*m.x1824 + m.x743*m.x1318)**0.15*m.x1065**0.85 + m.x237 == 0)
m.c238 = Constraint(expr=-(m.x491*m.x1825 + m.x744*m.x1319)**0.15*m.x1066**0.85 + m.x238 == 0)
m.c239 = Constraint(expr=-(m.x492*m.x1826 + m.x745*m.x1320)**0.15*m.x1067**0.85 + m.x239 == 0)
m.c240 = Constraint(expr=-(m.x493*m.x1827 + m.x746*m.x1321)**0.15*m.x1068**0.85 + m.x240 == 0)
m.c241 = Constraint(expr=-(m.x494*m.x1828 + m.x747*m.x1322)**0.15*m.x1069**0.85 + m.x241 == 0)
m.c242 = Constraint(expr=-(m.x495*m.x1829 + m.x748*m.x1323)**0.15*m.x1070**0.85 + m.x242 == 0)
m.c243 = Constraint(expr=-(m.x496*m.x1830 + m.x749*m.x1324)**0.15*m.x1071**0.85 + m.x243 == 0)
m.c244 = Constraint(expr=-(m.x497*m.x1831 + m.x750*m.x1325)**0.15*m.x1072**0.85 + m.x244 == 0)
m.c245 = Constraint(expr=-(m.x498*m.x1832 + m.x751*m.x1326)**0.15*m.x1073**0.85 + m.x245 == 0)
m.c246 = Constraint(expr=-(m.x499*m.x1833 + m.x752*m.x1327)**0.15*m.x1074**0.85 + m.x246 == 0)
m.c247 = Constraint(expr=-(m.x500*m.x1834 + m.x753*m.x1328)**0.15*m.x1075**0.85 + m.x247 == 0)
m.c248 = Constraint(expr=-(m.x501*m.x1835 + m.x754*m.x1329)**0.15*m.x1076**0.85 + m.x248 == 0)
m.c249 = Constraint(expr=-(m.x502*m.x1836 + m.x755*m.x1330)**0.15*m.x1077**0.85 + m.x249 == 0)
m.c250 = Constraint(expr=-(m.x503*m.x1837 + m.x756*m.x1331)**0.15*m.x1078**0.85 + m.x250 == 0)
m.c251 = Constraint(expr=-(m.x504*m.x1838 + m.x757*m.x1332)**0.15*m.x1079**0.85 + m.x251 == 0)
m.c252 = Constraint(expr=-(m.x505*m.x1839 + m.x758*m.x1333)**0.15*m.x1080**0.85 + m.x252 == 0)
m.c253 = Constraint(expr=-(m.x506*m.x1840 + m.x759*m.x1334)**0.15*m.x1081**0.85 + m.x253 == 0)
m.c254 = Constraint(expr=-(m.x507*m.x1841 + m.x760*m.x1335)**0.15*m.x1082**0.85 + m.x254 == 0)
m.c255 = Constraint(expr=-5/(1 + 30*exp(-0.428021115708375*m.x1566)) + m.x1083 == 1)
m.c256 = Constraint(expr=-5/(1 + 30*exp(-0.384177028774859*m.x1567)) + m.x1084 == 1)
m.c257 = Constraint(expr=-5/(1 + 30*exp(-0.348719617803299*m.x1568)) + m.x1085 == 1)
m.c258 = Constraint(expr=-5/(1 + 30*exp(-0.315852644213053*m.x1569)) + m.x1086 == 1)
m.c259 = Constraint(expr=-5/(1 + 30*exp(-0.287290278096989*m.x1570)) + m.x1087 == 1)
m.c260 = Constraint(expr=-5/(1 + 30*exp(-0.263984583300335*m.x1571)) + m.x1088 == 1)
m.c261 = Constraint(expr=-5/(1 + 30*exp(-0.244552591034702*m.x1572)) + m.x1089 == 1)
m.c262 = Constraint(expr=-5/(1 + 30*exp(-0.231354736217042*m.x1573)) + m.x1090 == 1)
m.c263 = Constraint(expr=-5/(1 + 30*exp(-0.215586935431713*m.x1574)) + m.x1091 == 1)
m.c264 = Constraint(expr=-5/(1 + 30*exp(-0.201709148854628*m.x1575)) + m.x1092 == 1)
m.c265 = Constraint(expr=-5/(1 + 30*exp(-0.188732660186845*m.x1576)) + m.x1093 == 1)
m.c266 = Constraint(expr=-5/(1 + 30*exp(-0.180023403042396*m.x1577)) + m.x1094 == 1)
m.c267 = Constraint(expr=-5/(1 + 30*exp(-0.170725183671843*m.x1578)) + m.x1095 == 1)
m.c268 = Constraint(expr=-5/(1 + 30*exp(-0.161878655759643*m.x1579)) + m.x1096 == 1)
m.c269 = Constraint(expr=-5/(1 + 30*exp(-0.152435926099063*m.x1580)) + m.x1097 == 1)
m.c270 = Constraint(expr=-5/(1 + 30*exp(-0.144255042915875*m.x1581)) + m.x1098 == 1)
m.c271 = Constraint(expr=-5/(1 + 30*exp(-0.136318403438859*m.x1582)) + m.x1099 == 1)
m.c272 = Constraint(expr=-5/(1 + 30*exp(-0.128572714298572*m.x1583)) + m.x1100 == 1)
m.c273 = Constraint(expr=-5/(1 + 30*exp(-0.121464866287426*m.x1584)) + m.x1101 == 1)
m.c274 = Constraint(expr=-5/(1 + 30*exp(-0.114703014777572*m.x1585)) + m.x1102 == 1)
m.c275 = Constraint(expr=-5/(1 + 30*exp(-0.108466928433521*m.x1586)) + m.x1103 == 1)
m.c276 = Constraint(expr=-5/(1 + 30*exp(-0.102698576255405*m.x1587)) + m.x1104 == 1)
m.c277 = Constraint(expr=-5/(1 + 30*exp(-0.0973106577876098*m.x1588)) + m.x1105 == 1)
m.c278 = Constraint(expr=-5/(1 + 30*exp((-0.304878048780488*m.x1497) - 1.52439024390244*m.x1520 - 0.142673705236125*
m.x1566)) + m.x1106 == 1)
m.c279 = Constraint(expr=-5/(1 + 30*exp((-0.265639527161642*m.x1498) - 1.11086425238836*m.x1521 - 0.12805900959162*
m.x1567)) + m.x1107 == 1)
m.c280 = Constraint(expr=-5/(1 + 30*exp((-0.250018751406355*m.x1499) - 0.860067085232648*m.x1522 - 0.1162398726011*
m.x1568)) + m.x1108 == 1)
m.c281 = Constraint(expr=-5/(1 + 30*exp((-0.239354699729529*m.x1500) - 0.617360167921966*m.x1523 - 0.105284214737684*
m.x1569)) + m.x1109 == 1)
m.c282 = Constraint(expr=-5/(1 + 30*exp((-0.219216520156959*m.x1501) - 0.438962293139019*m.x1524 - 0.0957634260323297*
m.x1570)) + m.x1110 == 1)
m.c283 = Constraint(expr=-5/(1 + 30*exp((-0.201800056504016*m.x1502) - 0.310674785634398*m.x1525 - 0.0879948611001117*
m.x1571)) + m.x1111 == 1)
m.c284 = Constraint(expr=-5/(1 + 30*exp((-0.1874625074985*m.x1503) - 0.24152839166244*m.x1526 - 0.0815175303449007*
m.x1572)) + m.x1112 == 1)
m.c285 = Constraint(expr=-5/(1 + 30*exp((-0.176806520624481*m.x1504) - 0.193416115430738*m.x1527 - 0.0771182454056805*
m.x1573)) + m.x1113 == 1)
m.c286 = Constraint(expr=-5/(1 + 30*exp((-0.16583472910897*m.x1505) - 0.161326751201884*m.x1528 - 0.0718623118105709*
m.x1574)) + m.x1114 == 1)
m.c287 = Constraint(expr=-5/(1 + 30*exp((-0.156330607969734*m.x1506) - 0.135023831706296*m.x1529 - 0.0672363829515427*
m.x1575)) + m.x1115 == 1)
m.c288 = Constraint(expr=-5/(1 + 30*exp((-0.147789075431544*m.x1507) - 0.11568718186025*m.x1530 - 0.0629108867289484*
m.x1576)) + m.x1116 == 1)
m.c289 = Constraint(expr=-5/(1 + 30*exp((-0.142722575857049*m.x1508) - 0.0992812040824431*m.x1531 - 0.0600078010141318*
m.x1577)) + m.x1117 == 1)
m.c290 = Constraint(expr=-5/(1 + 30*exp((-0.134562336002153*m.x1509) - 0.0847034110063612*m.x1532 - 0.0569083945572811*
m.x1578)) + m.x1118 == 1)
m.c291 = Constraint(expr=-5/(1 + 30*exp((-0.127650340188157*m.x1510) - 0.072911805879608*m.x1533 - 0.0539595519198809*
m.x1579)) + m.x1119 == 1)
m.c292 = Constraint(expr=-5/(1 + 30*exp((-0.120595258194448*m.x1511) - 0.0622552590130051*m.x1534 - 0.0508119753663543*
m.x1580)) + m.x1120 == 1)
m.c293 = Constraint(expr=-5/(1 + 30*exp((-0.114420403446343*m.x1512) - 0.0534442122590334*m.x1535 - 0.0480850143052918*
m.x1581)) + m.x1121 == 1)
m.c294 = Constraint(expr=-5/(1 + 30*exp((-0.108685019943701*m.x1513) - 0.0459949865464664*m.x1536 - 0.045439467812953*
m.x1582)) + m.x1122 == 1)
m.c295 = Constraint(expr=-5/(1 + 30*exp((-0.103142759893969*m.x1514) - 0.039859693877551*m.x1537 - 0.0428575714328572*
m.x1583)) + m.x1123 == 1)
m.c296 = Constraint(expr=-5/(1 + 30*exp((-0.0979144227944776*m.x1515) - 0.0346597624419882*m.x1538 - 0.0404882887624755*
m.x1584)) + m.x1124 == 1)
m.c297 = Constraint(expr=-5/(1 + 30*exp((-0.0927721238322309*m.x1516) - 0.030389871663572*m.x1539 - 0.0382343382591906*
m.x1585)) + m.x1125 == 1)
m.c298 = Constraint(expr=-5/(1 + 30*exp((-0.0879221361562201*m.x1517) - 0.0269600640571122*m.x1540 - 0.0361556428111735*
m.x1586)) + m.x1126 == 1)
m.c299 = Constraint(expr=-5/(1 + 30*exp((-0.0834244049754315*m.x1518) - 0.0242323200992556*m.x1541 - 0.0342328587518015*
m.x1587)) + m.x1127 == 1)
m.c300 = Constraint(expr=-5/(1 + 30*exp((-0.0791176796366916*m.x1519) - 0.0214726824533828*m.x1542 - 0.0324368859292033*
m.x1588)) + m.x1128 == 1)
m.c301 = Constraint(expr=-5/(1 + 30*exp(-0.428021115708375*m.x1566)) + m.x1129 == 1)
m.c302 = Constraint(expr=-5/(1 + 30*exp(-0.384177028774859*m.x1567)) + m.x1130 == 1)
m.c303 = Constraint(expr=-5/(1 + 30*exp(-0.348719617803299*m.x1568)) + m.x1131 == 1)
m.c304 = Constraint(expr=-5/(1 + 30*exp(-0.315852644213053*m.x1569)) + m.x1132 == 1)
m.c305 = Constraint(expr=-5/(1 + 30*exp(-0.287290278096989*m.x1570)) + m.x1133 == 1)
m.c306 = Constraint(expr=-5/(1 + 30*exp(-0.263984583300335*m.x1571)) + m.x1134 == 1)
m.c307 = Constraint(expr=-5/(1 + 30*exp(-0.244552591034702*m.x1572)) + m.x1135 == 1)
m.c308 = Constraint(expr=-5/(1 + 30*exp(-0.231354736217042*m.x1573)) + m.x1136 == 1)
m.c309 = Constraint(expr=-5/(1 + 30*exp(-0.215586935431713*m.x1574)) + m.x1137 == 1)
m.c310 = Constraint(expr=-5/(1 + 30*exp(-0.201709148854628*m.x1575)) + m.x1138 == 1)
m.c311 = Constraint(expr=-5/(1 + 30*exp(-0.188732660186845*m.x1576)) + m.x1139 == 1)
m.c312 = Constraint(expr=-5/(1 + 30*exp(-0.180023403042396*m.x1577)) + m.x1140 == 1)
m.c313 = Constraint(expr=-5/(1 + 30*exp(-0.170725183671843*m.x1578)) + m.x1141 == 1)
m.c314 = Constraint(expr=-5/(1 + 30*exp(-0.161878655759643*m.x1579)) + m.x1142 == 1)
m.c315 = Constraint(expr=-5/(1 + 30*exp(-0.152435926099063*m.x1580)) + m.x1143 == 1)
m.c316 = Constraint(expr=-5/(1 + 30*exp(-0.144255042915875*m.x1581)) + m.x1144 == 1)
m.c317 = Constraint(expr=-5/(1 + 30*exp(-0.136318403438859*m.x1582)) + m.x1145 == 1)
m.c318 = Constraint(expr=-5/(1 + 30*exp(-0.128572714298572*m.x1583)) + m.x1146 == 1)
m.c319 = Constraint(expr=-5/(1 + 30*exp(-0.121464866287426*m.x1584)) + m.x1147 == 1)
m.c320 = Constraint(expr=-5/(1 + 30*exp(-0.114703014777572*m.x1585)) + m.x1148 == 1)
m.c321 = Constraint(expr=-5/(1 + 30*exp(-0.108466928433521*m.x1586)) + m.x1149 == 1)
m.c322 = Constraint(expr=-5/(1 + 30*exp(-0.102698576255405*m.x1587)) + m.x1150 == 1)
m.c323 = Constraint(expr=-5/(1 + 30*exp(-0.0973106577876098*m.x1588)) + m.x1151 == 1)
m.c324 = Constraint(expr=-5/(1 + 30*exp(-0.428021115708375*m.x1566)) + m.x1152 == 1)
m.c325 = Constraint(expr=-5/(1 + 30*exp(-0.384177028774859*m.x1567)) + m.x1153 == 1)
m.c326 = Constraint(expr=-5/(1 + 30*exp(-0.348719617803299*m.x1568)) + m.x1154 == 1)
m.c327 = Constraint(expr=-5/(1 + 30*exp(-0.315852644213053*m.x1569)) + m.x1155 == 1)
m.c328 = Constraint(expr=-5/(1 + 30*exp(-0.287290278096989*m.x1570)) + m.x1156 == 1)
m.c329 = Constraint(expr=-5/(1 + 30*exp(-0.263984583300335*m.x1571)) + m.x1157 == 1)
m.c330 = Constraint(expr=-5/(1 + 30*exp(-0.244552591034702*m.x1572)) + m.x1158 == 1)
m.c331 = Constraint(expr=-5/(1 + 30*exp(-0.231354736217042*m.x1573)) + m.x1159 == 1)
m.c332 = Constraint(expr=-5/(1 + 30*exp(-0.215586935431713*m.x1574)) + m.x1160 == 1)
m.c333 = Constraint(expr=-5/(1 + 30*exp(-0.201709148854628*m.x1575)) + m.x1161 == 1)
m.c334 = Constraint(expr=-5/(1 + 30*exp(-0.188732660186845*m.x1576)) + m.x1162 == 1)
m.c335 = Constraint(expr=-5/(1 + 30*exp(-0.180023403042396*m.x1577)) + m.x1163 == 1)
m.c336 = Constraint(expr=-5/(1 + 30*exp(-0.170725183671843*m.x1578)) + m.x1164 == 1)
m.c337 = Constraint(expr=-5/(1 + 30*exp(-0.161878655759643*m.x1579)) + m.x1165 == 1)
m.c338 = Constraint(expr=-5/(1 + 30*exp(-0.152435926099063*m.x1580)) + m.x1166 == 1)
m.c339 = Constraint(expr=-5/(1 + 30*exp(-0.144255042915875*m.x1581)) + m.x1167 == 1)
m.c340 = Constraint(expr=-5/(1 + 30*exp(-0.136318403438859*m.x1582)) + m.x1168 == 1)
m.c341 = Constraint(expr=-5/(1 + 30*exp(-0.128572714298572*m.x1583)) + m.x1169 == 1)
m.c342 = Constraint(expr=-5/(1 + 30*exp(-0.121464866287426*m.x1584)) + m.x1170 == 1)
m.c343 = Constraint(expr=-5/(1 + 30*exp(-0.114703014777572*m.x1585)) + m.x1171 == 1)
m.c344 = Constraint(expr=-5/(1 + 30*exp(-0.108466928433521*m.x1586)) + m.x1172 == 1)
m.c345 = Constraint(expr=-5/(1 + 30*exp(-0.102698576255405*m.x1587)) + m.x1173 == 1)
m.c346 = Constraint(expr=-5/(1 + 30*exp(-0.0973106577876098*m.x1588)) + m.x1174 == 1)
m.c347 = Constraint(expr=-5/(1 + 30*exp((-0.164826108455579*m.x1474) - 0.304878048780488*m.x1497 - 0.142673705236125*
m.x1566)) + m.x1175 == 1)
m.c348 = Constraint(expr=-5/(1 + 30*exp((-0.146901120855552*m.x1475) - 0.265639527161642*m.x1498 - 0.12805900959162*
m.x1567)) + m.x1176 == 1)
m.c349 = Constraint(expr=-5/(1 + 30*exp((-0.128834434867751*m.x1476) - 0.250018751406355*m.x1499 - 0.1162398726011*
m.x1568)) + m.x1177 == 1)
m.c350 = Constraint(expr=-5/(1 + 30*exp((-0.114914790682709*m.x1477) - 0.239354699729529*m.x1500 - 0.105284214737684*
m.x1569)) + m.x1178 == 1)
m.c351 = Constraint(expr=-5/(1 + 30*exp((-0.10354110581901*m.x1478) - 0.219216520156959*m.x1501 - 0.0957634260323297*
m.x1570)) + m.x1179 == 1)
m.c352 = Constraint(expr=-5/(1 + 30*exp((-0.0936276988184184*m.x1479) - 0.201800056504016*m.x1502 - 0.0879948611001117*
m.x1571)) + m.x1180 == 1)
m.c353 = Constraint(expr=-5/(1 + 30*exp((-0.085144063755875*m.x1480) - 0.1874625074985*m.x1503 - 0.0815175303449007*
m.x1572)) + m.x1181 == 1)
m.c354 = Constraint(expr=-5/(1 + 30*exp((-0.0790995309397815*m.x1481) - 0.176806520624481*m.x1504 - 0.0771182454056805*
m.x1573)) + m.x1182 == 1)
m.c355 = Constraint(expr=-5/(1 + 30*exp((-0.0735467168745587*m.x1482) - 0.16583472910897*m.x1505 - 0.0718623118105709*
m.x1574)) + m.x1183 == 1)
m.c356 = Constraint(expr=-5/(1 + 30*exp((-0.0682565901737813*m.x1483) - 0.156330607969734*m.x1506 - 0.0672363829515427*
m.x1575)) + m.x1184 == 1)
m.c357 = Constraint(expr=-5/(1 + 30*exp((-0.062785674820433*m.x1484) - 0.147789075431544*m.x1507 - 0.0629108867289484*
m.x1576)) + m.x1185 == 1)
m.c358 = Constraint(expr=-5/(1 + 30*exp((-0.0576880920240444*m.x1485) - 0.142722575857049*m.x1508 - 0.0600078010141318*
m.x1577)) + m.x1186 == 1)
m.c359 = Constraint(expr=-5/(1 + 30*exp((-0.052780754025852*m.x1486) - 0.134562336002153*m.x1509 - 0.0569083945572811*
m.x1578)) + m.x1187 == 1)
m.c360 = Constraint(expr=-5/(1 + 30*exp((-0.0486551710715815*m.x1487) - 0.127650340188157*m.x1510 - 0.0539595519198809*
m.x1579)) + m.x1188 == 1)
m.c361 = Constraint(expr=-5/(1 + 30*exp((-0.0448060792888379*m.x1488) - 0.120595258194448*m.x1511 - 0.0508119753663543*
m.x1580)) + m.x1189 == 1)
m.c362 = Constraint(expr=-5/(1 + 30*exp((-0.041430169449393*m.x1489) - 0.114420403446343*m.x1512 - 0.0480850143052918*
m.x1581)) + m.x1190 == 1)
m.c363 = Constraint(expr=-5/(1 + 30*exp((-0.0382078968081123*m.x1490) - 0.108685019943701*m.x1513 - 0.045439467812953*
m.x1582)) + m.x1191 == 1)
m.c364 = Constraint(expr=-5/(1 + 30*exp((-0.0352048216523735*m.x1491) - 0.103142759893969*m.x1514 - 0.0428575714328572*
m.x1583)) + m.x1192 == 1)
m.c365 = Constraint(expr=-5/(1 + 30*exp((-0.0324122842557329*m.x1492) - 0.0979144227944776*m.x1515 - 0.0404882887624755*
m.x1584)) + m.x1193 == 1)
m.c366 = Constraint(expr=-5/(1 + 30*exp((-0.0298043937637286*m.x1493) - 0.0927721238322309*m.x1516 - 0.0382343382591906*
m.x1585)) + m.x1194 == 1)
m.c367 = Constraint(expr=-5/(1 + 30*exp((-0.0274252114483803*m.x1494) - 0.0879221361562201*m.x1517 - 0.0361556428111735*
m.x1586)) + m.x1195 == 1)
m.c368 = Constraint(expr=-5/(1 + 30*exp((-0.0252400327110824*m.x1495) - 0.0834244049754315*m.x1518 - 0.0342328587518015*
m.x1587)) + m.x1196 == 1)
m.c369 = Constraint(expr=-5/(1 + 30*exp((-0.023232743299096*m.x1496) - 0.0791176796366916*m.x1519 - 0.0324368859292033*
m.x1588)) + m.x1197 == 1)
m.c370 = Constraint(expr=-5/(1 + 30*exp((-0.164826108455579*m.x1474) - 0.304878048780488*m.x1497 - 0.142673705236125*
m.x1566)) + m.x1198 == 1)
m.c371 = Constraint(expr=-5/(1 + 30*exp((-0.146901120855552*m.x1475) - 0.265639527161642*m.x1498 - 0.12805900959162*
m.x1567)) + m.x1199 == 1)
m.c372 = Constraint(expr=-5/(1 + 30*exp((-0.128834434867751*m.x1476) - 0.250018751406355*m.x1499 - 0.1162398726011*
m.x1568)) + m.x1200 == 1)
m.c373 = Constraint(expr=-5/(1 + 30*exp((-0.114914790682709*m.x1477) - 0.239354699729529*m.x1500 - 0.105284214737684*
m.x1569)) + m.x1201 == 1)
m.c374 = Constraint(expr=-5/(1 + 30*exp((-0.10354110581901*m.x1478) - 0.219216520156959*m.x1501 - 0.0957634260323297*
m.x1570)) + m.x1202 == 1)
m.c375 = Constraint(expr=-5/(1 + 30*exp((-0.0936276988184184*m.x1479) - 0.201800056504016*m.x1502 - 0.0879948611001117*
m.x1571)) + m.x1203 == 1)
m.c376 = Constraint(expr=-5/(1 + 30*exp((-0.085144063755875*m.x1480) - 0.1874625074985*m.x1503 - 0.0815175303449007*
m.x1572)) + m.x1204 == 1)
m.c377 = Constraint(expr=-5/(1 + 30*exp((-0.0790995309397815*m.x1481) - 0.176806520624481*m.x1504 - 0.0771182454056805*
m.x1573)) + m.x1205 == 1)
m.c378 = Constraint(expr=-5/(1 + 30*exp((-0.0735467168745587*m.x1482) - 0.16583472910897*m.x1505 - 0.0718623118105709*
m.x1574)) + m.x1206 == 1)
m.c379 = Constraint(expr=-5/(1 + 30*exp((-0.0682565901737813*m.x1483) - 0.156330607969734*m.x1506 - 0.0672363829515427*
m.x1575)) + m.x1207 == 1)
m.c380 = Constraint(expr=-5/(1 + 30*exp((-0.062785674820433*m.x1484) - 0.147789075431544*m.x1507 - 0.0629108867289484*
m.x1576)) + m.x1208 == 1)
m.c381 = Constraint(expr=-5/(1 + 30*exp((-0.0576880920240444*m.x1485) - 0.142722575857049*m.x1508 - 0.0600078010141318*
m.x1577)) + m.x1209 == 1)
m.c382 = Constraint(expr=-5/(1 + 30*exp((-0.052780754025852*m.x1486) - 0.134562336002153*m.x1509 - 0.0569083945572811*
m.x1578)) + m.x1210 == 1)
m.c383 = Constraint(expr=-5/(1 + 30*exp((-0.0486551710715815*m.x1487) - 0.127650340188157*m.x1510 - 0.0539595519198809*
m.x1579)) + m.x1211 == 1)
m.c384 = Constraint(expr=-5/(1 + 30*exp((-0.0448060792888379*m.x1488) - 0.120595258194448*m.x1511 - 0.0508119753663543*
m.x1580)) + m.x1212 == 1)
m.c385 = Constraint(expr=-5/(1 + 30*exp((-0.041430169449393*m.x1489) - 0.114420403446343*m.x1512 - 0.0480850143052918*
m.x1581)) + m.x1213 == 1)
m.c386 = Constraint(expr=-5/(1 + 30*exp((-0.0382078968081123*m.x1490) - 0.108685019943701*m.x1513 - 0.045439467812953*
m.x1582)) + m.x1214 == 1)
m.c387 = Constraint(expr=-5/(1 + 30*exp((-0.0352048216523735*m.x1491) - 0.103142759893969*m.x1514 - 0.0428575714328572*
m.x1583)) + m.x1215 == 1)
m.c388 = Constraint(expr=-5/(1 + 30*exp((-0.0324122842557329*m.x1492) - 0.0979144227944776*m.x1515 - 0.0404882887624755*
m.x1584)) + m.x1216 == 1)
m.c389 = Constraint(expr=-5/(1 + 30*exp((-0.0298043937637286*m.x1493) - 0.0927721238322309*m.x1516 - 0.0382343382591906*
m.x1585)) + m.x1217 == 1)
m.c390 = Constraint(expr=-5/(1 + 30*exp((-0.0274252114483803*m.x1494) - 0.0879221361562201*m.x1517 - 0.0361556428111735*
m.x1586)) + m.x1218 == 1)
m.c391 = Constraint(expr=-5/(1 + 30*exp((-0.0252400327110824*m.x1495) - 0.0834244049754315*m.x1518 - 0.0342328587518015*
m.x1587)) + m.x1219 == 1)
m.c392 = Constraint(expr=-5/(1 + 30*exp((-0.023232743299096*m.x1496) - 0.0791176796366916*m.x1519 - 0.0324368859292033*
m.x1588)) + m.x1220 == 1)
m.c393 = Constraint(expr=-5/(1 + 30*exp((-0.457317073170732*m.x1497) - 0.214010557854187*m.x1566)) + m.x1221 == 1)
m.c394 = Constraint(expr=-5/(1 + 30*exp((-0.398459290742462*m.x1498) - 0.19208851438743*m.x1567)) + m.x1222 == 1)
m.c395 = Constraint(expr=-5/(1 + 30*exp((-0.375028127109533*m.x1499) - 0.174359808901649*m.x1568)) + m.x1223 == 1)
m.c396 = Constraint(expr=-5/(1 + 30*exp((-0.359032049594294*m.x1500) - 0.157926322106527*m.x1569)) + m.x1224 == 1)
m.c397 = Constraint(expr=-5/(1 + 30*exp((-0.328824780235439*m.x1501) - 0.143645139048495*m.x1570)) + m.x1225 == 1)
m.c398 = Constraint(expr=-5/(1 + 30*exp((-0.302700084756024*m.x1502) - 0.131992291650168*m.x1571)) + m.x1226 == 1)
m.c399 = Constraint(expr=-5/(1 + 30*exp((-0.28119376124775*m.x1503) - 0.122276295517351*m.x1572)) + m.x1227 == 1)
m.c400 = Constraint(expr=-5/(1 + 30*exp((-0.265209780936721*m.x1504) - 0.115677368108521*m.x1573)) + m.x1228 == 1)
m.c401 = Constraint(expr=-5/(1 + 30*exp((-0.248752093663455*m.x1505) - 0.107793467715856*m.x1574)) + m.x1229 == 1)
m.c402 = Constraint(expr=-5/(1 + 30*exp((-0.234495911954602*m.x1506) - 0.100854574427314*m.x1575)) + m.x1230 == 1)
m.c403 = Constraint(expr=-5/(1 + 30*exp((-0.221683613147316*m.x1507) - 0.0943663300934227*m.x1576)) + m.x1231 == 1)
m.c404 = Constraint(expr=-5/(1 + 30*exp((-0.214083863785574*m.x1508) - 0.0900117015211978*m.x1577)) + m.x1232 == 1)
m.c405 = Constraint(expr=-5/(1 + 30*exp((-0.20184350400323*m.x1509) - 0.0853625918359217*m.x1578)) + m.x1233 == 1)
m.c406 = Constraint(expr=-5/(1 + 30*exp((-0.191475510282235*m.x1510) - 0.0809393278798213*m.x1579)) + m.x1234 == 1)
m.c407 = Constraint(expr=-5/(1 + 30*exp((-0.180892887291672*m.x1511) - 0.0762179630495315*m.x1580)) + m.x1235 == 1)
m.c408 = Constraint(expr=-5/(1 + 30*exp((-0.171630605169514*m.x1512) - 0.0721275214579376*m.x1581)) + m.x1236 == 1)
m.c409 = Constraint(expr=-5/(1 + 30*exp((-0.163027529915552*m.x1513) - 0.0681592017194295*m.x1582)) + m.x1237 == 1)
m.c410 = Constraint(expr=-5/(1 + 30*exp((-0.154714139840954*m.x1514) - 0.0642863571492858*m.x1583)) + m.x1238 == 1)
m.c411 = Constraint(expr=-5/(1 + 30*exp((-0.146871634191716*m.x1515) - 0.0607324331437132*m.x1584)) + m.x1239 == 1)
m.c412 = Constraint(expr=-5/(1 + 30*exp((-0.139158185748346*m.x1516) - 0.0573515073887859*m.x1585)) + m.x1240 == 1)
m.c413 = Constraint(expr=-5/(1 + 30*exp((-0.13188320423433*m.x1517) - 0.0542334642167603*m.x1586)) + m.x1241 == 1)
m.c414 = Constraint(expr=-5/(1 + 30*exp((-0.125136607463147*m.x1518) - 0.0513492881277023*m.x1587)) + m.x1242 == 1)
m.c415 = Constraint(expr=-5/(1 + 30*exp((-0.118676519455037*m.x1519) - 0.0486553288938049*m.x1588)) + m.x1243 == 1)
m.c416 = Constraint(expr=-5/(1 + 30*exp(-0.914634146341463*m.x1497)) + m.x1244 == 1)
m.c417 = Constraint(expr=-5/(1 + 30*exp(-0.796918581484925*m.x1498)) + m.x1245 == 1)
m.c418 = Constraint(expr=-5/(1 + 30*exp(-0.750056254219067*m.x1499)) + m.x1246 == 1)
m.c419 = Constraint(expr=-5/(1 + 30*exp(-0.718064099188588*m.x1500)) + m.x1247 == 1)
m.c420 = Constraint(expr=-5/(1 + 30*exp(-0.657649560470877*m.x1501)) + m.x1248 == 1)
m.c421 = Constraint(expr=-5/(1 + 30*exp(-0.605400169512047*m.x1502)) + m.x1249 == 1)
m.c422 = Constraint(expr=-5/(1 + 30*exp(-0.562387522495501*m.x1503)) + m.x1250 == 1)
m.c423 = Constraint(expr=-5/(1 + 30*exp(-0.530419561873442*m.x1504)) + m.x1251 == 1)
m.c424 = Constraint(expr=-5/(1 + 30*exp(-0.49750418732691*m.x1505)) + m.x1252 == 1)
m.c425 = Constraint(expr=-5/(1 + 30*exp(-0.468991823909203*m.x1506)) + m.x1253 == 1)
m.c426 = Constraint(expr=-5/(1 + 30*exp(-0.443367226294632*m.x1507)) + m.x1254 == 1)
m.c427 = Constraint(expr=-5/(1 + 30*exp(-0.428167727571147*m.x1508)) + m.x1255 == 1)
m.c428 = Constraint(expr=-5/(1 + 30*exp(-0.403687008006459*m.x1509)) + m.x1256 == 1)
m.c429 = Constraint(expr=-5/(1 + 30*exp(-0.38295102056447*m.x1510)) + m.x1257 == 1)
m.c430 = Constraint(expr=-5/(1 + 30*exp(-0.361785774583343*m.x1511)) + m.x1258 == 1)
m.c431 = Constraint(expr=-5/(1 + 30*exp(-0.343261210339028*m.x1512)) + m.x1259 == 1)
m.c432 = Constraint(expr=-5/(1 + 30*exp(-0.326055059831103*m.x1513)) + m.x1260 == 1)
m.c433 = Constraint(expr=-5/(1 + 30*exp(-0.309428279681908*m.x1514)) + m.x1261 == 1)
m.c434 = Constraint(expr=-5/(1 + 30*exp(-0.293743268383433*m.x1515)) + m.x1262 == 1)
m.c435 = Constraint(expr=-5/(1 + 30*exp(-0.278316371496693*m.x1516)) + m.x1263 == 1)
m.c436 = Constraint(expr=-5/(1 + 30*exp(-0.26376640846866*m.x1517)) + m.x1264 == 1)
m.c437 = Constraint(expr=-5/(1 + 30*exp(-0.250273214926295*m.x1518)) + m.x1265 == 1)
m.c438 = Constraint(expr=-5/(1 + 30*exp(-0.237353038910075*m.x1519)) + m.x1266 == 1)
m.c439 = Constraint(expr=-5/(1 + 30*exp((-0.457317073170732*m.x1497) - 0.214010557854187*m.x1566)) + m.x1267 == 1)
m.c440 = Constraint(expr=-5/(1 + 30*exp((-0.398459290742462*m.x1498) - 0.19208851438743*m.x1567)) + m.x1268 == 1)
m.c441 = Constraint(expr=-5/(1 + 30*exp((-0.375028127109533*m.x1499) - 0.174359808901649*m.x1568)) + m.x1269 == 1)
m.c442 = Constraint(expr=-5/(1 + 30*exp((-0.359032049594294*m.x1500) - 0.157926322106527*m.x1569)) + m.x1270 == 1)
m.c443 = Constraint(expr=-5/(1 + 30*exp((-0.328824780235439*m.x1501) - 0.143645139048495*m.x1570)) + m.x1271 == 1)
m.c444 = Constraint(expr=-5/(1 + 30*exp((-0.302700084756024*m.x1502) - 0.131992291650168*m.x1571)) + m.x1272 == 1)
m.c445 = Constraint(expr=-5/(1 + 30*exp((-0.28119376124775*m.x1503) - 0.122276295517351*m.x1572)) + m.x1273 == 1)
m.c446 = Constraint(expr=-5/(1 + 30*exp((-0.265209780936721*m.x1504) - 0.115677368108521*m.x1573)) + m.x1274 == 1)
m.c447 = Constraint(expr=-5/(1 + 30*exp((-0.248752093663455*m.x1505) - 0.107793467715856*m.x1574)) + m.x1275 == 1)
m.c448 = Constraint(expr=-5/(1 + 30*exp((-0.234495911954602*m.x1506) - 0.100854574427314*m.x1575)) + m.x1276 == 1)
m.c449 = Constraint(expr=-5/(1 + 30*exp((-0.221683613147316*m.x1507) - 0.0943663300934227*m.x1576)) + m.x1277 == 1)
m.c450 = Constraint(expr=-5/(1 + 30*exp((-0.214083863785574*m.x1508) - 0.0900117015211978*m.x1577)) + m.x1278 == 1)
m.c451 = Constraint(expr=-5/(1 + 30*exp((-0.20184350400323*m.x1509) - 0.0853625918359217*m.x1578)) + m.x1279 == 1)
m.c452 = Constraint(expr=-5/(1 + 30*exp((-0.191475510282235*m.x1510) - 0.0809393278798213*m.x1579)) + m.x1280 == 1)
m.c453 = Constraint(expr=-5/(1 + 30*exp((-0.180892887291672*m.x1511) - 0.0762179630495315*m.x1580)) + m.x1281 == 1)
m.c454 = Constraint(expr=-5/(1 + 30*exp((-0.171630605169514*m.x1512) - 0.0721275214579376*m.x1581)) + m.x1282 == 1)
m.c455 = Constraint(expr=-5/(1 + 30*exp((-0.163027529915552*m.x1513) - 0.0681592017194295*m.x1582)) + m.x1283 == 1)
m.c456 = Constraint(expr=-5/(1 + 30*exp((-0.154714139840954*m.x1514) - 0.0642863571492858*m.x1583)) + m.x1284 == 1)
m.c457 = Constraint(expr=-5/(1 + 30*exp((-0.146871634191716*m.x1515) - 0.0607324331437132*m.x1584)) + m.x1285 == 1)
m.c458 = Constraint(expr=-5/(1 + 30*exp((-0.139158185748346*m.x1516) - 0.0573515073887859*m.x1585)) + m.x1286 == 1)
m.c459 = Constraint(expr=-5/(1 + 30*exp((-0.13188320423433*m.x1517) - 0.0542334642167603*m.x1586)) + m.x1287 == 1)
m.c460 = Constraint(expr=-5/(1 + 30*exp((-0.125136607463147*m.x1518) - 0.0513492881277023*m.x1587)) + m.x1288 == 1)
m.c461 = Constraint(expr=-5/(1 + 30*exp((-0.118676519455037*m.x1519) - 0.0486553288938049*m.x1588)) + m.x1289 == 1)
m.c462 = Constraint(expr=-5/(1 + 30*exp((-1.58227848101266*m.x1359) - 0.228658536585366*m.x1497 - 1.14329268292683*
m.x1520 - 0.107005278927094*m.x1566)) + m.x1290 == 1)
m.c463 = Constraint(expr=-5/(1 + 30*exp((-1.00590128755365*m.x1360) - 0.199229645371231*m.x1498 - 0.833148189291269*
m.x1521 - 0.0960442571937149*m.x1567)) + m.x1291 == 1)
m.c464 = Constraint(expr=-5/(1 + 30*exp((-0.682004182958989*m.x1361) - 0.187514063554767*m.x1499 - 0.645050313924486*
m.x1522 - 0.0871799044508247*m.x1568)) + m.x1292 == 1)
m.c465 = Constraint(expr=-5/(1 + 30*exp((-0.439084362742228*m.x1362) - 0.179516024797147*m.x1500 - 0.463020125941474*
m.x1523 - 0.0789631610532633*m.x1569)) + m.x1293 == 1)
m.c466 = Constraint(expr=-5/(1 + 30*exp((-0.274453836864639*m.x1363) - 0.164412390117719*m.x1501 - 0.329221719854265*
m.x1524 - 0.0718225695242473*m.x1570)) + m.x1294 == 1)
m.c467 = Constraint(expr=-5/(1 + 30*exp((-0.171448165504629*m.x1364) - 0.151350042378012*m.x1502 - 0.233006089225798*
m.x1525 - 0.0659961458250838*m.x1571)) + m.x1295 == 1)
m.c468 = Constraint(expr=-5/(1 + 30*exp((-0.125493608192223*m.x1365) - 0.140596880623875*m.x1503 - 0.18114629374683*
m.x1526 - 0.0611381477586755*m.x1572)) + m.x1296 == 1)
m.c469 = Constraint(expr=-5/(1 + 30*exp((-0.102471615362545*m.x1366) - 0.13260489046836*m.x1504 - 0.145062086573053*
m.x1527 - 0.0578386840542604*m.x1573)) + m.x1297 == 1)
m.c470 = Constraint(expr=-5/(1 + 30*exp((-0.0878220140515222*m.x1367) - 0.124376046831728*m.x1505 - 0.120995063401413*
m.x1528 - 0.0538967338579282*m.x1574)) + m.x1298 == 1)
m.c471 = Constraint(expr=-5/(1 + 30*exp((-0.0770637676989786*m.x1368) - 0.117247955977301*m.x1506 - 0.101267873779722*
m.x1529 - 0.0504272872136571*m.x1575)) + m.x1299 == 1)
m.c472 = Constraint(expr=-5/(1 + 30*exp((-0.0673570010866929*m.x1369) - 0.110841806573658*m.x1507 - 0.0867653863951874*
m.x1530 - 0.0471831650467113*m.x1576)) + m.x1300 == 1)
m.c473 = Constraint(expr=-5/(1 + 30*exp((-0.0594191186956315*m.x1370) - 0.107041931892787*m.x1508 - 0.0744609030618323*
m.x1531 - 0.0450058507605989*m.x1577)) + m.x1301 == 1)
m.c474 = Constraint(expr=-5/(1 + 30*exp((-0.0524332524696062*m.x1371) - 0.100921752001615*m.x1509 - 0.0635275582547709*
m.x1532 - 0.0426812959179609*m.x1578)) + m.x1302 == 1)
m.c475 = Constraint(expr=-5/(1 + 30*exp((-0.0464519965068099*m.x1372) - 0.0957377551411175*m.x1510 - 0.054683854409706*
m.x1533 - 0.0404696639399106*m.x1579)) + m.x1303 == 1)
m.c476 = Constraint(expr=-5/(1 + 30*exp((-0.0406182641378638*m.x1373) - 0.0904464436458358*m.x1511 - 0.0466914442597538*
m.x1534 - 0.0381089815247658*m.x1580)) + m.x1304 == 1)
m.c477 = Constraint(expr=-5/(1 + 30*exp((-0.0354184572664507*m.x1374) - 0.0858153025847569*m.x1512 - 0.0400831591942751*
m.x1535 - 0.0360637607289688*m.x1581)) + m.x1305 == 1)
m.c478 = Constraint(expr=-5/(1 + 30*exp((-0.0307745334580728*m.x1375) - 0.0815137649577759*m.x1513 - 0.0344962399098498*
m.x1536 - 0.0340796008597147*m.x1582)) + m.x1306 == 1)
m.c479 = Constraint(expr=-5/(1 + 30*exp((-0.0265639056733419*m.x1376) - 0.0773570699204769*m.x1514 - 0.0298947704081633*
m.x1537 - 0.0321431785746429*m.x1583)) + m.x1307 == 1)
m.c480 = Constraint(expr=-5/(1 + 30*exp((-0.022768808553786*m.x1377) - 0.0734358170958582*m.x1515 - 0.0259948218314912*
m.x1538 - 0.0303662165718566*m.x1584)) + m.x1308 == 1)
m.c481 = Constraint(expr=-5/(1 + 30*exp((-0.0195025041215292*m.x1378) - 0.0695790928741732*m.x1516 - 0.022792403747679*
m.x1539 - 0.0286757536943929*m.x1585)) + m.x1309 == 1)
m.c482 = Constraint(expr=-5/(1 + 30*exp((-0.0168000215040275*m.x1379) - 0.065941602117165*m.x1517 - 0.0202200480428342*
m.x1540 - 0.0271167321083802*m.x1586)) + m.x1310 == 1)
m.c483 = Constraint(expr=-5/(1 + 30*exp((-0.0144005068978428*m.x1380) - 0.0625683037315736*m.x1518 - 0.0181742400744417*
m.x1541 - 0.0256746440638511*m.x1587)) + m.x1311 == 1)
m.c484 = Constraint(expr=-5/(1 + 30*exp((-0.0123410270038126*m.x1381) - 0.0593382597275187*m.x1519 - 0.0161045118400371*
m.x1542 - 0.0243276644469024*m.x1588)) + m.x1312 == 1)
m.c485 = Constraint(expr=-5/(1 + 30*exp((-0.247239162683369*m.x1474) - 0.457317073170732*m.x1497)) + m.x1313 == 1)
m.c486 = Constraint(expr=-5/(1 + 30*exp((-0.220351681283328*m.x1475) - 0.398459290742462*m.x1498)) + m.x1314 == 1)
m.c487 = Constraint(expr=-5/(1 + 30*exp((-0.193251652301627*m.x1476) - 0.375028127109533*m.x1499)) + m.x1315 == 1)
m.c488 = Constraint(expr=-5/(1 + 30*exp((-0.172372186024063*m.x1477) - 0.359032049594294*m.x1500)) + m.x1316 == 1)
m.c489 = Constraint(expr=-5/(1 + 30*exp((-0.155311658728515*m.x1478) - 0.328824780235439*m.x1501)) + m.x1317 == 1)
m.c490 = Constraint(expr=-5/(1 + 30*exp((-0.140441548227628*m.x1479) - 0.302700084756024*m.x1502)) + m.x1318 == 1)
m.c491 = Constraint(expr=-5/(1 + 30*exp((-0.127716095633812*m.x1480) - 0.28119376124775*m.x1503)) + m.x1319 == 1)
m.c492 = Constraint(expr=-5/(1 + 30*exp((-0.118649296409672*m.x1481) - 0.265209780936721*m.x1504)) + m.x1320 == 1)
m.c493 = Constraint(expr=-5/(1 + 30*exp((-0.110320075311838*m.x1482) - 0.248752093663455*m.x1505)) + m.x1321 == 1)
m.c494 = Constraint(expr=-5/(1 + 30*exp((-0.102384885260672*m.x1483) - 0.234495911954602*m.x1506)) + m.x1322 == 1)
m.c495 = Constraint(expr=-5/(1 + 30*exp((-0.0941785122306495*m.x1484) - 0.221683613147316*m.x1507)) + m.x1323 == 1)
m.c496 = Constraint(expr=-5/(1 + 30*exp((-0.0865321380360666*m.x1485) - 0.214083863785574*m.x1508)) + m.x1324 == 1)
m.c497 = Constraint(expr=-5/(1 + 30*exp((-0.079171131038778*m.x1486) - 0.20184350400323*m.x1509)) + m.x1325 == 1)
m.c498 = Constraint(expr=-5/(1 + 30*exp((-0.0729827566073722*m.x1487) - 0.191475510282235*m.x1510)) + m.x1326 == 1)
m.c499 = Constraint(expr=-5/(1 + 30*exp((-0.0672091189332569*m.x1488) - 0.180892887291672*m.x1511)) + m.x1327 == 1)
m.c500 = Constraint(expr=-5/(1 + 30*exp((-0.0621452541740896*m.x1489) - 0.171630605169514*m.x1512)) + m.x1328 == 1)
m.c501 = Constraint(expr=-5/(1 + 30*exp((-0.0573118452121685*m.x1490) - 0.163027529915552*m.x1513)) + m.x1329 == 1)
m.c502 = Constraint(expr=-5/(1 + 30*exp((-0.0528072324785603*m.x1491) - 0.154714139840954*m.x1514)) + m.x1330 == 1)
m.c503 = Constraint(expr=-5/(1 + 30*exp((-0.0486184263835994*m.x1492) - 0.146871634191716*m.x1515)) + m.x1331 == 1)
m.c504 = Constraint(expr=-5/(1 + 30*exp((-0.044706590645593*m.x1493) - 0.139158185748346*m.x1516)) + m.x1332 == 1)
m.c505 = Constraint(expr=-5/(1 + 30*exp((-0.0411378171725704*m.x1494) - 0.13188320423433*m.x1517)) + m.x1333 == 1)
m.c506 = Constraint(expr=-5/(1 + 30*exp((-0.0378600490666236*m.x1495) - 0.125136607463147*m.x1518)) + m.x1334 == 1)
m.c507 = Constraint(expr=-5/(1 + 30*exp((-0.034849114948644*m.x1496) - 0.118676519455037*m.x1519)) + m.x1335 == 1)
m.c508 = Constraint(expr= - 5*m.x508 - 0.5*m.x1336 + m.x1337 == 0)
m.c509 = Constraint(expr= - 5*m.x509 - 0.5*m.x1337 + m.x1338 == 0)
m.c510 = Constraint(expr= - 5*m.x510 - 0.5*m.x1338 + m.x1339 == 0)
m.c511 = Constraint(expr= - 5*m.x511 - 0.5*m.x1339 + m.x1340 == 0)
m.c512 = Constraint(expr= - 5*m.x512 - 0.5*m.x1340 + m.x1341 == 0)
m.c513 = Constraint(expr= - 5*m.x513 - 0.5*m.x1341 + m.x1342 == 0)
m.c514 = Constraint(expr= - 5*m.x514 - 0.5*m.x1342 + m.x1343 == 0)
m.c515 = Constraint(expr= - 5*m.x515 - 0.5*m.x1343 + m.x1344 == 0)
m.c516 = Constraint(expr= - 5*m.x516 - 0.5*m.x1344 + m.x1345 == 0)
m.c517 = Constraint(expr= - 5*m.x517 - 0.5*m.x1345 + m.x1346 == 0)
m.c518 = Constraint(expr= - 5*m.x518 - 0.5*m.x1346 + m.x1347 == 0)
m.c519 = Constraint(expr= - 5*m.x519 - 0.5*m.x1347 + m.x1348 == 0)
m.c520 = Constraint(expr= - 5*m.x520 - 0.5*m.x1348 + m.x1349 == 0)
m.c521 = Constraint(expr= - 5*m.x521 - 0.5*m.x1349 + m.x1350 == 0)
m.c522 = Constraint(expr= - 5*m.x522 - 0.5*m.x1350 + m.x1351 == 0)
m.c523 = Constraint(expr= - 5*m.x523 - 0.5*m.x1351 + m.x1352 == 0)
m.c524 = Constraint(expr= - 5*m.x524 - 0.5*m.x1352 + m.x1353 == 0)
m.c525 = Constraint(expr= - 5*m.x525 - 0.5*m.x1353 + m.x1354 == 0)
m.c526 = Constraint(expr= - 5*m.x526 - 0.5*m.x1354 + m.x1355 == 0)
m.c527 = Constraint(expr= - 5*m.x527 - 0.5*m.x1355 + m.x1356 == 0)
m.c528 = Constraint(expr= - 5*m.x528 - 0.5*m.x1356 + m.x1357 == 0)
m.c529 = Constraint(expr= - 5*m.x529 - 0.5*m.x1357 + m.x1358 == 0)
m.c530 = Constraint(expr= - 5*m.x531 - 0.5*m.x1359 + m.x1360 == 0)
m.c531 = Constraint(expr= - 5*m.x532 - 0.5*m.x1360 + m.x1361 == 0)
m.c532 = Constraint(expr= - 5*m.x533 - 0.5*m.x1361 + m.x1362 == 0)
m.c533 = Constraint(expr= - 5*m.x534 - 0.5*m.x1362 + m.x1363 == 0)
m.c534 = Constraint(expr= - 5*m.x535 - 0.5*m.x1363 + m.x1364 == 0)
m.c535 = Constraint(expr= - 5*m.x536 - 0.5*m.x1364 + m.x1365 == 0)
m.c536 = Constraint(expr= - 5*m.x537 - 0.5*m.x1365 + m.x1366 == 0)
m.c537 = Constraint(expr= - 5*m.x538 - 0.5*m.x1366 + m.x1367 == 0)
m.c538 = Constraint(expr= - 5*m.x539 - 0.5*m.x1367 + m.x1368 == 0)
m.c539 = Constraint(expr= - 5*m.x540 - 0.5*m.x1368 + m.x1369 == 0)
m.c540 = Constraint(expr= - 5*m.x541 - 0.5*m.x1369 + m.x1370 == 0)
m.c541 = Constraint(expr= - 5*m.x542 - 0.5*m.x1370 + m.x1371 == 0)
m.c542 = Constraint(expr= - 5*m.x543 - 0.5*m.x1371 + m.x1372 == 0)
m.c543 = Constraint(expr= - 5*m.x544 - 0.5*m.x1372 + m.x1373 == 0)
m.c544 = Constraint(expr= - 5*m.x545 - 0.5*m.x1373 + m.x1374 == 0)
m.c545 = Constraint(expr= - 5*m.x546 - 0.5*m.x1374 + m.x1375 == 0)
m.c546 = Constraint(expr= - 5*m.x547 - 0.5*m.x1375 + m.x1376 == 0)
m.c547 = Constraint(expr= - 5*m.x548 - 0.5*m.x1376 + m.x1377 == 0)
m.c548 = Constraint(expr= - 5*m.x549 - 0.5*m.x1377 + m.x1378 == 0)
m.c549 = Constraint(expr= - 5*m.x550 - 0.5*m.x1378 + m.x1379 == 0)
m.c550 = Constraint(expr= - 5*m.x551 - 0.5*m.x1379 + m.x1380 == 0)
m.c551 = Constraint(expr= - 5*m.x552 - 0.5*m.x1380 + m.x1381 == 0)
m.c552 = Constraint(expr= - 5*m.x554 - 0.5*m.x1382 + m.x1383 == 0)
m.c553 = Constraint(expr= - 5*m.x555 - 0.5*m.x1383 + m.x1384 == 0)
m.c554 = Constraint(expr= - 5*m.x556 - 0.5*m.x1384 + m.x1385 == 0)
m.c555 = Constraint(expr= - 5*m.x557 - 0.5*m.x1385 + m.x1386 == 0)
m.c556 = Constraint(expr= - 5*m.x558 - 0.5*m.x1386 + m.x1387 == 0)
m.c557 = Constraint(expr= - 5*m.x559 - 0.5*m.x1387 + m.x1388 == 0)
m.c558 = Constraint(expr= - 5*m.x560 - 0.5*m.x1388 + m.x1389 == 0)
m.c559 = Constraint(expr= - 5*m.x561 - 0.5*m.x1389 + m.x1390 == 0)
m.c560 = Constraint(expr= - 5*m.x562 - 0.5*m.x1390 + m.x1391 == 0)
m.c561 = Constraint(expr= - 5*m.x563 - 0.5*m.x1391 + m.x1392 == 0)
m.c562 = Constraint(expr= - 5*m.x564 - 0.5*m.x1392 + m.x1393 == 0)
m.c563 = Constraint(expr= - 5*m.x565 - 0.5*m.x1393 + m.x1394 == 0)
m.c564 = Constraint(expr= - 5*m.x566 - 0.5*m.x1394 + m.x1395 == 0)
m.c565 = Constraint(expr= - 5*m.x567 - 0.5*m.x1395 + m.x1396 == 0)
m.c566 = Constraint(expr= - 5*m.x568 - 0.5*m.x1396 + m.x1397 == 0)
m.c567 = Constraint(expr= - 5*m.x569 - 0.5*m.x1397 + m.x1398 == 0)
m.c568 = Constraint(expr= - 5*m.x570 - 0.5*m.x1398 + m.x1399 == 0)
m.c569 = Constraint(expr= - 5*m.x571 - 0.5*m.x1399 + m.x1400 == 0)
m.c570 = Constraint(expr= - 5*m.x572 - 0.5*m.x1400 + m.x1401 == 0)
m.c571 = Constraint(expr= - 5*m.x573 - 0.5*m.x1401 + m.x1402 == 0)
m.c572 = Constraint(expr= - 5*m.x574 - 0.5*m.x1402 + m.x1403 == 0)
m.c573 = Constraint(expr= - 5*m.x575 - 0.5*m.x1403 + m.x1404 == 0)
m.c574 = Constraint(expr= - 5*m.x577 - 0.5*m.x1405 + m.x1406 == 0)
m.c575 = Constraint(expr= - 5*m.x578 - 0.5*m.x1406 + m.x1407 == 0)
m.c576 = Constraint(expr= - 5*m.x579 - 0.5*m.x1407 + m.x1408 == 0)
m.c577 = Constraint(expr= - 5*m.x580 - 0.5*m.x1408 + m.x1409 == 0)
m.c578 = Constraint(expr= - 5*m.x581 - 0.5*m.x1409 + m.x1410 == 0)
m.c579 = Constraint(expr= - 5*m.x582 - 0.5*m.x1410 + m.x1411 == 0)
m.c580 = Constraint(expr= - 5*m.x583 - 0.5*m.x1411 + m.x1412 == 0)
m.c581 = Constraint(expr= - 5*m.x584 - 0.5*m.x1412 + m.x1413 == 0)
m.c582 = Constraint(expr= - 5*m.x585 - 0.5*m.x1413 + m.x1414 == 0)
m.c583 = Constraint(expr= - 5*m.x586 - 0.5*m.x1414 + m.x1415 == 0)
m.c584 = Constraint(expr= - 5*m.x587 - 0.5*m.x1415 + m.x1416 == 0)
m.c585 = Constraint(expr= - 5*m.x588 - 0.5*m.x1416 + m.x1417 == 0)
m.c586 = Constraint(expr= - 5*m.x589 - 0.5*m.x1417 + m.x1418 == 0)
m.c587 = Constraint(expr= - 5*m.x590 - 0.5*m.x1418 + m.x1419 == 0)
m.c588 = Constraint(expr= - 5*m.x591 - 0.5*m.x1419 + m.x1420 == 0)
m.c589 = Constraint(expr= - 5*m.x592 - 0.5*m.x1420 + m.x1421 == 0)
m.c590 = Constraint(expr= - 5*m.x593 - 0.5*m.x1421 + m.x1422 == 0)
m.c591 = Constraint(expr= - 5*m.x594 - 0.5*m.x1422 + m.x1423 == 0)
m.c592 = Constraint(expr= - 5*m.x595 - 0.5*m.x1423 + m.x1424 == 0)
m.c593 = Constraint(expr= - 5*m.x596 - 0.5*m.x1424 + m.x1425 == 0)
m.c594 = Constraint(expr= - 5*m.x597 - 0.5*m.x1425 + m.x1426 == 0)
m.c595 = Constraint(expr= - 5*m.x598 - 0.5*m.x1426 + m.x1427 == 0)
m.c596 = Constraint(expr= - 5*m.x600 - 0.5*m.x1428 + m.x1429 == 0)
m.c597 = Constraint(expr= - 5*m.x601 - 0.5*m.x1429 + m.x1430 == 0)
m.c598 = Constraint(expr= - 5*m.x602 - 0.5*m.x1430 + m.x1431 == 0)
m.c599 = Constraint(expr= - 5*m.x603 - 0.5*m.x1431 + m.x1432 == 0)
m.c600 = Constraint(expr= - 5*m.x604 - 0.5*m.x1432 + m.x1433 == 0)
m.c601 = Constraint(expr= - 5*m.x605 - 0.5*m.x1433 + m.x1434 == 0)
m.c602 = Constraint(expr= - 5*m.x606 - 0.5*m.x1434 + m.x1435 == 0)
m.c603 = Constraint(expr= - 5*m.x607 - 0.5*m.x1435 + m.x1436 == 0)
m.c604 = Constraint(expr= - 5*m.x608 - 0.5*m.x1436 + m.x1437 == 0)
m.c605 = Constraint(expr= - 5*m.x609 - 0.5*m.x1437 + m.x1438 == 0)
m.c606 = Constraint(expr= - 5*m.x610 - 0.5*m.x1438 + m.x1439 == 0)
m.c607 = Constraint(expr= - 5*m.x611 - 0.5*m.x1439 + m.x1440 == 0)
m.c608 = Constraint(expr= - 5*m.x612 - 0.5*m.x1440 + m.x1441 == 0)
m.c609 = Constraint(expr= - 5*m.x613 - 0.5*m.x1441 + m.x1442 == 0)
m.c610 = Constraint(expr= - 5*m.x614 - 0.5*m.x1442 + m.x1443 == 0)
m.c611 = Constraint(expr= - 5*m.x615 - 0.5*m.x1443 + m.x1444 == 0)
m.c612 = Constraint(expr= - 5*m.x616 - 0.5*m.x1444 + m.x1445 == 0)
m.c613 = Constraint(expr= - 5*m.x617 - 0.5*m.x1445 + m.x1446 == 0)
m.c614 = Constraint(expr= - 5*m.x618 - 0.5*m.x1446 + m.x1447 == 0)
m.c615 = Constraint(expr= - 5*m.x619 - 0.5*m.x1447 + m.x1448 == 0)
m.c616 = Constraint(expr= - 5*m.x620 - 0.5*m.x1448 + m.x1449 == 0)
m.c617 = Constraint(expr= - 5*m.x621 - 0.5*m.x1449 + m.x1450 == 0)
m.c618 = Constraint(expr= - 5*m.x623 - 0.5*m.x1451 + m.x1452 == 0)
m.c619 = Constraint(expr= - 5*m.x624 - 0.5*m.x1452 + m.x1453 == 0)
m.c620 = Constraint(expr= - 5*m.x625 - 0.5*m.x1453 + m.x1454 == 0)
m.c621 = Constraint(expr= - 5*m.x626 - 0.5*m.x1454 + m.x1455 == 0)
m.c622 = Constraint(expr= - 5*m.x627 - 0.5*m.x1455 + m.x1456 == 0)
m.c623 = Constraint(expr= - 5*m.x628 - 0.5*m.x1456 + m.x1457 == 0)
m.c624 = Constraint(expr= - 5*m.x629 - 0.5*m.x1457 + m.x1458 == 0)
m.c625 = Constraint(expr= - 5*m.x630 - 0.5*m.x1458 + m.x1459 == 0)
m.c626 = Constraint(expr= - 5*m.x631 - 0.5*m.x1459 + m.x1460 == 0)
m.c627 = Constraint(expr= - 5*m.x632 - 0.5*m.x1460 + m.x1461 == 0)
m.c628 = Constraint(expr= - 5*m.x633 - 0.5*m.x1461 + m.x1462 == 0)
m.c629 = Constraint(expr= - 5*m.x634 - 0.5*m.x1462 + m.x1463 == 0)
m.c630 = Constraint(expr= - 5*m.x635 - 0.5*m.x1463 + m.x1464 == 0)
m.c631 = Constraint(expr= - 5*m.x636 - 0.5*m.x1464 + m.x1465 == 0)
m.c632 = Constraint(expr= - 5*m.x637 - 0.5*m.x1465 + m.x1466 == 0)
m.c633 = Constraint(expr= - 5*m.x638 - 0.5*m.x1466 + m.x1467 == 0)
m.c634 = Constraint(expr= - 5*m.x639 - 0.5*m.x1467 + m.x1468 == 0)
m.c635 = Constraint(expr= - 5*m.x640 - 0.5*m.x1468 + m.x1469 == 0)
m.c636 = Constraint(expr= - 5*m.x641 - 0.5*m.x1469 + m.x1470 == 0)
m.c637 = Constraint(expr= - 5*m.x642 - 0.5*m.x1470 + m.x1471 == 0)
m.c638 = Constraint(expr= - 5*m.x643 - 0.5*m.x1471 + m.x1472 == 0)
m.c639 = Constraint(expr= - 5*m.x644 - 0.5*m.x1472 + m.x1473 == 0)
m.c640 = Constraint(expr= - 5*m.x646 - 0.5*m.x1474 + m.x1475 == 0)
m.c641 = Constraint(expr= - 5*m.x647 - 0.5*m.x1475 + m.x1476 == 0)
m.c642 = Constraint(expr= - 5*m.x648 - 0.5*m.x1476 + m.x1477 == 0)
m.c643 = Constraint(expr= - 5*m.x649 - 0.5*m.x1477 + m.x1478 == 0)
m.c644 = Constraint(expr= - 5*m.x650 - 0.5*m.x1478 + m.x1479 == 0)
m.c645 = Constraint(expr= - 5*m.x651 - 0.5*m.x1479 + m.x1480 == 0)
m.c646 = Constraint(expr= - 5*m.x652 - 0.5*m.x1480 + m.x1481 == 0)
m.c647 = Constraint(expr= - 5*m.x653 - 0.5*m.x1481 + m.x1482 == 0)
m.c648 = Constraint(expr= - 5*m.x654 - 0.5*m.x1482 + m.x1483 == 0)
m.c649 = Constraint(expr= - 5*m.x655 - 0.5*m.x1483 + m.x1484 == 0)
m.c650 = Constraint(expr= - 5*m.x656 - 0.5*m.x1484 + m.x1485 == 0)
m.c651 = Constraint(expr= - 5*m.x657 - 0.5*m.x1485 + m.x1486 == 0)
m.c652 = Constraint(expr= - 5*m.x658 - 0.5*m.x1486 + m.x1487 == 0)
m.c653 = Constraint(expr= - 5*m.x659 - 0.5*m.x1487 + m.x1488 == 0)
m.c654 = Constraint(expr= - 5*m.x660 - 0.5*m.x1488 + m.x1489 == 0)
m.c655 = Constraint(expr= - 5*m.x661 - 0.5*m.x1489 + m.x1490 == 0)
m.c656 = Constraint(expr= - 5*m.x662 - 0.5*m.x1490 + m.x1491 == 0)
m.c657 = Constraint(expr= - 5*m.x663 - 0.5*m.x1491 + m.x1492 == 0)
m.c658 = Constraint(expr= - 5*m.x664 - 0.5*m.x1492 + m.x1493 == 0)
m.c659 = Constraint(expr= - 5*m.x665 - 0.5*m.x1493 + m.x1494 == 0)
m.c660 = Constraint(expr= - 5*m.x666 - 0.5*m.x1494 + m.x1495 == 0)
m.c661 = Constraint(expr= - 5*m.x667 - 0.5*m.x1495 + m.x1496 == 0)
m.c662 = Constraint(expr= - 5*m.x669 - 0.5*m.x1497 + m.x1498 == 0)
m.c663 = Constraint(expr= - 5*m.x670 - 0.5*m.x1498 + m.x1499 == 0)
m.c664 = Constraint(expr= - 5*m.x671 - 0.5*m.x1499 + m.x1500 == 0)
m.c665 = Constraint(expr= - 5*m.x672 - 0.5*m.x1500 + m.x1501 == 0)
m.c666 = Constraint(expr= - 5*m.x673 - 0.5*m.x1501 + m.x1502 == 0)
m.c667 = Constraint(expr= - 5*m.x674 - 0.5*m.x1502 + m.x1503 == 0)
m.c668 = Constraint(expr= - 5*m.x675 - 0.5*m.x1503 + m.x1504 == 0)
m.c669 = Constraint(expr= - 5*m.x676 - 0.5*m.x1504 + m.x1505 == 0)
m.c670 = Constraint(expr= - 5*m.x677 - 0.5*m.x1505 + m.x1506 == 0)
m.c671 = Constraint(expr= - 5*m.x678 - 0.5*m.x1506 + m.x1507 == 0)
m.c672 = Constraint(expr= - 5*m.x679 - 0.5*m.x1507 + m.x1508 == 0)
m.c673 = Constraint(expr= - 5*m.x680 - 0.5*m.x1508 + m.x1509 == 0)
m.c674 = Constraint(expr= - 5*m.x681 - 0.5*m.x1509 + m.x1510 == 0)
m.c675 = Constraint(expr= - 5*m.x682 - 0.5*m.x1510 + m.x1511 == 0)
m.c676 = Constraint(expr= - 5*m.x683 - 0.5*m.x1511 + m.x1512 == 0)
m.c677 = Constraint(expr= - 5*m.x684 - 0.5*m.x1512 + m.x1513 == 0)
m.c678 = Constraint(expr= - 5*m.x685 - 0.5*m.x1513 + m.x1514 == 0)
m.c679 = Constraint(expr= - 5*m.x686 - 0.5*m.x1514 + m.x1515 == 0)
m.c680 = Constraint(expr= - 5*m.x687 - 0.5*m.x1515 + m.x1516 == 0)
m.c681 = Constraint(expr= - 5*m.x688 - 0.5*m.x1516 + m.x1517 == 0)
m.c682 = Constraint(expr= - 5*m.x689 - 0.5*m.x1517 + m.x1518 == 0)
m.c683 = Constraint(expr= - 5*m.x690 - 0.5*m.x1518 + m.x1519 == 0)
m.c684 = Constraint(expr= - 5*m.x692 - 0.5*m.x1520 + m.x1521 == 0)
m.c685 = Constraint(expr= - 5*m.x693 - 0.5*m.x1521 + m.x1522 == 0)
m.c686 = Constraint(expr= - 5*m.x694 - 0.5*m.x1522 + m.x1523 == 0)
m.c687 = Constraint(expr= - 5*m.x695 - 0.5*m.x1523 + m.x1524 == 0)
m.c688 = Constraint(expr= - 5*m.x696 - 0.5*m.x1524 + m.x1525 == 0)
m.c689 = Constraint(expr= - 5*m.x697 - 0.5*m.x1525 + m.x1526 == 0)
m.c690 = Constraint(expr= - 5*m.x698 - 0.5*m.x1526 + m.x1527 == 0)
m.c691 = Constraint(expr= - 5*m.x699 - 0.5*m.x1527 + m.x1528 == 0)
m.c692 = Constraint(expr= - 5*m.x700 - 0.5*m.x1528 + m.x1529 == 0)
m.c693 = Constraint(expr= - 5*m.x701 - 0.5*m.x1529 + m.x1530 == 0)
m.c694 = Constraint(expr= - 5*m.x702 - 0.5*m.x1530 + m.x1531 == 0)
m.c695 = Constraint(expr= - 5*m.x703 - 0.5*m.x1531 + m.x1532 == 0)
m.c696 = Constraint(expr= - 5*m.x704 - 0.5*m.x1532 + m.x1533 == 0)
m.c697 = Constraint(expr= - 5*m.x705 - 0.5*m.x1533 + m.x1534 == 0)
m.c698 = Constraint(expr= - 5*m.x706 - 0.5*m.x1534 + m.x1535 == 0)
m.c699 = Constraint(expr= - 5*m.x707 - 0.5*m.x1535 + m.x1536 == 0)
m.c700 = Constraint(expr= - 5*m.x708 - 0.5*m.x1536 + m.x1537 == 0)
m.c701 = Constraint(expr= - 5*m.x709 - 0.5*m.x1537 + m.x1538 == 0)
m.c702 = Constraint(expr= - 5*m.x710 - 0.5*m.x1538 + m.x1539 == 0)
m.c703 = Constraint(expr= - 5*m.x711 - 0.5*m.x1539 + m.x1540 == 0)
m.c704 = Constraint(expr= - 5*m.x712 - 0.5*m.x1540 + m.x1541 == 0)
m.c705 = Constraint(expr= - 5*m.x713 - 0.5*m.x1541 + m.x1542 == 0)
m.c706 = Constraint(expr= - 5*m.x715 - 0.5*m.x1543 + m.x1544 == 0)
m.c707 = Constraint(expr= - 5*m.x716 - 0.5*m.x1544 + m.x1545 == 0)
m.c708 = Constraint(expr= - 5*m.x717 - 0.5*m.x1545 + m.x1546 == 0)
m.c709 = Constraint(expr= - 5*m.x718 - 0.5*m.x1546 + m.x1547 == 0)
m.c710 = Constraint(expr= - 5*m.x719 - 0.5*m.x1547 + m.x1548 == 0)
m.c711 = Constraint(expr= - 5*m.x720 - 0.5*m.x1548 + m.x1549 == 0)
m.c712 = Constraint(expr= - 5*m.x721 - 0.5*m.x1549 + m.x1550 == 0)
m.c713 = Constraint(expr= - 5*m.x722 - 0.5*m.x1550 + m.x1551 == 0)
m.c714 = Constraint(expr= - 5*m.x723 - 0.5*m.x1551 + m.x1552 == 0)
m.c715 = Constraint(expr= - 5*m.x724 - 0.5*m.x1552 + m.x1553 == 0)
m.c716 = Constraint(expr= - 5*m.x725 - 0.5*m.x1553 + m.x1554 == 0)
m.c717 = Constraint(expr= - 5*m.x726 - 0.5*m.x1554 + m.x1555 == 0)
m.c718 = Constraint(expr= - 5*m.x727 - 0.5*m.x1555 + m.x1556 == 0)
m.c719 = Constraint(expr= - 5*m.x728 - 0.5*m.x1556 + m.x1557 == 0)
m.c720 = Constraint(expr= - 5*m.x729 - 0.5*m.x1557 + m.x1558 == 0)
m.c721 = Constraint(expr= - 5*m.x730 - 0.5*m.x1558 + m.x1559 == 0)
m.c722 = Constraint(expr= - 5*m.x731 - 0.5*m.x1559 + m.x1560 == 0)
m.c723 = Constraint(expr= - 5*m.x732 - 0.5*m.x1560 + m.x1561 == 0)
m.c724 = Constraint(expr= - 5*m.x733 - 0.5*m.x1561 + m.x1562 == 0)
m.c725 = Constraint(expr= - 5*m.x734 - 0.5*m.x1562 + m.x1563 == 0)
m.c726 = Constraint(expr= - 5*m.x735 - 0.5*m.x1563 + m.x1564 == 0)
m.c727 = Constraint(expr= - 5*m.x736 - 0.5*m.x1564 + m.x1565 == 0)
m.c728 = Constraint(expr= - 5*m.x738 - 0.5*m.x1566 + m.x1567 == 0)
m.c729 = Constraint(expr= - 5*m.x739 - 0.5*m.x1567 + m.x1568 == 0)
m.c730 = Constraint(expr= - 5*m.x740 - 0.5*m.x1568 + m.x1569 == 0)
m.c731 = Constraint(expr= - 5*m.x741 - 0.5*m.x1569 + m.x1570 == 0)
m.c732 = Constraint(expr= - 5*m.x742 - 0.5*m.x1570 + m.x1571 == 0)
m.c733 = Constraint(expr= - 5*m.x743 - 0.5*m.x1571 + m.x1572 == 0)
m.c734 = Constraint(expr= - 5*m.x744 - 0.5*m.x1572 + m.x1573 == 0)
m.c735 = Constraint(expr= - 5*m.x745 - 0.5*m.x1573 + m.x1574 == 0)
m.c736 = Constraint(expr= - 5*m.x746 - 0.5*m.x1574 + m.x1575 == 0)
m.c737 = Constraint(expr= - 5*m.x747 - 0.5*m.x1575 + m.x1576 == 0)
m.c738 = Constraint(expr= - 5*m.x748 - 0.5*m.x1576 + m.x1577 == 0)
m.c739 = Constraint(expr= - 5*m.x749 - 0.5*m.x1577 + m.x1578 == 0)
m.c740 = Constraint(expr= - 5*m.x750 - 0.5*m.x1578 + m.x1579 == 0)
m.c741 = Constraint(expr= - 5*m.x751 - 0.5*m.x1579 + m.x1580 == 0)
m.c742 = Constraint(expr= - 5*m.x752 - 0.5*m.x1580 + m.x1581 == 0)
m.c743 = Constraint(expr= - 5*m.x753 - 0.5*m.x1581 + m.x1582 == 0)
m.c744 = Constraint(expr= - 5*m.x754 - 0.5*m.x1582 + m.x1583 == 0)
m.c745 = Constraint(expr= - 5*m.x755 - 0.5*m.x1583 + m.x1584 == 0)
m.c746 = Constraint(expr= - 5*m.x756 - 0.5*m.x1584 + m.x1585 == 0)
m.c747 = Constraint(expr= - 5*m.x757 - 0.5*m.x1585 + m.x1586 == 0)
m.c748 = Constraint(expr= - 5*m.x758 - 0.5*m.x1586 + m.x1587 == 0)
m.c749 = Constraint(expr= - 5*m.x759 - 0.5*m.x1587 + m.x1588 == 0)
m.c750 = Constraint(expr=-5/(1 + 30*exp(-0.428021115708375*m.x2072)) + m.x1589 == 1)
m.c751 = Constraint(expr=-5/(1 + 30*exp(-0.384177028774859*m.x2073)) + m.x1590 == 1)
m.c752 = Constraint(expr=-5/(1 + 30*exp(-0.348719617803299*m.x2074)) + m.x1591 == 1)
m.c753 = Constraint(expr=-5/(1 + 30*exp(-0.315852644213053*m.x2075)) + m.x1592 == 1)
m.c754 = Constraint(expr=-5/(1 + 30*exp(-0.287290278096989*m.x2076)) + m.x1593 == 1)
m.c755 = Constraint(expr=-5/(1 + 30*exp(-0.263984583300335*m.x2077)) + m.x1594 == 1)
m.c756 = Constraint(expr=-5/(1 + 30*exp(-0.244552591034702*m.x2078)) + m.x1595 == 1)
m.c757 = Constraint(expr=-5/(1 + 30*exp(-0.231354736217042*m.x2079)) + m.x1596 == 1)
m.c758 = Constraint(expr=-5/(1 + 30*exp(-0.215586935431713*m.x2080)) + m.x1597 == 1)
m.c759 = Constraint(expr=-5/(1 + 30*exp(-0.201709148854628*m.x2081)) + m.x1598 == 1)
m.c760 = Constraint(expr=-5/(1 + 30*exp(-0.188732660186845*m.x2082)) + m.x1599 == 1)
m.c761 = Constraint(expr=-5/(1 + 30*exp(-0.180023403042396*m.x2083)) + m.x1600 == 1)
m.c762 = Constraint(expr=-5/(1 + 30*exp(-0.170725183671843*m.x2084)) + m.x1601 == 1)
m.c763 = Constraint(expr=-5/(1 + 30*exp(-0.161878655759643*m.x2085)) + m.x1602 == 1)
m.c764 = Constraint(expr=-5/(1 + 30*exp(-0.152435926099063*m.x2086)) + m.x1603 == 1)
m.c765 = Constraint(expr=-5/(1 + 30*exp(-0.144255042915875*m.x2087)) + m.x1604 == 1)
m.c766 = Constraint(expr=-5/(1 + 30*exp(-0.136318403438859*m.x2088)) + m.x1605 == 1)
m.c767 = Constraint(expr=-5/(1 + 30*exp(-0.128572714298572*m.x2089)) + m.x1606 == 1)
m.c768 = Constraint(expr=-5/(1 + 30*exp(-0.121464866287426*m.x2090)) + m.x1607 == 1)
m.c769 = Constraint(expr=-5/(1 + 30*exp(-0.114703014777572*m.x2091)) + m.x1608 == 1)
m.c770 = Constraint(expr=-5/(1 + 30*exp(-0.108466928433521*m.x2092)) + m.x1609 == 1)
m.c771 = Constraint(expr=-5/(1 + 30*exp(-0.102698576255405*m.x2093)) + m.x1610 == 1)
m.c772 = Constraint(expr=-5/(1 + 30*exp(-0.0973106577876098*m.x2094)) + m.x1611 == 1)
m.c773 = Constraint(expr=-5/(1 + 30*exp((-0.304878048780488*m.x2003) - 1.52439024390244*m.x2026 - 0.142673705236125*
m.x2072)) + m.x1612 == 1)
m.c774 = Constraint(expr=-5/(1 + 30*exp((-0.265639527161642*m.x2004) - 1.11086425238836*m.x2027 - 0.12805900959162*
m.x2073)) + m.x1613 == 1)
m.c775 = Constraint(expr=-5/(1 + 30*exp((-0.250018751406355*m.x2005) - 0.860067085232648*m.x2028 - 0.1162398726011*
m.x2074)) + m.x1614 == 1)
m.c776 = Constraint(expr=-5/(1 + 30*exp((-0.239354699729529*m.x2006) - 0.617360167921966*m.x2029 - 0.105284214737684*
m.x2075)) + m.x1615 == 1)
m.c777 = Constraint(expr=-5/(1 + 30*exp((-0.219216520156959*m.x2007) - 0.438962293139019*m.x2030 - 0.0957634260323297*
m.x2076)) + m.x1616 == 1)
m.c778 = Constraint(expr=-5/(1 + 30*exp((-0.201800056504016*m.x2008) - 0.310674785634398*m.x2031 - 0.0879948611001117*
m.x2077)) + m.x1617 == 1)
m.c779 = Constraint(expr=-5/(1 + 30*exp((-0.1874625074985*m.x2009) - 0.24152839166244*m.x2032 - 0.0815175303449007*
m.x2078)) + m.x1618 == 1)
m.c780 = Constraint(expr=-5/(1 + 30*exp((-0.176806520624481*m.x2010) - 0.193416115430738*m.x2033 - 0.0771182454056805*
m.x2079)) + m.x1619 == 1)
m.c781 = Constraint(expr=-5/(1 + 30*exp((-0.16583472910897*m.x2011) - 0.161326751201884*m.x2034 - 0.0718623118105709*
m.x2080)) + m.x1620 == 1)
m.c782 = Constraint(expr=-5/(1 + 30*exp((-0.156330607969734*m.x2012) - 0.135023831706296*m.x2035 - 0.0672363829515427*
m.x2081)) + m.x1621 == 1)
m.c783 = Constraint(expr=-5/(1 + 30*exp((-0.147789075431544*m.x2013) - 0.11568718186025*m.x2036 - 0.0629108867289484*
m.x2082)) + m.x1622 == 1)
m.c784 = Constraint(expr=-5/(1 + 30*exp((-0.142722575857049*m.x2014) - 0.0992812040824431*m.x2037 - 0.0600078010141318*
m.x2083)) + m.x1623 == 1)
m.c785 = Constraint(expr=-5/(1 + 30*exp((-0.134562336002153*m.x2015) - 0.0847034110063612*m.x2038 - 0.0569083945572811*
m.x2084)) + m.x1624 == 1)
m.c786 = Constraint(expr=-5/(1 + 30*exp((-0.127650340188157*m.x2016) - 0.072911805879608*m.x2039 - 0.0539595519198809*
m.x2085)) + m.x1625 == 1)
m.c787 = Constraint(expr=-5/(1 + 30*exp((-0.120595258194448*m.x2017) - 0.0622552590130051*m.x2040 - 0.0508119753663543*
m.x2086)) + m.x1626 == 1)
m.c788 = Constraint(expr=-5/(1 + 30*exp((-0.114420403446343*m.x2018) - 0.0534442122590334*m.x2041 - 0.0480850143052918*
m.x2087)) + m.x1627 == 1)
m.c789 = Constraint(expr=-5/(1 + 30*exp((-0.108685019943701*m.x2019) - 0.0459949865464664*m.x2042 - 0.045439467812953*
m.x2088)) + m.x1628 == 1)
m.c790 = Constraint(expr=-5/(1 + 30*exp((-0.103142759893969*m.x2020) - 0.039859693877551*m.x2043 - 0.0428575714328572*
m.x2089)) + m.x1629 == 1)
m.c791 = Constraint(expr=-5/(1 + 30*exp((-0.0979144227944776*m.x2021) - 0.0346597624419882*m.x2044 - 0.0404882887624755*
m.x2090)) + m.x1630 == 1)
m.c792 = Constraint(expr=-5/(1 + 30*exp((-0.0927721238322309*m.x2022) - 0.030389871663572*m.x2045 - 0.0382343382591906*
m.x2091)) + m.x1631 == 1)
m.c793 = Constraint(expr=-5/(1 + 30*exp((-0.0879221361562201*m.x2023) - 0.0269600640571122*m.x2046 - 0.0361556428111735*
m.x2092)) + m.x1632 == 1)
m.c794 = Constraint(expr=-5/(1 + 30*exp((-0.0834244049754315*m.x2024) - 0.0242323200992556*m.x2047 - 0.0342328587518015*
m.x2093)) + m.x1633 == 1)
m.c795 = Constraint(expr=-5/(1 + 30*exp((-0.0791176796366916*m.x2025) - 0.0214726824533828*m.x2048 - 0.0324368859292033*
m.x2094)) + m.x1634 == 1)
m.c796 = Constraint(expr=-5/(1 + 30*exp(-0.428021115708375*m.x2072)) + m.x1635 == 1)
m.c797 = Constraint(expr=-5/(1 + 30*exp(-0.384177028774859*m.x2073)) + m.x1636 == 1)
m.c798 = Constraint(expr=-5/(1 + 30*exp(-0.348719617803299*m.x2074)) + m.x1637 == 1)
m.c799 = Constraint(expr=-5/(1 + 30*exp(-0.315852644213053*m.x2075)) + m.x1638 == 1)
m.c800 = Constraint(expr=-5/(1 + 30*exp(-0.287290278096989*m.x2076)) + m.x1639 == 1)
m.c801 = Constraint(expr=-5/(1 + 30*exp(-0.263984583300335*m.x2077)) + m.x1640 == 1)
m.c802 = Constraint(expr=-5/(1 + 30*exp(-0.244552591034702*m.x2078)) + m.x1641 == 1)
m.c803 = Constraint(expr=-5/(1 + 30*exp(-0.231354736217042*m.x2079)) + m.x1642 == 1)
m.c804 = Constraint(expr=-5/(1 + 30*exp(-0.215586935431713*m.x2080)) + m.x1643 == 1)
m.c805 = Constraint(expr=-5/(1 + 30*exp(-0.201709148854628*m.x2081)) + m.x1644 == 1)
m.c806 = Constraint(expr=-5/(1 + 30*exp(-0.188732660186845*m.x2082)) + m.x1645 == 1)
m.c807 = Constraint(expr=-5/(1 + 30*exp(-0.180023403042396*m.x2083)) + m.x1646 == 1)
m.c808 = Constraint(expr=-5/(1 + 30*exp(-0.170725183671843*m.x2084)) + m.x1647 == 1)
m.c809 = Constraint(expr=-5/(1 + 30*exp(-0.161878655759643*m.x2085)) + m.x1648 == 1)
m.c810 = Constraint(expr=-5/(1 + 30*exp(-0.152435926099063*m.x2086)) + m.x1649 == 1)
m.c811 = Constraint(expr=-5/(1 + 30*exp(-0.144255042915875*m.x2087)) + m.x1650 == 1)
m.c812 = Constraint(expr=-5/(1 + 30*exp(-0.136318403438859*m.x2088)) + m.x1651 == 1)
m.c813 = Constraint(expr=-5/(1 + 30*exp(-0.128572714298572*m.x2089)) + m.x1652 == 1)
m.c814 = Constraint(expr=-5/(1 + 30*exp(-0.121464866287426*m.x2090)) + m.x1653 == 1)
m.c815 = Constraint(expr=-5/(1 + 30*exp(-0.114703014777572*m.x2091)) + m.x1654 == 1)
m.c816 = Constraint(expr=-5/(1 + 30*exp(-0.108466928433521*m.x2092)) + m.x1655 == 1)
m.c817 = Constraint(expr=-5/(1 + 30*exp(-0.102698576255405*m.x2093)) + m.x1656 == 1)
m.c818 = Constraint(expr=-5/(1 + 30*exp(-0.0973106577876098*m.x2094)) + m.x1657 == 1)
m.c819 = Constraint(expr=-5/(1 + 30*exp(-0.428021115708375*m.x2072)) + m.x1658 == 1)
m.c820 = Constraint(expr=-5/(1 + 30*exp(-0.384177028774859*m.x2073)) + m.x1659 == 1)
m.c821 = Constraint(expr=-5/(1 + 30*exp(-0.348719617803299*m.x2074)) + m.x1660 == 1)
m.c822 = Constraint(expr=-5/(1 + 30*exp(-0.315852644213053*m.x2075)) + m.x1661 == 1)
m.c823 = Constraint(expr=-5/(1 + 30*exp(-0.287290278096989*m.x2076)) + m.x1662 == 1)
m.c824 = Constraint(expr=-5/(1 + 30*exp(-0.263984583300335*m.x2077)) + m.x1663 == 1)
m.c825 = Constraint(expr=-5/(1 + 30*exp(-0.244552591034702*m.x2078)) + m.x1664 == 1)
m.c826 = Constraint(expr=-5/(1 + 30*exp(-0.231354736217042*m.x2079)) + m.x1665 == 1)
m.c827 = Constraint(expr=-5/(1 + 30*exp(-0.215586935431713*m.x2080)) + m.x1666 == 1)
m.c828 = Constraint(expr=-5/(1 + 30*exp(-0.201709148854628*m.x2081)) + m.x1667 == 1)
m.c829 = Constraint(expr=-5/(1 + 30*exp(-0.188732660186845*m.x2082)) + m.x1668 == 1)
m.c830 = Constraint(expr=-5/(1 + 30*exp(-0.180023403042396*m.x2083)) + m.x1669 == 1)
m.c831 = Constraint(expr=-5/(1 + 30*exp(-0.170725183671843*m.x2084)) + m.x1670 == 1)
m.c832 = Constraint(expr=-5/(1 + 30*exp(-0.161878655759643*m.x2085)) + m.x1671 == 1)
m.c833 = Constraint(expr=-5/(1 + 30*exp(-0.152435926099063*m.x2086)) + m.x1672 == 1)
m.c834 = Constraint(expr=-5/(1 + 30*exp(-0.144255042915875*m.x2087)) + m.x1673 == 1)
m.c835 = Constraint(expr=-5/(1 + 30*exp(-0.136318403438859*m.x2088)) + m.x1674 == 1)
m.c836 = Constraint(expr=-5/(1 + 30*exp(-0.128572714298572*m.x2089)) + m.x1675 == 1)
m.c837 = Constraint(expr=-5/(1 + 30*exp(-0.121464866287426*m.x2090)) + m.x1676 == 1)
m.c838 = Constraint(expr=-5/(1 + 30*exp(-0.114703014777572*m.x2091)) + m.x1677 == 1)
m.c839 = Constraint(expr=-5/(1 + 30*exp(-0.108466928433521*m.x2092)) + m.x1678 == 1)
m.c840 = Constraint(expr=-5/(1 + 30*exp(-0.102698576255405*m.x2093)) + m.x1679 == 1)
m.c841 = Constraint(expr=-5/(1 + 30*exp(-0.0973106577876098*m.x2094)) + m.x1680 == 1)
m.c842 = Constraint(expr=-5/(1 + 30*exp((-0.164826108455579*m.x1980) - 0.304878048780488*m.x2003 - 0.142673705236125*
m.x2072)) + m.x1681 == 1)
m.c843 = Constraint(expr=-5/(1 + 30*exp((-0.146901120855552*m.x1981) - 0.265639527161642*m.x2004 - 0.12805900959162*
m.x2073)) + m.x1682 == 1)
m.c844 = Constraint(expr=-5/(1 + 30*exp((-0.128834434867751*m.x1982) - 0.250018751406355*m.x2005 - 0.1162398726011*
m.x2074)) + m.x1683 == 1)
m.c845 = Constraint(expr=-5/(1 + 30*exp((-0.114914790682709*m.x1983) - 0.239354699729529*m.x2006 - 0.105284214737684*
m.x2075)) + m.x1684 == 1)
m.c846 = Constraint(expr=-5/(1 + 30*exp((-0.10354110581901*m.x1984) - 0.219216520156959*m.x2007 - 0.0957634260323297*
m.x2076)) + m.x1685 == 1)
m.c847 = Constraint(expr=-5/(1 + 30*exp((-0.0936276988184184*m.x1985) - 0.201800056504016*m.x2008 - 0.0879948611001117*
m.x2077)) + m.x1686 == 1)
m.c848 = Constraint(expr=-5/(1 + 30*exp((-0.085144063755875*m.x1986) - 0.1874625074985*m.x2009 - 0.0815175303449007*
m.x2078)) + m.x1687 == 1)
m.c849 = Constraint(expr=-5/(1 + 30*exp((-0.0790995309397815*m.x1987) - 0.176806520624481*m.x2010 - 0.0771182454056805*
m.x2079)) + m.x1688 == 1)
m.c850 = Constraint(expr=-5/(1 + 30*exp((-0.0735467168745587*m.x1988) - 0.16583472910897*m.x2011 - 0.0718623118105709*
m.x2080)) + m.x1689 == 1)
m.c851 = Constraint(expr=-5/(1 + 30*exp((-0.0682565901737813*m.x1989) - 0.156330607969734*m.x2012 - 0.0672363829515427*
m.x2081)) + m.x1690 == 1)
m.c852 = Constraint(expr=-5/(1 + 30*exp((-0.062785674820433*m.x1990) - 0.147789075431544*m.x2013 - 0.0629108867289484*
m.x2082)) + m.x1691 == 1)
m.c853 = Constraint(expr=-5/(1 + 30*exp((-0.0576880920240444*m.x1991) - 0.142722575857049*m.x2014 - 0.0600078010141318*
m.x2083)) + m.x1692 == 1)
m.c854 = Constraint(expr=-5/(1 + 30*exp((-0.052780754025852*m.x1992) - 0.134562336002153*m.x2015 - 0.0569083945572811*
m.x2084)) + m.x1693 == 1)
m.c855 = Constraint(expr=-5/(1 + 30*exp((-0.0486551710715815*m.x1993) - 0.127650340188157*m.x2016 - 0.0539595519198809*
m.x2085)) + m.x1694 == 1)
m.c856 = Constraint(expr=-5/(1 + 30*exp((-0.0448060792888379*m.x1994) - 0.120595258194448*m.x2017 - 0.0508119753663543*
m.x2086)) + m.x1695 == 1)
m.c857 = Constraint(expr=-5/(1 + 30*exp((-0.041430169449393*m.x1995) - 0.114420403446343*m.x2018 - 0.0480850143052918*
m.x2087)) + m.x1696 == 1)
m.c858 = Constraint(expr=-5/(1 + 30*exp((-0.0382078968081123*m.x1996) - 0.108685019943701*m.x2019 - 0.045439467812953*
m.x2088)) + m.x1697 == 1)
m.c859 = Constraint(expr=-5/(1 + 30*exp((-0.0352048216523735*m.x1997) - 0.103142759893969*m.x2020 - 0.0428575714328572*
m.x2089)) + m.x1698 == 1)
m.c860 = Constraint(expr=-5/(1 + 30*exp((-0.0324122842557329*m.x1998) - 0.0979144227944776*m.x2021 - 0.0404882887624755*
m.x2090)) + m.x1699 == 1)
m.c861 = Constraint(expr=-5/(1 + 30*exp((-0.0298043937637286*m.x1999) - 0.0927721238322309*m.x2022 - 0.0382343382591906*
m.x2091)) + m.x1700 == 1)
m.c862 = Constraint(expr=-5/(1 + 30*exp((-0.0274252114483803*m.x2000) - 0.0879221361562201*m.x2023 - 0.0361556428111735*
m.x2092)) + m.x1701 == 1)
m.c863 = Constraint(expr=-5/(1 + 30*exp((-0.0252400327110824*m.x2001) - 0.0834244049754315*m.x2024 - 0.0342328587518015*
m.x2093)) + m.x1702 == 1)
m.c864 = Constraint(expr=-5/(1 + 30*exp((-0.023232743299096*m.x2002) - 0.0791176796366916*m.x2025 - 0.0324368859292033*
m.x2094)) + m.x1703 == 1)
m.c865 = Constraint(expr=-5/(1 + 30*exp((-0.164826108455579*m.x1980) - 0.304878048780488*m.x2003 - 0.142673705236125*
m.x2072)) + m.x1704 == 1)
m.c866 = Constraint(expr=-5/(1 + 30*exp((-0.146901120855552*m.x1981) - 0.265639527161642*m.x2004 - 0.12805900959162*
m.x2073)) + m.x1705 == 1)
m.c867 = Constraint(expr=-5/(1 + 30*exp((-0.128834434867751*m.x1982) - 0.250018751406355*m.x2005 - 0.1162398726011*
m.x2074)) + m.x1706 == 1)
m.c868 = Constraint(expr=-5/(1 + 30*exp((-0.114914790682709*m.x1983) - 0.239354699729529*m.x2006 - 0.105284214737684*
m.x2075)) + m.x1707 == 1)
m.c869 = Constraint(expr=-5/(1 + 30*exp((-0.10354110581901*m.x1984) - 0.219216520156959*m.x2007 - 0.0957634260323297*
m.x2076)) + m.x1708 == 1)
m.c870 = Constraint(expr=-5/(1 + 30*exp((-0.0936276988184184*m.x1985) - 0.201800056504016*m.x2008 - 0.0879948611001117*
m.x2077)) + m.x1709 == 1)
m.c871 = Constraint(expr=-5/(1 + 30*exp((-0.085144063755875*m.x1986) - 0.1874625074985*m.x2009 - 0.0815175303449007*
m.x2078)) + m.x1710 == 1)
m.c872 = Constraint(expr=-5/(1 + 30*exp((-0.0790995309397815*m.x1987) - 0.176806520624481*m.x2010 - 0.0771182454056805*
m.x2079)) + m.x1711 == 1)
m.c873 = Constraint(expr=-5/(1 + 30*exp((-0.0735467168745587*m.x1988) - 0.16583472910897*m.x2011 - 0.0718623118105709*
m.x2080)) + m.x1712 == 1)
m.c874 = Constraint(expr=-5/(1 + 30*exp((-0.0682565901737813*m.x1989) - 0.156330607969734*m.x2012 - 0.0672363829515427*
m.x2081)) + m.x1713 == 1)
m.c875 = Constraint(expr=-5/(1 + 30*exp((-0.062785674820433*m.x1990) - 0.147789075431544*m.x2013 - 0.0629108867289484*
m.x2082)) + m.x1714 == 1)
m.c876 = Constraint(expr=-5/(1 + 30*exp((-0.0576880920240444*m.x1991) - 0.142722575857049*m.x2014 - 0.0600078010141318*
m.x2083)) + m.x1715 == 1)
m.c877 = Constraint(expr=-5/(1 + 30*exp((-0.052780754025852*m.x1992) - 0.134562336002153*m.x2015 - 0.0569083945572811*
m.x2084)) + m.x1716 == 1)
m.c878 = Constraint(expr=-5/(1 + 30*exp((-0.0486551710715815*m.x1993) - 0.127650340188157*m.x2016 - 0.0539595519198809*
m.x2085)) + m.x1717 == 1)
m.c879 = Constraint(expr=-5/(1 + 30*exp((-0.0448060792888379*m.x1994) - 0.120595258194448*m.x2017 - 0.0508119753663543*
m.x2086)) + m.x1718 == 1)
m.c880 = Constraint(expr=-5/(1 + 30*exp((-0.041430169449393*m.x1995) - 0.114420403446343*m.x2018 - 0.0480850143052918*
m.x2087)) + m.x1719 == 1)
m.c881 = Constraint(expr=-5/(1 + 30*exp((-0.0382078968081123*m.x1996) - 0.108685019943701*m.x2019 - 0.045439467812953*
m.x2088)) + m.x1720 == 1)
m.c882 = Constraint(expr=-5/(1 + 30*exp((-0.0352048216523735*m.x1997) - 0.103142759893969*m.x2020 - 0.0428575714328572*
m.x2089)) + m.x1721 == 1)
m.c883 = Constraint(expr=-5/(1 + 30*exp((-0.0324122842557329*m.x1998) - 0.0979144227944776*m.x2021 - 0.0404882887624755*
m.x2090)) + m.x1722 == 1)
m.c884 = Constraint(expr=-5/(1 + 30*exp((-0.0298043937637286*m.x1999) - 0.0927721238322309*m.x2022 - 0.0382343382591906*
m.x2091)) + m.x1723 == 1)
m.c885 = Constraint(expr=-5/(1 + 30*exp((-0.0274252114483803*m.x2000) - 0.0879221361562201*m.x2023 - 0.0361556428111735*
m.x2092)) + m.x1724 == 1)
m.c886 = Constraint(expr=-5/(1 + 30*exp((-0.0252400327110824*m.x2001) - 0.0834244049754315*m.x2024 - 0.0342328587518015*
m.x2093)) + m.x1725 == 1)
m.c887 = Constraint(expr=-5/(1 + 30*exp((-0.023232743299096*m.x2002) - 0.0791176796366916*m.x2025 - 0.0324368859292033*
m.x2094)) + m.x1726 == 1)
m.c888 = Constraint(expr=-5/(1 + 30*exp((-0.457317073170732*m.x2003) - 0.214010557854187*m.x2072)) + m.x1727 == 1)
m.c889 = Constraint(expr=-5/(1 + 30*exp((-0.398459290742462*m.x2004) - 0.19208851438743*m.x2073)) + m.x1728 == 1)
m.c890 = Constraint(expr=-5/(1 + 30*exp((-0.375028127109533*m.x2005) - 0.174359808901649*m.x2074)) + m.x1729 == 1)
m.c891 = Constraint(expr=-5/(1 + 30*exp((-0.359032049594294*m.x2006) - 0.157926322106527*m.x2075)) + m.x1730 == 1)
m.c892 = Constraint(expr=-5/(1 + 30*exp((-0.328824780235439*m.x2007) - 0.143645139048495*m.x2076)) + m.x1731 == 1)
m.c893 = Constraint(expr=-5/(1 + 30*exp((-0.302700084756024*m.x2008) - 0.131992291650168*m.x2077)) + m.x1732 == 1)
m.c894 = Constraint(expr=-5/(1 + 30*exp((-0.28119376124775*m.x2009) - 0.122276295517351*m.x2078)) + m.x1733 == 1)
m.c895 = Constraint(expr=-5/(1 + 30*exp((-0.265209780936721*m.x2010) - 0.115677368108521*m.x2079)) + m.x1734 == 1)
m.c896 = Constraint(expr=-5/(1 + 30*exp((-0.248752093663455*m.x2011) - 0.107793467715856*m.x2080)) + m.x1735 == 1)
m.c897 = Constraint(expr=-5/(1 + 30*exp((-0.234495911954602*m.x2012) - 0.100854574427314*m.x2081)) + m.x1736 == 1)
m.c898 = Constraint(expr=-5/(1 + 30*exp((-0.221683613147316*m.x2013) - 0.0943663300934227*m.x2082)) + m.x1737 == 1)
m.c899 = Constraint(expr=-5/(1 + 30*exp((-0.214083863785574*m.x2014) - 0.0900117015211978*m.x2083)) + m.x1738 == 1)
m.c900 = Constraint(expr=-5/(1 + 30*exp((-0.20184350400323*m.x2015) - 0.0853625918359217*m.x2084)) + m.x1739 == 1)
m.c901 = Constraint(expr=-5/(1 + 30*exp((-0.191475510282235*m.x2016) - 0.0809393278798213*m.x2085)) + m.x1740 == 1)
m.c902 = Constraint(expr=-5/(1 + 30*exp((-0.180892887291672*m.x2017) - 0.0762179630495315*m.x2086)) + m.x1741 == 1)
m.c903 = Constraint(expr=-5/(1 + 30*exp((-0.171630605169514*m.x2018) - 0.0721275214579376*m.x2087)) + m.x1742 == 1)
m.c904 = Constraint(expr=-5/(1 + 30*exp((-0.163027529915552*m.x2019) - 0.0681592017194295*m.x2088)) + m.x1743 == 1)
m.c905 = Constraint(expr=-5/(1 + 30*exp((-0.154714139840954*m.x2020) - 0.0642863571492858*m.x2089)) + m.x1744 == 1)
m.c906 = Constraint(expr=-5/(1 + 30*exp((-0.146871634191716*m.x2021) - 0.0607324331437132*m.x2090)) + m.x1745 == 1)
m.c907 = Constraint(expr=-5/(1 + 30*exp((-0.139158185748346*m.x2022) - 0.0573515073887859*m.x2091)) + m.x1746 == 1)
m.c908 = Constraint(expr=-5/(1 + 30*exp((-0.13188320423433*m.x2023) - 0.0542334642167603*m.x2092)) + m.x1747 == 1)
m.c909 = Constraint(expr=-5/(1 + 30*exp((-0.125136607463147*m.x2024) - 0.0513492881277023*m.x2093)) + m.x1748 == 1)
m.c910 = Constraint(expr=-5/(1 + 30*exp((-0.118676519455037*m.x2025) - 0.0486553288938049*m.x2094)) + m.x1749 == 1)
m.c911 = Constraint(expr=-5/(1 + 30*exp(-0.914634146341463*m.x2003)) + m.x1750 == 1)
m.c912 = Constraint(expr=-5/(1 + 30*exp(-0.796918581484925*m.x2004)) + m.x1751 == 1)
m.c913 = Constraint(expr=-5/(1 + 30*exp(-0.750056254219067*m.x2005)) + m.x1752 == 1)
m.c914 = Constraint(expr=-5/(1 + 30*exp(-0.718064099188588*m.x2006)) + m.x1753 == 1)
m.c915 = Constraint(expr=-5/(1 + 30*exp(-0.657649560470877*m.x2007)) + m.x1754 == 1)
m.c916 = Constraint(expr=-5/(1 + 30*exp(-0.605400169512047*m.x2008)) + m.x1755 == 1)
m.c917 = Constraint(expr=-5/(1 + 30*exp(-0.562387522495501*m.x2009)) + m.x1756 == 1)
m.c918 = Constraint(expr=-5/(1 + 30*exp(-0.530419561873442*m.x2010)) + m.x1757 == 1)
m.c919 = Constraint(expr=-5/(1 + 30*exp(-0.49750418732691*m.x2011)) + m.x1758 == 1)
m.c920 = Constraint(expr=-5/(1 + 30*exp(-0.468991823909203*m.x2012)) + m.x1759 == 1)
m.c921 = Constraint(expr=-5/(1 + 30*exp(-0.443367226294632*m.x2013)) + m.x1760 == 1)
m.c922 = Constraint(expr=-5/(1 + 30*exp(-0.428167727571147*m.x2014)) + m.x1761 == 1)
m.c923 = Constraint(expr=-5/(1 + 30*exp(-0.403687008006459*m.x2015)) + m.x1762 == 1)
m.c924 = Constraint(expr=-5/(1 + 30*exp(-0.38295102056447*m.x2016)) + m.x1763 == 1)
m.c925 = Constraint(expr=-5/(1 + 30*exp(-0.361785774583343*m.x2017)) + m.x1764 == 1)
m.c926 = Constraint(expr=-5/(1 + 30*exp(-0.343261210339028*m.x2018)) + m.x1765 == 1)
m.c927 = Constraint(expr=-5/(1 + 30*exp(-0.326055059831103*m.x2019)) + m.x1766 == 1)
m.c928 = Constraint(expr=-5/(1 + 30*exp(-0.309428279681908*m.x2020)) + m.x1767 == 1)
m.c929 = Constraint(expr=-5/(1 + 30*exp(-0.293743268383433*m.x2021)) + m.x1768 == 1)
m.c930 = Constraint(expr=-5/(1 + 30*exp(-0.278316371496693*m.x2022)) + m.x1769 == 1)
m.c931 = Constraint(expr=-5/(1 + 30*exp(-0.26376640846866*m.x2023)) + m.x1770 == 1)
m.c932 = Constraint(expr=-5/(1 + 30*exp(-0.250273214926295*m.x2024)) + m.x1771 == 1)
m.c933 = Constraint(expr=-5/(1 + 30*exp(-0.237353038910075*m.x2025)) + m.x1772 == 1)
m.c934 = Constraint(expr=-5/(1 + 30*exp((-0.457317073170732*m.x2003) - 0.214010557854187*m.x2072)) + m.x1773 == 1)
m.c935 = Constraint(expr=-5/(1 + 30*exp((-0.398459290742462*m.x2004) - 0.19208851438743*m.x2073)) + m.x1774 == 1)
m.c936 = Constraint(expr=-5/(1 + 30*exp((-0.375028127109533*m.x2005) - 0.174359808901649*m.x2074)) + m.x1775 == 1)
m.c937 = Constraint(expr=-5/(1 + 30*exp((-0.359032049594294*m.x2006) - 0.157926322106527*m.x2075)) + m.x1776 == 1)
m.c938 = Constraint(expr=-5/(1 + 30*exp((-0.328824780235439*m.x2007) - 0.143645139048495*m.x2076)) + m.x1777 == 1)
m.c939 = Constraint(expr=-5/(1 + 30*exp((-0.302700084756024*m.x2008) - 0.131992291650168*m.x2077)) + m.x1778 == 1)
m.c940 = Constraint(expr=-5/(1 + 30*exp((-0.28119376124775*m.x2009) - 0.122276295517351*m.x2078)) + m.x1779 == 1)
m.c941 = Constraint(expr=-5/(1 + 30*exp((-0.265209780936721*m.x2010) - 0.115677368108521*m.x2079)) + m.x1780 == 1)
m.c942 = Constraint(expr=-5/(1 + 30*exp((-0.248752093663455*m.x2011) - 0.107793467715856*m.x2080)) + m.x1781 == 1)
m.c943 = Constraint(expr=-5/(1 + 30*exp((-0.234495911954602*m.x2012) - 0.100854574427314*m.x2081)) + m.x1782 == 1)
m.c944 = Constraint(expr=-5/(1 + 30*exp((-0.221683613147316*m.x2013) - 0.0943663300934227*m.x2082)) + m.x1783 == 1)
m.c945 = Constraint(expr=-5/(1 + 30*exp((-0.214083863785574*m.x2014) - 0.0900117015211978*m.x2083)) + m.x1784 == 1)
m.c946 = Constraint(expr=-5/(1 + 30*exp((-0.20184350400323*m.x2015) - 0.0853625918359217*m.x2084)) + m.x1785 == 1)
m.c947 = Constraint(expr=-5/(1 + 30*exp((-0.191475510282235*m.x2016) - 0.0809393278798213*m.x2085)) + m.x1786 == 1)
m.c948 = Constraint(expr=-5/(1 + 30*exp((-0.180892887291672*m.x2017) - 0.0762179630495315*m.x2086)) + m.x1787 == 1)
m.c949 = Constraint(expr=-5/(1 + 30*exp((-0.171630605169514*m.x2018) - 0.0721275214579376*m.x2087)) + m.x1788 == 1)
m.c950 = Constraint(expr=-5/(1 + 30*exp((-0.163027529915552*m.x2019) - 0.0681592017194295*m.x2088)) + m.x1789 == 1)
m.c951 = Constraint(expr=-5/(1 + 30*exp((-0.154714139840954*m.x2020) - 0.0642863571492858*m.x2089)) + m.x1790 == 1)
m.c952 = Constraint(expr=-5/(1 + 30*exp((-0.146871634191716*m.x2021) - 0.0607324331437132*m.x2090)) + m.x1791 == 1)
m.c953 = Constraint(expr=-5/(1 + 30*exp((-0.139158185748346*m.x2022) - 0.0573515073887859*m.x2091)) + m.x1792 == 1)
m.c954 = Constraint(expr=-5/(1 + 30*exp((-0.13188320423433*m.x2023) - 0.0542334642167603*m.x2092)) + m.x1793 == 1)
m.c955 = Constraint(expr=-5/(1 + 30*exp((-0.125136607463147*m.x2024) - 0.0513492881277023*m.x2093)) + m.x1794 == 1)
m.c956 = Constraint(expr=-5/(1 + 30*exp((-0.118676519455037*m.x2025) - 0.0486553288938049*m.x2094)) + m.x1795 == 1)
m.c957 = Constraint(expr=-5/(1 + 30*exp((-1.58227848101266*m.x1865) - 0.228658536585366*m.x2003 - 1.14329268292683*
m.x2026 - 0.107005278927094*m.x2072)) + m.x1796 == 1)
m.c958 = Constraint(expr=-5/(1 + 30*exp((-1.00590128755365*m.x1866) - 0.199229645371231*m.x2004 - 0.833148189291269*
m.x2027 - 0.0960442571937149*m.x2073)) + m.x1797 == 1)
m.c959 = Constraint(expr=-5/(1 + 30*exp((-0.682004182958989*m.x1867) - 0.187514063554767*m.x2005 - 0.645050313924486*
m.x2028 - 0.0871799044508247*m.x2074)) + m.x1798 == 1)
m.c960 = Constraint(expr=-5/(1 + 30*exp((-0.439084362742228*m.x1868) - 0.179516024797147*m.x2006 - 0.463020125941474*
m.x2029 - 0.0789631610532633*m.x2075)) + m.x1799 == 1)
m.c961 = Constraint(expr=-5/(1 + 30*exp((-0.274453836864639*m.x1869) - 0.164412390117719*m.x2007 - 0.329221719854265*
m.x2030 - 0.0718225695242473*m.x2076)) + m.x1800 == 1)
m.c962 = Constraint(expr=-5/(1 + 30*exp((-0.171448165504629*m.x1870) - 0.151350042378012*m.x2008 - 0.233006089225798*
m.x2031 - 0.0659961458250838*m.x2077)) + m.x1801 == 1)
m.c963 = Constraint(expr=-5/(1 + 30*exp((-0.125493608192223*m.x1871) - 0.140596880623875*m.x2009 - 0.18114629374683*
m.x2032 - 0.0611381477586755*m.x2078)) + m.x1802 == 1)
m.c964 = Constraint(expr=-5/(1 + 30*exp((-0.102471615362545*m.x1872) - 0.13260489046836*m.x2010 - 0.145062086573053*
m.x2033 - 0.0578386840542604*m.x2079)) + m.x1803 == 1)
m.c965 = Constraint(expr=-5/(1 + 30*exp((-0.0878220140515222*m.x1873) - 0.124376046831728*m.x2011 - 0.120995063401413*
m.x2034 - 0.0538967338579282*m.x2080)) + m.x1804 == 1)
m.c966 = Constraint(expr=-5/(1 + 30*exp((-0.0770637676989786*m.x1874) - 0.117247955977301*m.x2012 - 0.101267873779722*
m.x2035 - 0.0504272872136571*m.x2081)) + m.x1805 == 1)
m.c967 = Constraint(expr=-5/(1 + 30*exp((-0.0673570010866929*m.x1875) - 0.110841806573658*m.x2013 - 0.0867653863951874*
m.x2036 - 0.0471831650467113*m.x2082)) + m.x1806 == 1)
m.c968 = Constraint(expr=-5/(1 + 30*exp((-0.0594191186956315*m.x1876) - 0.107041931892787*m.x2014 - 0.0744609030618323*
m.x2037 - 0.0450058507605989*m.x2083)) + m.x1807 == 1)
m.c969 = Constraint(expr=-5/(1 + 30*exp((-0.0524332524696062*m.x1877) - 0.100921752001615*m.x2015 - 0.0635275582547709*
m.x2038 - 0.0426812959179609*m.x2084)) + m.x1808 == 1)
m.c970 = Constraint(expr=-5/(1 + 30*exp((-0.0464519965068099*m.x1878) - 0.0957377551411175*m.x2016 - 0.054683854409706*
m.x2039 - 0.0404696639399106*m.x2085)) + m.x1809 == 1)
m.c971 = Constraint(expr=-5/(1 + 30*exp((-0.0406182641378638*m.x1879) - 0.0904464436458358*m.x2017 - 0.0466914442597538*
m.x2040 - 0.0381089815247658*m.x2086)) + m.x1810 == 1)
m.c972 = Constraint(expr=-5/(1 + 30*exp((-0.0354184572664507*m.x1880) - 0.0858153025847569*m.x2018 - 0.0400831591942751*
m.x2041 - 0.0360637607289688*m.x2087)) + m.x1811 == 1)
m.c973 = Constraint(expr=-5/(1 + 30*exp((-0.0307745334580728*m.x1881) - 0.0815137649577759*m.x2019 - 0.0344962399098498*
m.x2042 - 0.0340796008597147*m.x2088)) + m.x1812 == 1)
m.c974 = Constraint(expr=-5/(1 + 30*exp((-0.0265639056733419*m.x1882) - 0.0773570699204769*m.x2020 - 0.0298947704081633*
m.x2043 - 0.0321431785746429*m.x2089)) + m.x1813 == 1)
m.c975 = Constraint(expr=-5/(1 + 30*exp((-0.022768808553786*m.x1883) - 0.0734358170958582*m.x2021 - 0.0259948218314912*
m.x2044 - 0.0303662165718566*m.x2090)) + m.x1814 == 1)
m.c976 = Constraint(expr=-5/(1 + 30*exp((-0.0195025041215292*m.x1884) - 0.0695790928741732*m.x2022 - 0.022792403747679*
m.x2045 - 0.0286757536943929*m.x2091)) + m.x1815 == 1)
m.c977 = Constraint(expr=-5/(1 + 30*exp((-0.0168000215040275*m.x1885) - 0.065941602117165*m.x2023 - 0.0202200480428342*
m.x2046 - 0.0271167321083802*m.x2092)) + m.x1816 == 1)
m.c978 = Constraint(expr=-5/(1 + 30*exp((-0.0144005068978428*m.x1886) - 0.0625683037315736*m.x2024 - 0.0181742400744417*
m.x2047 - 0.0256746440638511*m.x2093)) + m.x1817 == 1)
m.c979 = Constraint(expr=-5/(1 + 30*exp((-0.0123410270038126*m.x1887) - 0.0593382597275187*m.x2025 - 0.0161045118400371*
m.x2048 - 0.0243276644469024*m.x2094)) + m.x1818 == 1)
m.c980 = Constraint(expr=-5/(1 + 30*exp((-0.247239162683369*m.x1980) - 0.457317073170732*m.x2003)) + m.x1819 == 1)
m.c981 = Constraint(expr=-5/(1 + 30*exp((-0.220351681283328*m.x1981) - 0.398459290742462*m.x2004)) + m.x1820 == 1)
m.c982 = Constraint(expr=-5/(1 + 30*exp((-0.193251652301627*m.x1982) - 0.375028127109533*m.x2005)) + m.x1821 == 1)
m.c983 = Constraint(expr=-5/(1 + 30*exp((-0.172372186024063*m.x1983) - 0.359032049594294*m.x2006)) + m.x1822 == 1)
m.c984 = Constraint(expr=-5/(1 + 30*exp((-0.155311658728515*m.x1984) - 0.328824780235439*m.x2007)) + m.x1823 == 1)
m.c985 = Constraint(expr=-5/(1 + 30*exp((-0.140441548227628*m.x1985) - 0.302700084756024*m.x2008)) + m.x1824 == 1)
m.c986 = Constraint(expr=-5/(1 + 30*exp((-0.127716095633812*m.x1986) - 0.28119376124775*m.x2009)) + m.x1825 == 1)
m.c987 = Constraint(expr=-5/(1 + 30*exp((-0.118649296409672*m.x1987) - 0.265209780936721*m.x2010)) + m.x1826 == 1)
m.c988 = Constraint(expr=-5/(1 + 30*exp((-0.110320075311838*m.x1988) - 0.248752093663455*m.x2011)) + m.x1827 == 1)
m.c989 = Constraint(expr=-5/(1 + 30*exp((-0.102384885260672*m.x1989) - 0.234495911954602*m.x2012)) + m.x1828 == 1)
m.c990 = Constraint(expr=-5/(1 + 30*exp((-0.0941785122306495*m.x1990) - 0.221683613147316*m.x2013)) + m.x1829 == 1)
m.c991 = Constraint(expr=-5/(1 + 30*exp((-0.0865321380360666*m.x1991) - 0.214083863785574*m.x2014)) + m.x1830 == 1)
m.c992 = Constraint(expr=-5/(1 + 30*exp((-0.079171131038778*m.x1992) - 0.20184350400323*m.x2015)) + m.x1831 == 1)
m.c993 = Constraint(expr=-5/(1 + 30*exp((-0.0729827566073722*m.x1993) - 0.191475510282235*m.x2016)) + m.x1832 == 1)
m.c994 = Constraint(expr=-5/(1 + 30*exp((-0.0672091189332569*m.x1994) - 0.180892887291672*m.x2017)) + m.x1833 == 1)
m.c995 = Constraint(expr=-5/(1 + 30*exp((-0.0621452541740896*m.x1995) - 0.171630605169514*m.x2018)) + m.x1834 == 1)
m.c996 = Constraint(expr=-5/(1 + 30*exp((-0.0573118452121685*m.x1996) - 0.163027529915552*m.x2019)) + m.x1835 == 1)
m.c997 = Constraint(expr=-5/(1 + 30*exp((-0.0528072324785603*m.x1997) - 0.154714139840954*m.x2020)) + m.x1836 == 1)
m.c998 = Constraint(expr=-5/(1 + 30*exp((-0.0486184263835994*m.x1998) - 0.146871634191716*m.x2021)) + m.x1837 == 1)
m.c999 = Constraint(expr=-5/(1 + 30*exp((-0.044706590645593*m.x1999) - 0.139158185748346*m.x2022)) + m.x1838 == 1)
m.c1000 = Constraint(expr=-5/(1 + 30*exp((-0.0411378171725704*m.x2000) - 0.13188320423433*m.x2023)) + m.x1839 == 1)
m.c1001 = Constraint(expr=-5/(1 + 30*exp((-0.0378600490666236*m.x2001) - 0.125136607463147*m.x2024)) + m.x1840 == 1)
m.c1002 = Constraint(expr=-5/(1 + 30*exp((-0.034849114948644*m.x2002) - 0.118676519455037*m.x2025)) + m.x1841 == 1)
m.c1003 = Constraint(expr= - 5*m.x255 - 0.5*m.x1842 + m.x1843 == 0)
m.c1004 = Constraint(expr= - 5*m.x256 - 0.5*m.x1843 + m.x1844 == 0)
m.c1005 = Constraint(expr= - 5*m.x257 - 0.5*m.x1844 + m.x1845 == 0)
m.c1006 = Constraint(expr= - 5*m.x258 - 0.5*m.x1845 + m.x1846 == 0)
m.c1007 = Constraint(expr= - 5*m.x259 - 0.5*m.x1846 + m.x1847 == 0)
m.c1008 = Constraint(expr= - 5*m.x260 - 0.5*m.x1847 + m.x1848 == 0)
m.c1009 = Constraint(expr= - 5*m.x261 - 0.5*m.x1848 + m.x1849 == 0)
m.c1010 = Constraint(expr= - 5*m.x262 - 0.5*m.x1849 + m.x1850 == 0)
m.c1011 = Constraint(expr= - 5*m.x263 - 0.5*m.x1850 + m.x1851 == 0)
m.c1012 = Constraint(expr= - 5*m.x264 - 0.5*m.x1851 + m.x1852 == 0)
m.c1013 = Constraint(expr= - 5*m.x265 - 0.5*m.x1852 + m.x1853 == 0)
m.c1014 = Constraint(expr= - 5*m.x266 - 0.5*m.x1853 + m.x1854 == 0)
m.c1015 = Constraint(expr= - 5*m.x267 - 0.5*m.x1854 + m.x1855 == 0)
m.c1016 = Constraint(expr= - 5*m.x268 - 0.5*m.x1855 + m.x1856 == 0)
m.c1017 = Constraint(expr= - 5*m.x269 - 0.5*m.x1856 + m.x1857 == 0)
m.c1018 = Constraint(expr= - 5*m.x270 - 0.5*m.x1857 + m.x1858 == 0)
m.c1019 = Constraint(expr= - 5*m.x271 - 0.5*m.x1858 + m.x1859 == 0)
m.c1020 = Constraint(expr= - 5*m.x272 - 0.5*m.x1859 + m.x1860 == 0)
m.c1021 = Constraint(expr= - 5*m.x273 - 0.5*m.x1860 + m.x1861 == 0)
m.c1022 = Constraint(expr= - 5*m.x274 - 0.5*m.x1861 + m.x1862 == 0)
m.c1023 = Constraint(expr= - 5*m.x275 - 0.5*m.x1862 + m.x1863 == 0)
m.c1024 = Constraint(expr= - 5*m.x276 - 0.5*m.x1863 + m.x1864 == 0)
m.c1025 = Constraint(expr= - 5*m.x278 - 0.5*m.x1865 + m.x1866 == 0)
m.c1026 = Constraint(expr= - 5*m.x279 - 0.5*m.x1866 + m.x1867 == 0)
m.c1027 = Constraint(expr= - 5*m.x280 - 0.5*m.x1867 + m.x1868 == 0)
m.c1028 = Constraint(expr= - 5*m.x281 - 0.5*m.x1868 + m.x1869 == 0)
m.c1029 = Constraint(expr= - 5*m.x282 - 0.5*m.x1869 + m.x1870 == 0)
m.c1030 = Constraint(expr= - 5*m.x283 - 0.5*m.x1870 + m.x1871 == 0)
m.c1031 = Constraint(expr= - 5*m.x284 - 0.5*m.x1871 + m.x1872 == 0)
m.c1032 = Constraint(expr= - 5*m.x285 - 0.5*m.x1872 + m.x1873 == 0)
m.c1033 = Constraint(expr= - 5*m.x286 - 0.5*m.x1873 + m.x1874 == 0)
m.c1034 = Constraint(expr= - 5*m.x287 - 0.5*m.x1874 + m.x1875 == 0)
m.c1035 = Constraint(expr= - 5*m.x288 - 0.5*m.x1875 + m.x1876 == 0)
m.c1036 = Constraint(expr= - 5*m.x289 - 0.5*m.x1876 + m.x1877 == 0)
m.c1037 = Constraint(expr= - 5*m.x290 - 0.5*m.x1877 + m.x1878 == 0)
m.c1038 = Constraint(expr= - 5*m.x291 - 0.5*m.x1878 + m.x1879 == 0)
m.c1039 = Constraint(expr= - 5*m.x292 - 0.5*m.x1879 + m.x1880 == 0)
m.c1040 = Constraint(expr= - 5*m.x293 - 0.5*m.x1880 + m.x1881 == 0)
m.c1041 = Constraint(expr= - 5*m.x294 - 0.5*m.x1881 + m.x1882 == 0)
m.c1042 = Constraint(expr= - 5*m.x295 - 0.5*m.x1882 + m.x1883 == 0)
m.c1043 = Constraint(expr= - 5*m.x296 - 0.5*m.x1883 + m.x1884 == 0)
m.c1044 = Constraint(expr= - 5*m.x297 - 0.5*m.x1884 + m.x1885 == 0)
m.c1045 = Constraint(expr= - 5*m.x298 - 0.5*m.x1885 + m.x1886 == 0)
m.c1046 = Constraint(expr= - 5*m.x299 - 0.5*m.x1886 + m.x1887 == 0)
m.c1047 = Constraint(expr= - 5*m.x301 - 0.5*m.x1888 + m.x1889 == 0)
m.c1048 = Constraint(expr= - 5*m.x302 - 0.5*m.x1889 + m.x1890 == 0)
m.c1049 = Constraint(expr= - 5*m.x303 - 0.5*m.x1890 + m.x1891 == 0)
m.c1050 = Constraint(expr= - 5*m.x304 - 0.5*m.x1891 + m.x1892 == 0)
m.c1051 = Constraint(expr= - 5*m.x305 - 0.5*m.x1892 + m.x1893 == 0)
m.c1052 = Constraint(expr= - 5*m.x306 - 0.5*m.x1893 + m.x1894 == 0)
m.c1053 = Constraint(expr= - 5*m.x307 - 0.5*m.x1894 + m.x1895 == 0)
m.c1054 = Constraint(expr= - 5*m.x308 - 0.5*m.x1895 + m.x1896 == 0)
m.c1055 = Constraint(expr= - 5*m.x309 - 0.5*m.x1896 + m.x1897 == 0)
m.c1056 = Constraint(expr= - 5*m.x310 - 0.5*m.x1897 + m.x1898 == 0)
m.c1057 = Constraint(expr= - 5*m.x311 - 0.5*m.x1898 + m.x1899 == 0)
m.c1058 = Constraint(expr= - 5*m.x312 - 0.5*m.x1899 + m.x1900 == 0)
m.c1059 = Constraint(expr= - 5*m.x313 - 0.5*m.x1900 + m.x1901 == 0)
m.c1060 = Constraint(expr= - 5*m.x314 - 0.5*m.x1901 + m.x1902 == 0)
m.c1061 = Constraint(expr= - 5*m.x315 - 0.5*m.x1902 + m.x1903 == 0)
m.c1062 = Constraint(expr= - 5*m.x316 - 0.5*m.x1903 + m.x1904 == 0)
m.c1063 = Constraint(expr= - 5*m.x317 - 0.5*m.x1904 + m.x1905 == 0)
m.c1064 = Constraint(expr= - 5*m.x318 - 0.5*m.x1905 + m.x1906 == 0)
m.c1065 = Constraint(expr= - 5*m.x319 - 0.5*m.x1906 + m.x1907 == 0)
m.c1066 = Constraint(expr= - 5*m.x320 - 0.5*m.x1907 + m.x1908 == 0)
m.c1067 = Constraint(expr= - 5*m.x321 - 0.5*m.x1908 + m.x1909 == 0)
m.c1068 = Constraint(expr= - 5*m.x322 - 0.5*m.x1909 + m.x1910 == 0)
m.c1069 = Constraint(expr= - 5*m.x324 - 0.5*m.x1911 + m.x1912 == 0)
m.c1070 = Constraint(expr= - 5*m.x325 - 0.5*m.x1912 + m.x1913 == 0)
m.c1071 = Constraint(expr= - 5*m.x326 - 0.5*m.x1913 + m.x1914 == 0)
m.c1072 = Constraint(expr= - 5*m.x327 - 0.5*m.x1914 + m.x1915 == 0)
m.c1073 = Constraint(expr= - 5*m.x328 - 0.5*m.x1915 + m.x1916 == 0)
m.c1074 = Constraint(expr= - 5*m.x329 - 0.5*m.x1916 + m.x1917 == 0)
m.c1075 = Constraint(expr= - 5*m.x330 - 0.5*m.x1917 + m.x1918 == 0)
m.c1076 = Constraint(expr= - 5*m.x331 - 0.5*m.x1918 + m.x1919 == 0)
m.c1077 = Constraint(expr= - 5*m.x332 - 0.5*m.x1919 + m.x1920 == 0)
m.c1078 = Constraint(expr= - 5*m.x333 - 0.5*m.x1920 + m.x1921 == 0)
m.c1079 = Constraint(expr= - 5*m.x334 - 0.5*m.x1921 + m.x1922 == 0)
m.c1080 = Constraint(expr= - 5*m.x335 - 0.5*m.x1922 + m.x1923 == 0)
m.c1081 = Constraint(expr= - 5*m.x336 - 0.5*m.x1923 + m.x1924 == 0)
m.c1082 = Constraint(expr= - 5*m.x337 - 0.5*m.x1924 + m.x1925 == 0)
m.c1083 = Constraint(expr= - 5*m.x338 - 0.5*m.x1925 + m.x1926 == 0)
m.c1084 = Constraint(expr= - 5*m.x339 - 0.5*m.x1926 + m.x1927 == 0)
m.c1085 = Constraint(expr= - 5*m.x340 - 0.5*m.x1927 + m.x1928 == 0)
m.c1086 = Constraint(expr= - 5*m.x341 - 0.5*m.x1928 + m.x1929 == 0)
m.c1087 = Constraint(expr= - 5*m.x342 - 0.5*m.x1929 + m.x1930 == 0)
m.c1088 = Constraint(expr= - 5*m.x343 - 0.5*m.x1930 + m.x1931 == 0)
m.c1089 = Constraint(expr= - 5*m.x344 - 0.5*m.x1931 + m.x1932 == 0)
m.c1090 = Constraint(expr= - 5*m.x345 - 0.5*m.x1932 + m.x1933 == 0)
m.c1091 = Constraint(expr= - 5*m.x347 - 0.5*m.x1934 + m.x1935 == 0)
m.c1092 = Constraint(expr= - 5*m.x348 - 0.5*m.x1935 + m.x1936 == 0)
m.c1093 = Constraint(expr= - 5*m.x349 - 0.5*m.x1936 + m.x1937 == 0)
m.c1094 = Constraint(expr= - 5*m.x350 - 0.5*m.x1937 + m.x1938 == 0)
m.c1095 = Constraint(expr= - 5*m.x351 - 0.5*m.x1938 + m.x1939 == 0)
m.c1096 = Constraint(expr= - 5*m.x352 - 0.5*m.x1939 + m.x1940 == 0)
m.c1097 = Constraint(expr= - 5*m.x353 - 0.5*m.x1940 + m.x1941 == 0)
m.c1098 = Constraint(expr= - 5*m.x354 - 0.5*m.x1941 + m.x1942 == 0)
m.c1099 = Constraint(expr= - 5*m.x355 - 0.5*m.x1942 + m.x1943 == 0)
m.c1100 = Constraint(expr= - 5*m.x356 - 0.5*m.x1943 + m.x1944 == 0)
m.c1101 = Constraint(expr= - 5*m.x357 - 0.5*m.x1944 + m.x1945 == 0)
m.c1102 = Constraint(expr= - 5*m.x358 - 0.5*m.x1945 + m.x1946 == 0)
m.c1103 = Constraint(expr= - 5*m.x359 - 0.5*m.x1946 + m.x1947 == 0)
m.c1104 = Constraint(expr= - 5*m.x360 - 0.5*m.x1947 + m.x1948 == 0)
m.c1105 = Constraint(expr= - 5*m.x361 - 0.5*m.x1948 + m.x1949 == 0)
m.c1106 = Constraint(expr= - 5*m.x362 - 0.5*m.x1949 + m.x1950 == 0)
m.c1107 = Constraint(expr= - 5*m.x363 - 0.5*m.x1950 + m.x1951 == 0)
m.c1108 = Constraint(expr= - 5*m.x364 - 0.5*m.x1951 + m.x1952 == 0)
m.c1109 = Constraint(expr= - 5*m.x365 - 0.5*m.x1952 + m.x1953 == 0)
m.c1110 = Constraint(expr= - 5*m.x366 - 0.5*m.x1953 + m.x1954 == 0)
m.c1111 = Constraint(expr= - 5*m.x367 - 0.5*m.x1954 + m.x1955 == 0)
m.c1112 = Constraint(expr= - 5*m.x368 - 0.5*m.x1955 + m.x1956 == 0)
m.c1113 = Constraint(expr= - 5*m.x370 - 0.5*m.x1957 + m.x1958 == 0)
m.c1114 = Constraint(expr= - 5*m.x371 - 0.5*m.x1958 + m.x1959 == 0)
m.c1115 = Constraint(expr= - 5*m.x372 - 0.5*m.x1959 + m.x1960 == 0)
m.c1116 = Constraint(expr= - 5*m.x373 - 0.5*m.x1960 + m.x1961 == 0)
m.c1117 = Constraint(expr= - 5*m.x374 - 0.5*m.x1961 + m.x1962 == 0)
m.c1118 = Constraint(expr= - 5*m.x375 - 0.5*m.x1962 + m.x1963 == 0)
m.c1119 = Constraint(expr= - 5*m.x376 - 0.5*m.x1963 + m.x1964 == 0)
m.c1120 = Constraint(expr= - 5*m.x377 - 0.5*m.x1964 + m.x1965 == 0)
m.c1121 = Constraint(expr= - 5*m.x378 - 0.5*m.x1965 + m.x1966 == 0)
m.c1122 = Constraint(expr= - 5*m.x379 - 0.5*m.x1966 + m.x1967 == 0)
m.c1123 = Constraint(expr= - 5*m.x380 - 0.5*m.x1967 + m.x1968 == 0)
m.c1124 = Constraint(expr= - 5*m.x381 - 0.5*m.x1968 + m.x1969 == 0)
m.c1125 = Constraint(expr= - 5*m.x382 - 0.5*m.x1969 + m.x1970 == 0)
m.c1126 = Constraint(expr= - 5*m.x383 - 0.5*m.x1970 + m.x1971 == 0)
m.c1127 = Constraint(expr= - 5*m.x384 - 0.5*m.x1971 + m.x1972 == 0)
m.c1128 = Constraint(expr= - 5*m.x385 - 0.5*m.x1972 + m.x1973 == 0)
m.c1129 = Constraint(expr= - 5*m.x386 - 0.5*m.x1973 + m.x1974 == 0)
m.c1130 = Constraint(expr= - 5*m.x387 - 0.5*m.x1974 + m.x1975 == 0)
m.c1131 = Constraint(expr= - 5*m.x388 - 0.5*m.x1975 + m.x1976 == 0)
m.c1132 = Constraint(expr= - 5*m.x389 - 0.5*m.x1976 + m.x1977 == 0)
m.c1133 = Constraint(expr= - 5*m.x390 - 0.5*m.x1977 + m.x1978 == 0)
m.c1134 = Constraint(expr= - 5*m.x391 - 0.5*m.x1978 + m.x1979 == 0)
m.c1135 = Constraint(expr= - 5*m.x393 - 0.5*m.x1980 + m.x1981 == 0)
m.c1136 = Constraint(expr= - 5*m.x394 - 0.5*m.x1981 + m.x1982 == 0)
m.c1137 = Constraint(expr= - 5*m.x395 - 0.5*m.x1982 + m.x1983 == 0)
m.c1138 = Constraint(expr= - 5*m.x396 - 0.5*m.x1983 + m.x1984 == 0)
m.c1139 = Constraint(expr= - 5*m.x397 - 0.5*m.x1984 + m.x1985 == 0)
m.c1140 = Constraint(expr= - 5*m.x398 - 0.5*m.x1985 + m.x1986 == 0)
m.c1141 = Constraint(expr= - 5*m.x399 - 0.5*m.x1986 + m.x1987 == 0)
m.c1142 = Constraint(expr= - 5*m.x400 - 0.5*m.x1987 + m.x1988 == 0)
m.c1143 = Constraint(expr= - 5*m.x401 - 0.5*m.x1988 + m.x1989 == 0)
m.c1144 = Constraint(expr= - 5*m.x402 - 0.5*m.x1989 + m.x1990 == 0)
m.c1145 = Constraint(expr= - 5*m.x403 - 0.5*m.x1990 + m.x1991 == 0)
m.c1146 = Constraint(expr= - 5*m.x404 - 0.5*m.x1991 + m.x1992 == 0)
m.c1147 = Constraint(expr= - 5*m.x405 - 0.5*m.x1992 + m.x1993 == 0)
m.c1148 = Constraint(expr= - 5*m.x406 - 0.5*m.x1993 + m.x1994 == 0)
m.c1149 = Constraint(expr= - 5*m.x407 - 0.5*m.x1994 + m.x1995 == 0)
m.c1150 = Constraint(expr= - 5*m.x408 - 0.5*m.x1995 + m.x1996 == 0)
m.c1151 = Constraint(expr= - 5*m.x409 - 0.5*m.x1996 + m.x1997 == 0)
m.c1152 = Constraint(expr= - 5*m.x410 - 0.5*m.x1997 + m.x1998 == 0)
m.c1153 = Constraint(expr= - 5*m.x411 - 0.5*m.x1998 + m.x1999 == 0)
m.c1154 = Constraint(expr= - 5*m.x412 - 0.5*m.x1999 + m.x2000 == 0)
m.c1155 = Constraint(expr= - 5*m.x413 - 0.5*m.x2000 + m.x2001 == 0)
m.c1156 = Constraint(expr= - 5*m.x414 - 0.5*m.x2001 + m.x2002 == 0)
m.c1157 = Constraint(expr= - 5*m.x416 - 0.5*m.x2003 + m.x2004 == 0)
m.c1158 = Constraint(expr= - 5*m.x417 - 0.5*m.x2004 + m.x2005 == 0)
m.c1159 = Constraint(expr= - 5*m.x418 - 0.5*m.x2005 + m.x2006 == 0)
m.c1160 = Constraint(expr= - 5*m.x419 - 0.5*m.x2006 + m.x2007 == 0)
m.c1161 = Constraint(expr= - 5*m.x420 - 0.5*m.x2007 + m.x2008 == 0)
m.c1162 = Constraint(expr= - 5*m.x421 - 0.5*m.x2008 + m.x2009 == 0)
m.c1163 = Constraint(expr= - 5*m.x422 - 0.5*m.x2009 + m.x2010 == 0)
m.c1164 = Constraint(expr= - 5*m.x423 - 0.5*m.x2010 + m.x2011 == 0)
m.c1165 = Constraint(expr= - 5*m.x424 - 0.5*m.x2011 + m.x2012 == 0)
m.c1166 = Constraint(expr= - 5*m.x425 - 0.5*m.x2012 + m.x2013 == 0)
m.c1167 = Constraint(expr= - 5*m.x426 - 0.5*m.x2013 + m.x2014 == 0)
m.c1168 = Constraint(expr= - 5*m.x427 - 0.5*m.x2014 + m.x2015 == 0)
m.c1169 = Constraint(expr= - 5*m.x428 - 0.5*m.x2015 + m.x2016 == 0)
m.c1170 = Constraint(expr= - 5*m.x429 - 0.5*m.x2016 + m.x2017 == 0)
m.c1171 = Constraint(expr= - 5*m.x430 - 0.5*m.x2017 + m.x2018 == 0)
m.c1172 = Constraint(expr= - 5*m.x431 - 0.5*m.x2018 + m.x2019 == 0)
m.c1173 = Constraint(expr= - 5*m.x432 - 0.5*m.x2019 + m.x2020 == 0)
m.c1174 = Constraint(expr= - 5*m.x433 - 0.5*m.x2020 + m.x2021 == 0)
m.c1175 = Constraint(expr= - 5*m.x434 - 0.5*m.x2021 + m.x2022 == 0)
m.c1176 = Constraint(expr= - 5*m.x435 - 0.5*m.x2022 + m.x2023 == 0)
m.c1177 = Constraint(expr= - 5*m.x436 - 0.5*m.x2023 + m.x2024 == 0)
m.c1178 = Constraint(expr= - 5*m.x437 - 0.5*m.x2024 + m.x2025 == 0)
m.c1179 = Constraint(expr= - 5*m.x439 - 0.5*m.x2026 + m.x2027 == 0)
m.c1180 = Constraint(expr= - 5*m.x440 - 0.5*m.x2027 + m.x2028 == 0)
m.c1181 = Constraint(expr= - 5*m.x441 - 0.5*m.x2028 + m.x2029 == 0)
m.c1182 = Constraint(expr= - 5*m.x442 - 0.5*m.x2029 + m.x2030 == 0)
m.c1183 = Constraint(expr= - 5*m.x443 - 0.5*m.x2030 + m.x2031 == 0)
m.c1184 = Constraint(expr= - 5*m.x444 - 0.5*m.x2031 + m.x2032 == 0)
m.c1185 = Constraint(expr= - 5*m.x445 - 0.5*m.x2032 + m.x2033 == 0)
m.c1186 = Constraint(expr= - 5*m.x446 - 0.5*m.x2033 + m.x2034 == 0)
m.c1187 = Constraint(expr= - 5*m.x447 - 0.5*m.x2034 + m.x2035 == 0)
m.c1188 = Constraint(expr= - 5*m.x448 - 0.5*m.x2035 + m.x2036 == 0)
m.c1189 = Constraint(expr= - 5*m.x449 - 0.5*m.x2036 + m.x2037 == 0)
m.c1190 = Constraint(expr= - 5*m.x450 - 0.5*m.x2037 + m.x2038 == 0)
m.c1191 = Constraint(expr= - 5*m.x451 - 0.5*m.x2038 + m.x2039 == 0)
m.c1192 = Constraint(expr= - 5*m.x452 - 0.5*m.x2039 + m.x2040 == 0)
m.c1193 = Constraint(expr= - 5*m.x453 - 0.5*m.x2040 + m.x2041 == 0)
m.c1194 = Constraint(expr= - 5*m.x454 - 0.5*m.x2041 + m.x2042 == 0)
m.c1195 = Constraint(expr= - 5*m.x455 - 0.5*m.x2042 + m.x2043 == 0)
m.c1196 = Constraint(expr= - 5*m.x456 - 0.5*m.x2043 + m.x2044 == 0)
m.c1197 = Constraint(expr= - 5*m.x457 - 0.5*m.x2044 + m.x2045 == 0)
m.c1198 = Constraint(expr= - 5*m.x458 - 0.5*m.x2045 + m.x2046 == 0)
m.c1199 = Constraint(expr= - 5*m.x459 - 0.5*m.x2046 + m.x2047 == 0)
m.c1200 = Constraint(expr= - 5*m.x460 - 0.5*m.x2047 + m.x2048 == 0)
m.c1201 = Constraint(expr= - 5*m.x462 - 0.5*m.x2049 + m.x2050 == 0)
m.c1202 = Constraint(expr= - 5*m.x463 - 0.5*m.x2050 + m.x2051 == 0)
m.c1203 = Constraint(expr= - 5*m.x464 - 0.5*m.x2051 + m.x2052 == 0)
m.c1204 = Constraint(expr= - 5*m.x465 - 0.5*m.x2052 + m.x2053 == 0)
m.c1205 = Constraint(expr= - 5*m.x466 - 0.5*m.x2053 + m.x2054 == 0)
m.c1206 = Constraint(expr= - 5*m.x467 - 0.5*m.x2054 + m.x2055 == 0)
m.c1207 = Constraint(expr= - 5*m.x468 - 0.5*m.x2055 + m.x2056 == 0)
m.c1208 = Constraint(expr= - 5*m.x469 - 0.5*m.x2056 + m.x2057 == 0)
m.c1209 = Constraint(expr= - 5*m.x470 - 0.5*m.x2057 + m.x2058 == 0)
m.c1210 = Constraint(expr= - 5*m.x471 - 0.5*m.x2058 + m.x2059 == 0)
m.c1211 = Constraint(expr= - 5*m.x472 - 0.5*m.x2059 + m.x2060 == 0)
m.c1212 = Constraint(expr= - 5*m.x473 - 0.5*m.x2060 + m.x2061 == 0)
m.c1213 = Constraint(expr= - 5*m.x474 - 0.5*m.x2061 + m.x2062 == 0)
m.c1214 = Constraint(expr= - 5*m.x475 - 0.5*m.x2062 + m.x2063 == 0)
m.c1215 = Constraint(expr= - 5*m.x476 - 0.5*m.x2063 + m.x2064 == 0)
m.c1216 = Constraint(expr= - 5*m.x477 - 0.5*m.x2064 + m.x2065 == 0)
m.c1217 = Constraint(expr= - 5*m.x478 - 0.5*m.x2065 + m.x2066 == 0)
m.c1218 = Constraint(expr= - 5*m.x479 - 0.5*m.x2066 + m.x2067 == 0)
m.c1219 = Constraint(expr= - 5*m.x480 - 0.5*m.x2067 + m.x2068 == 0)
m.c1220 = Constraint(expr= - 5*m.x481 - 0.5*m.x2068 + m.x2069 == 0)
m.c1221 = Constraint(expr= - 5*m.x482 - 0.5*m.x2069 + m.x2070 == 0)
m.c1222 = Constraint(expr= - 5*m.x483 - 0.5*m.x2070 + m.x2071 == 0)
m.c1223 = Constraint(expr= - 5*m.x485 - 0.5*m.x2072 + m.x2073 == 0)
m.c1224 = Constraint(expr= - 5*m.x486 - 0.5*m.x2073 + m.x2074 == 0)
m.c1225 = Constraint(expr= - 5*m.x487 - 0.5*m.x2074 + m.x2075 == 0)
m.c1226 = Constraint(expr= - 5*m.x488 - 0.5*m.x2075 + m.x2076 == 0)
m.c1227 = Constraint(expr= - 5*m.x489 - 0.5*m.x2076 + m.x2077 == 0)
m.c1228 = Constraint(expr= - 5*m.x490 - 0.5*m.x2077 + m.x2078 == 0)
m.c1229 = Constraint(expr= - 5*m.x491 - 0.5*m.x2078 + m.x2079 == 0)
m.c1230 = Constraint(expr= - 5*m.x492 - 0.5*m.x2079 + m.x2080 == 0)
m.c1231 = Constraint(expr= - 5*m.x493 - 0.5*m.x2080 + m.x2081 == 0)
m.c1232 = Constraint(expr= - 5*m.x494 - 0.5*m.x2081 + m.x2082 == 0)
m.c1233 = Constraint(expr= - 5*m.x495 - 0.5*m.x2082 + m.x2083 == 0)
m.c1234 = Constraint(expr= - 5*m.x496 - 0.5*m.x2083 + m.x2084 == 0)
m.c1235 = Constraint(expr= - 5*m.x497 - 0.5*m.x2084 + m.x2085 == 0)
m.c1236 = Constraint(expr= - 5*m.x498 - 0.5*m.x2085 + m.x2086 == 0)
m.c1237 = Constraint(expr= - 5*m.x499 - 0.5*m.x2086 + m.x2087 == 0)
m.c1238 = Constraint(expr= - 5*m.x500 - 0.5*m.x2087 + m.x2088 == 0)
m.c1239 = Constraint(expr= - 5*m.x501 - 0.5*m.x2088 + m.x2089 == 0)
m.c1240 = Constraint(expr= - 5*m.x502 - 0.5*m.x2089 + m.x2090 == 0)
m.c1241 = Constraint(expr= - 5*m.x503 - 0.5*m.x2090 + m.x2091 == 0)
m.c1242 = Constraint(expr= - 5*m.x504 - 0.5*m.x2091 + m.x2092 == 0)
m.c1243 = Constraint(expr= - 5*m.x505 - 0.5*m.x2092 + m.x2093 == 0)
m.c1244 = Constraint(expr= - 5*m.x506 - 0.5*m.x2093 + m.x2094 == 0)
m.c1245 = Constraint(expr=-(m.x255*m.x784 + m.x508*m.x807 + m.x830*m.x761) == -0.2165)
m.c1246 = Constraint(expr=-(m.x256*m.x785 + m.x509*m.x808 + m.x831*m.x762) == -0.2366)
m.c1247 = Constraint(expr=-(m.x257*m.x786 + m.x510*m.x809 + m.x832*m.x763) == -0.271)
m.c1248 = Constraint(expr=-(m.x258*m.x787 + m.x511*m.x810 + m.x833*m.x764) == -0.3588)
m.c1249 = Constraint(expr=-(m.x259*m.x788 + m.x512*m.x811 + m.x834*m.x765) == -0.4687)
m.c1250 = Constraint(expr=-(m.x260*m.x789 + m.x513*m.x812 + m.x835*m.x766) == -0.6173)
m.c1251 = Constraint(expr=-(m.x261*m.x790 + m.x514*m.x813 + m.x836*m.x767) == -0.7791)
m.c1252 = Constraint(expr=-(m.x262*m.x791 + m.x515*m.x814 + m.x837*m.x768) == -0.9843)
m.c1253 = Constraint(expr=-(m.x263*m.x792 + m.x516*m.x815 + m.x838*m.x769) == -1.2568)
m.c1254 = Constraint(expr=-(m.x264*m.x793 + m.x517*m.x816 + m.x839*m.x770) == -1.596)
m.c1255 = Constraint(expr=-(m.x265*m.x794 + m.x518*m.x817 + m.x840*m.x771) == -2.0396)
m.c1256 = Constraint(expr=-(m.x266*m.x795 + m.x519*m.x818 + m.x841*m.x772) == -2.595)
m.c1257 = Constraint(expr=-(m.x267*m.x796 + m.x520*m.x819 + m.x842*m.x773) == -3.3137)
m.c1258 = Constraint(expr=-(m.x268*m.x797 + m.x521*m.x820 + m.x843*m.x774) == -4.156)
m.c1259 = Constraint(expr=-(m.x269*m.x798 + m.x522*m.x821 + m.x844*m.x775) == -5.2384)
m.c1260 = Constraint(expr=-(m.x270*m.x799 + m.x523*m.x822 + m.x845*m.x776) == -6.8115)
m.c1261 = Constraint(expr=-(m.x271*m.x800 + m.x524*m.x823 + m.x846*m.x777) == -8.8067)
m.c1262 = Constraint(expr=-(m.x272*m.x801 + m.x525*m.x824 + m.x847*m.x778) == -11.446)
m.c1263 = Constraint(expr=-(m.x273*m.x802 + m.x526*m.x825 + m.x848*m.x779) == -14.9852)
m.c1264 = Constraint(expr=-(m.x274*m.x803 + m.x527*m.x826 + m.x849*m.x780) == -18.583)
m.c1265 = Constraint(expr=-(m.x275*m.x804 + m.x528*m.x827 + m.x850*m.x781) == -23.3913)
m.c1266 = Constraint(expr=-(m.x276*m.x805 + m.x529*m.x828 + m.x851*m.x782) == -29.2491)
m.c1267 = Constraint(expr=-(m.x277*m.x806 + m.x530*m.x829 + m.x852*m.x783) == -36.3904)
m.c1268 = Constraint(expr=-(m.x278*m.x784 + m.x531*m.x807 + m.x853*m.x761) == -0.3157)
m.c1269 = Constraint(expr=-(m.x279*m.x785 + m.x532*m.x808 + m.x854*m.x762) == -0.627)
m.c1270 = Constraint(expr=-(m.x280*m.x786 + m.x533*m.x809 + m.x855*m.x763) == -0.8624)
m.c1271 = Constraint(expr=-(m.x281*m.x787 + m.x534*m.x810 + m.x856*m.x764) == -1.306)
m.c1272 = Constraint(expr=-(m.x282*m.x788 + m.x535*m.x811 + m.x857*m.x765) == -2.0489)
m.c1273 = Constraint(expr=-(m.x283*m.x789 + m.x536*m.x812 + m.x858*m.x766) == -3.112)
m.c1274 = Constraint(expr=-(m.x284*m.x790 + m.x537*m.x813 + m.x859*m.x767) == -4.1048)
m.c1275 = Constraint(expr=-(m.x285*m.x791 + m.x538*m.x814 + m.x860*m.x768) == -5.7053)
m.c1276 = Constraint(expr=-(m.x286*m.x792 + m.x539*m.x815 + m.x861*m.x769) == -7.054)
m.c1277 = Constraint(expr=-(m.x287*m.x793 + m.x540*m.x816 + m.x862*m.x770) == -7.9981)
m.c1278 = Constraint(expr=-(m.x288*m.x794 + m.x541*m.x817 + m.x863*m.x771) == -9.143)
m.c1279 = Constraint(expr=-(m.x289*m.x795 + m.x542*m.x818 + m.x864*m.x772) == -10.3738)
m.c1280 = Constraint(expr=-(m.x290*m.x796 + m.x543*m.x819 + m.x865*m.x773) == -11.8387)
m.c1281 = Constraint(expr=-(m.x291*m.x797 + m.x544*m.x820 + m.x866*m.x774) == -13.4295)
m.c1282 = Constraint(expr=-(m.x292*m.x798 + m.x545*m.x821 + m.x867*m.x775) == -15.457)
m.c1283 = Constraint(expr=-(m.x293*m.x799 + m.x546*m.x822 + m.x868*m.x776) == -17.7262)
m.c1284 = Constraint(expr=-(m.x294*m.x800 + m.x547*m.x823 + m.x869*m.x777) == -20.2335)
m.c1285 = Constraint(expr=-(m.x295*m.x801 + m.x548*m.x824 + m.x870*m.x778) == -23.3197)
m.c1286 = Constraint(expr=-(m.x296*m.x802 + m.x549*m.x825 + m.x871*m.x779) == -27.0386)
m.c1287 = Constraint(expr=-(m.x297*m.x803 + m.x550*m.x826 + m.x872*m.x780) == -31.982)
m.c1288 = Constraint(expr=-(m.x298*m.x804 + m.x551*m.x827 + m.x873*m.x781) == -36.7224)
m.c1289 = Constraint(expr=-(m.x299*m.x805 + m.x552*m.x828 + m.x874*m.x782) == -42.9158)
m.c1290 = Constraint(expr=-(m.x300*m.x806 + m.x553*m.x829 + m.x875*m.x783) == -48.8357)
m.c1291 = Constraint(expr=-(m.x301*m.x784 + m.x554*m.x807 + m.x876*m.x761) == -0.2161)
m.c1292 = Constraint(expr=-(m.x302*m.x785 + m.x555*m.x808 + m.x877*m.x762) == -0.2458)
m.c1293 = Constraint(expr=-(m.x303*m.x786 + m.x556*m.x809 + m.x878*m.x763) == -0.2118)
m.c1294 = Constraint(expr=-(m.x304*m.x787 + m.x557*m.x810 + m.x879*m.x764) == -0.2161)
m.c1295 = Constraint(expr=-(m.x305*m.x788 + m.x558*m.x811 + m.x880*m.x765) == -0.2438)
m.c1296 = Constraint(expr=-(m.x306*m.x789 + m.x559*m.x812 + m.x881*m.x766) == -0.3054)
m.c1297 = Constraint(expr=-(m.x307*m.x790 + m.x560*m.x813 + m.x882*m.x767) == -0.3818)
m.c1298 = Constraint(expr=-(m.x308*m.x791 + m.x561*m.x814 + m.x883*m.x768) == -0.4733)
m.c1299 = Constraint(expr=-(m.x309*m.x792 + m.x562*m.x815 + m.x884*m.x769) == -0.5839)
m.c1300 = Constraint(expr=-(m.x310*m.x793 + m.x563*m.x816 + m.x885*m.x770) == -0.7019)
m.c1301 = Constraint(expr=-(m.x311*m.x794 + m.x564*m.x817 + m.x886*m.x771) == -0.9963)
m.c1302 = Constraint(expr=-(m.x312*m.x795 + m.x565*m.x818 + m.x887*m.x772) == -1.227)
m.c1303 = Constraint(expr=-(m.x313*m.x796 + m.x566*m.x819 + m.x888*m.x773) == -1.4659)
m.c1304 = Constraint(expr=-(m.x314*m.x797 + m.x567*m.x820 + m.x889*m.x774) == -1.7561)
m.c1305 = Constraint(expr=-(m.x315*m.x798 + m.x568*m.x821 + m.x890*m.x775) == -2.0967)
m.c1306 = Constraint(expr=-(m.x316*m.x799 + m.x569*m.x822 + m.x891*m.x776) == -2.4697)
m.c1307 = Constraint(expr=-(m.x317*m.x800 + m.x570*m.x823 + m.x892*m.x777) == -2.8666)
m.c1308 = Constraint(expr=-(m.x318*m.x801 + m.x571*m.x824 + m.x893*m.x778) == -3.2968)
m.c1309 = Constraint(expr=-(m.x319*m.x802 + m.x572*m.x825 + m.x894*m.x779) == -3.7268)
m.c1310 = Constraint(expr=-(m.x320*m.x803 + m.x573*m.x826 + m.x895*m.x780) == -4.1579)
m.c1311 = Constraint(expr=-(m.x321*m.x804 + m.x574*m.x827 + m.x896*m.x781) == -4.5764)
m.c1312 = Constraint(expr=-(m.x322*m.x805 + m.x575*m.x828 + m.x897*m.x782) == -5.0348)
m.c1313 = Constraint(expr=-(m.x323*m.x806 + m.x576*m.x829 + m.x898*m.x783) == -5.4022)
m.c1314 = Constraint(expr=-(m.x324*m.x784 + m.x577*m.x807 + m.x899*m.x761) == -0.5416)
m.c1315 = Constraint(expr=-(m.x325*m.x785 + m.x578*m.x808 + m.x900*m.x762) == -0.5936)
m.c1316 = Constraint(expr=-(m.x326*m.x786 + m.x579*m.x809 + m.x901*m.x763) == -0.4591)
m.c1317 = Constraint(expr=-(m.x327*m.x787 + m.x580*m.x810 + m.x902*m.x764) == -0.4169)
m.c1318 = Constraint(expr=-(m.x328*m.x788 + m.x581*m.x811 + m.x903*m.x765) == -0.4343)
m.c1319 = Constraint(expr=-(m.x329*m.x789 + m.x582*m.x812 + m.x904*m.x766) == -0.5595)
m.c1320 = Constraint(expr=-(m.x330*m.x790 + m.x583*m.x813 + m.x905*m.x767) == -0.688)
m.c1321 = Constraint(expr=-(m.x331*m.x791 + m.x584*m.x814 + m.x906*m.x768) == -0.8688)
m.c1322 = Constraint(expr=-(m.x332*m.x792 + m.x585*m.x815 + m.x907*m.x769) == -1.0842)
m.c1323 = Constraint(expr=-(m.x333*m.x793 + m.x586*m.x816 + m.x908*m.x770) == -1.3622)
m.c1324 = Constraint(expr=-(m.x334*m.x794 + m.x587*m.x817 + m.x909*m.x771) == -1.7335)
m.c1325 = Constraint(expr=-(m.x335*m.x795 + m.x588*m.x818 + m.x910*m.x772) == -2.1742)
m.c1326 = Constraint(expr=-(m.x336*m.x796 + m.x589*m.x819 + m.x911*m.x773) == -3.0119)
m.c1327 = Constraint(expr=-(m.x337*m.x797 + m.x590*m.x820 + m.x912*m.x774) == -3.9653)
m.c1328 = Constraint(expr=-(m.x338*m.x798 + m.x591*m.x821 + m.x913*m.x775) == -4.9613)
m.c1329 = Constraint(expr=-(m.x339*m.x799 + m.x592*m.x822 + m.x914*m.x776) == -6.141)
m.c1330 = Constraint(expr=-(m.x340*m.x800 + m.x593*m.x823 + m.x915*m.x777) == -7.5748)
m.c1331 = Constraint(expr=-(m.x341*m.x801 + m.x594*m.x824 + m.x916*m.x778) == -9.181)
m.c1332 = Constraint(expr=-(m.x342*m.x802 + m.x595*m.x825 + m.x917*m.x779) == -10.9582)
m.c1333 = Constraint(expr=-(m.x343*m.x803 + m.x596*m.x826 + m.x918*m.x780) == -12.8496)
m.c1334 = Constraint(expr=-(m.x344*m.x804 + m.x597*m.x827 + m.x919*m.x781) == -14.8165)
m.c1335 = Constraint(expr=-(m.x345*m.x805 + m.x598*m.x828 + m.x920*m.x782) == -16.7916)
m.c1336 = Constraint(expr=-(m.x346*m.x806 + m.x599*m.x829 + m.x921*m.x783) == -19.093)
m.c1337 = Constraint(expr=-(m.x347*m.x784 + m.x600*m.x807 + m.x922*m.x761) == -0.8593)
m.c1338 = Constraint(expr=-(m.x348*m.x785 + m.x601*m.x808 + m.x923*m.x762) == -1.0246)
m.c1339 = Constraint(expr=-(m.x349*m.x786 + m.x602*m.x809 + m.x924*m.x763) == -1.1086)
m.c1340 = Constraint(expr=-(m.x350*m.x787 + m.x603*m.x810 + m.x925*m.x764) == -1.3416)
m.c1341 = Constraint(expr=-(m.x351*m.x788 + m.x604*m.x811 + m.x926*m.x765) == -1.6252)
m.c1342 = Constraint(expr=-(m.x352*m.x789 + m.x605*m.x812 + m.x927*m.x766) == -1.9711)
m.c1343 = Constraint(expr=-(m.x353*m.x790 + m.x606*m.x813 + m.x928*m.x767) == -2.5211)
m.c1344 = Constraint(expr=-(m.x354*m.x791 + m.x607*m.x814 + m.x929*m.x768) == -2.9001)
m.c1345 = Constraint(expr=-(m.x355*m.x792 + m.x608*m.x815 + m.x930*m.x769) == -3.3843)
m.c1346 = Constraint(expr=-(m.x356*m.x793 + m.x609*m.x816 + m.x931*m.x770) == -4.028)
m.c1347 = Constraint(expr=-(m.x357*m.x794 + m.x610*m.x817 + m.x932*m.x771) == -4.8978)
m.c1348 = Constraint(expr=-(m.x358*m.x795 + m.x611*m.x818 + m.x933*m.x772) == -6.0223)
m.c1349 = Constraint(expr=-(m.x359*m.x796 + m.x612*m.x819 + m.x934*m.x773) == -7.1294)
m.c1350 = Constraint(expr=-(m.x360*m.x797 + m.x613*m.x820 + m.x935*m.x774) == -8.1492)
m.c1351 = Constraint(expr=-(m.x361*m.x798 + m.x614*m.x821 + m.x936*m.x775) == -9.5735)
m.c1352 = Constraint(expr=-(m.x362*m.x799 + m.x615*m.x822 + m.x937*m.x776) == -11.3282)
m.c1353 = Constraint(expr=-(m.x363*m.x800 + m.x616*m.x823 + m.x938*m.x777) == -14.0217)
m.c1354 = Constraint(expr=-(m.x364*m.x801 + m.x617*m.x824 + m.x939*m.x778) == -16.4747)
m.c1355 = Constraint(expr=-(m.x365*m.x802 + m.x618*m.x825 + m.x940*m.x779) == -19.7438)
m.c1356 = Constraint(expr=-(m.x366*m.x803 + m.x619*m.x826 + m.x941*m.x780) == -23.4589)
m.c1357 = Constraint(expr=-(m.x367*m.x804 + m.x620*m.x827 + m.x942*m.x781) == -30.0418)
m.c1358 = Constraint(expr=-(m.x368*m.x805 + m.x621*m.x828 + m.x943*m.x782) == -29.8919)
m.c1359 = Constraint(expr=-(m.x369*m.x806 + m.x622*m.x829 + m.x944*m.x783) == -42.2665)
m.c1360 = Constraint(expr=-(m.x370*m.x784 + m.x623*m.x807 + m.x945*m.x761) == -0.4412)
m.c1361 = Constraint(expr=-(m.x371*m.x785 + m.x624*m.x808 + m.x946*m.x762) == -0.5302)
m.c1362 = Constraint(expr=-(m.x372*m.x786 + m.x625*m.x809 + m.x947*m.x763) == -0.593)
m.c1363 = Constraint(expr=-(m.x373*m.x787 + m.x626*m.x810 + m.x948*m.x764) == -0.7619)
m.c1364 = Constraint(expr=-(m.x374*m.x788 + m.x627*m.x811 + m.x949*m.x765) == -0.9639)
m.c1365 = Constraint(expr=-(m.x375*m.x789 + m.x628*m.x812 + m.x950*m.x766) == -1.3494)
m.c1366 = Constraint(expr=-(m.x376*m.x790 + m.x629*m.x813 + m.x951*m.x767) == -1.7395)
m.c1367 = Constraint(expr=-(m.x377*m.x791 + m.x630*m.x814 + m.x952*m.x768) == -2.1546)
m.c1368 = Constraint(expr=-(m.x378*m.x792 + m.x631*m.x815 + m.x953*m.x769) == -2.5856)
m.c1369 = Constraint(expr=-(m.x379*m.x793 + m.x632*m.x816 + m.x954*m.x770) == -3.2216)
m.c1370 = Constraint(expr=-(m.x380*m.x794 + m.x633*m.x817 + m.x955*m.x771) == -3.9166)
m.c1371 = Constraint(expr=-(m.x381*m.x795 + m.x634*m.x818 + m.x956*m.x772) == -4.8123)
m.c1372 = Constraint(expr=-(m.x382*m.x796 + m.x635*m.x819 + m.x957*m.x773) == -5.913)
m.c1373 = Constraint(expr=-(m.x383*m.x797 + m.x636*m.x820 + m.x958*m.x774) == -6.8663)
m.c1374 = Constraint(expr=-(m.x384*m.x798 + m.x637*m.x821 + m.x959*m.x775) == -8.3871)
m.c1375 = Constraint(expr=-(m.x385*m.x799 + m.x638*m.x822 + m.x960*m.x776) == -10.2801)
m.c1376 = Constraint(expr=-(m.x386*m.x800 + m.x639*m.x823 + m.x961*m.x777) == -12.7004)
m.c1377 = Constraint(expr=-(m.x387*m.x801 + m.x640*m.x824 + m.x962*m.x778) == -15.7565)
m.c1378 = Constraint(expr=-(m.x388*m.x802 + m.x641*m.x825 + m.x963*m.x779) == -19.0986)
m.c1379 = Constraint(expr=-(m.x389*m.x803 + m.x642*m.x826 + m.x964*m.x780) == -22.9432)
m.c1380 = Constraint(expr=-(m.x390*m.x804 + m.x643*m.x827 + m.x965*m.x781) == -26.4786)
m.c1381 = Constraint(expr=-(m.x391*m.x805 + m.x644*m.x828 + m.x966*m.x782) == -36.586)
m.c1382 = Constraint(expr=-(m.x392*m.x806 + m.x645*m.x829 + m.x967*m.x783) == -37.0434)
m.c1383 = Constraint(expr=-(m.x393*m.x784 + m.x646*m.x807 + m.x968*m.x761) == -4.9749)
m.c1384 = Constraint(expr=-(m.x394*m.x785 + m.x647*m.x808 + m.x969*m.x762) == -5.3909)
m.c1385 = Constraint(expr=-(m.x395*m.x786 + m.x648*m.x809 + m.x970*m.x763) == -6.2376)
m.c1386 = Constraint(expr=-(m.x396*m.x787 + m.x649*m.x810 + m.x971*m.x764) == -7.0883)
m.c1387 = Constraint(expr=-(m.x397*m.x788 + m.x650*m.x811 + m.x972*m.x765) == -7.8697)
m.c1388 = Constraint(expr=-(m.x398*m.x789 + m.x651*m.x812 + m.x973*m.x766) == -8.7677)
m.c1389 = Constraint(expr=-(m.x399*m.x790 + m.x652*m.x813 + m.x974*m.x767) == -9.7481)
m.c1390 = Constraint(expr=-(m.x400*m.x791 + m.x653*m.x814 + m.x975*m.x768) == -10.3382)
m.c1391 = Constraint(expr=-(m.x401*m.x792 + m.x654*m.x815 + m.x976*m.x769) == -11.1758)
m.c1392 = Constraint(expr=-(m.x402*m.x793 + m.x655*m.x816 + m.x977*m.x770) == -11.9892)
m.c1393 = Constraint(expr=-(m.x403*m.x794 + m.x656*m.x817 + m.x978*m.x771) == -12.9326)
m.c1394 = Constraint(expr=-(m.x404*m.x795 + m.x657*m.x818 + m.x979*m.x772) == -13.9873)
m.c1395 = Constraint(expr=-(m.x405*m.x796 + m.x658*m.x819 + m.x980*m.x773) == -15.2724)
m.c1396 = Constraint(expr=-(m.x406*m.x797 + m.x659*m.x820 + m.x981*m.x774) == -16.5654)
m.c1397 = Constraint(expr=-(m.x407*m.x798 + m.x660*m.x821 + m.x982*m.x775) == -17.9363)
m.c1398 = Constraint(expr=-(m.x408*m.x799 + m.x661*m.x822 + m.x983*m.x776) == -19.3955)
m.c1399 = Constraint(expr=-(m.x409*m.x800 + m.x662*m.x823 + m.x984*m.x777) == -20.9839)
m.c1400 = Constraint(expr=-(m.x410*m.x801 + m.x663*m.x824 + m.x985*m.x778) == -22.7679)
m.c1401 = Constraint(expr=-(m.x411*m.x802 + m.x664*m.x825 + m.x986*m.x779) == -24.7062)
m.c1402 = Constraint(expr=-(m.x412*m.x803 + m.x665*m.x826 + m.x987*m.x780) == -26.8574)
m.c1403 = Constraint(expr=-(m.x413*m.x804 + m.x666*m.x827 + m.x988*m.x781) == -29.1708)
m.c1404 = Constraint(expr=-(m.x414*m.x805 + m.x667*m.x828 + m.x989*m.x782) == -31.6569)
m.c1405 = Constraint(expr=-(m.x415*m.x806 + m.x668*m.x829 + m.x990*m.x783) == -34.298)
m.c1406 = Constraint(expr=-(m.x416*m.x784 + m.x669*m.x807 + m.x991*m.x761) == -2.296)
m.c1407 = Constraint(expr=-(m.x417*m.x785 + m.x670*m.x808 + m.x992*m.x762) == -3.0389)
m.c1408 = Constraint(expr=-(m.x418*m.x786 + m.x671*m.x809 + m.x993*m.x763) == -3.4294)
m.c1409 = Constraint(expr=-(m.x419*m.x787 + m.x672*m.x810 + m.x994*m.x764) == -3.3782)
m.c1410 = Constraint(expr=-(m.x420*m.x788 + m.x673*m.x811 + m.x995*m.x765) == -3.6958)
m.c1411 = Constraint(expr=-(m.x421*m.x789 + m.x674*m.x812 + m.x996*m.x766) == -4.0594)
m.c1412 = Constraint(expr=-(m.x422*m.x790 + m.x675*m.x813 + m.x997*m.x767) == -4.4327)
m.c1413 = Constraint(expr=-(m.x423*m.x791 + m.x676*m.x814 + m.x998*m.x768) == -4.6549)
m.c1414 = Constraint(expr=-(m.x424*m.x792 + m.x677*m.x815 + m.x999*m.x769) == -4.9953)
m.c1415 = Constraint(expr=-(m.x425*m.x793 + m.x678*m.x816 + m.x1000*m.x770) == -5.3048)
m.c1416 = Constraint(expr=-(m.x426*m.x794 + m.x679*m.x817 + m.x1001*m.x771) == -5.707)
m.c1417 = Constraint(expr=-(m.x427*m.x795 + m.x680*m.x818 + m.x1002*m.x772) == -5.7273)
m.c1418 = Constraint(expr=-(m.x428*m.x796 + m.x681*m.x819 + m.x1003*m.x773) == -6.0973)
m.c1419 = Constraint(expr=-(m.x429*m.x797 + m.x682*m.x820 + m.x1004*m.x774) == -6.4275)
m.c1420 = Constraint(expr=-(m.x430*m.x798 + m.x683*m.x821 + m.x1005*m.x775) == -6.7903)
m.c1421 = Constraint(expr=-(m.x431*m.x799 + m.x684*m.x822 + m.x1006*m.x776) == -7.1411)
m.c1422 = Constraint(expr=-(m.x432*m.x800 + m.x685*m.x823 + m.x1007*m.x777) == -7.4945)
m.c1423 = Constraint(expr=-(m.x433*m.x801 + m.x686*m.x824 + m.x1008*m.x778) == -7.8865)
m.c1424 = Constraint(expr=-(m.x434*m.x802 + m.x687*m.x825 + m.x1009*m.x779) == -8.2882)
m.c1425 = Constraint(expr=-(m.x435*m.x803 + m.x688*m.x826 + m.x1010*m.x780) == -8.7404)
m.c1426 = Constraint(expr=-(m.x436*m.x804 + m.x689*m.x827 + m.x1011*m.x781) == -9.2097)
m.c1427 = Constraint(expr=-(m.x437*m.x805 + m.x690*m.x828 + m.x1012*m.x782) == -9.6762)
m.c1428 = Constraint(expr=-(m.x438*m.x806 + m.x691*m.x829 + m.x1013*m.x783) == -10.1246)
m.c1429 = Constraint(expr=-(m.x439*m.x784 + m.x692*m.x807 + m.x1014*m.x761) == -0.4592)
m.c1430 = Constraint(expr=-(m.x440*m.x785 + m.x693*m.x808 + m.x1015*m.x762) == -0.7608)
m.c1431 = Constraint(expr=-(m.x441*m.x786 + m.x694*m.x809 + m.x1016*m.x763) == -0.8924)
m.c1432 = Constraint(expr=-(m.x442*m.x787 + m.x695*m.x810 + m.x1017*m.x764) == -1.2347)
m.c1433 = Constraint(expr=-(m.x443*m.x788 + m.x696*m.x811 + m.x1018*m.x765) == -1.7196)
m.c1434 = Constraint(expr=-(m.x444*m.x789 + m.x697*m.x812 + m.x1019*m.x766) == -2.3591)
m.c1435 = Constraint(expr=-(m.x445*m.x790 + m.x698*m.x813 + m.x1020*m.x767) == -2.9816)
m.c1436 = Constraint(expr=-(m.x446*m.x791 + m.x699*m.x814 + m.x1021*m.x768) == -3.9897)
m.c1437 = Constraint(expr=-(m.x447*m.x792 + m.x700*m.x815 + m.x1022*m.x769) == -4.7735)
m.c1438 = Constraint(expr=-(m.x448*m.x793 + m.x701*m.x816 + m.x1023*m.x770) == -6.0378)
m.c1439 = Constraint(expr=-(m.x449*m.x794 + m.x702*m.x817 + m.x1024*m.x771) == -7.0409)
m.c1440 = Constraint(expr=-(m.x450*m.x795 + m.x703*m.x818 + m.x1025*m.x772) == -8.2173)
m.c1441 = Constraint(expr=-(m.x451*m.x796 + m.x704*m.x819 + m.x1026*m.x773) == -9.6551)
m.c1442 = Constraint(expr=-(m.x452*m.x797 + m.x705*m.x820 + m.x1027*m.x774) == -11.2421)
m.c1443 = Constraint(expr=-(m.x453*m.x798 + m.x706*m.x821 + m.x1028*m.x775) == -13.2409)
m.c1444 = Constraint(expr=-(m.x454*m.x799 + m.x707*m.x822 + m.x1029*m.x776) == -15.549)
m.c1445 = Constraint(expr=-(m.x455*m.x800 + m.x708*m.x823 + m.x1030*m.x777) == -17.9843)
m.c1446 = Constraint(expr=-(m.x456*m.x801 + m.x709*m.x824 + m.x1031*m.x778) == -20.7786)
m.c1447 = Constraint(expr=-(m.x457*m.x802 + m.x710*m.x825 + m.x1032*m.x779) == -23.8441)
m.c1448 = Constraint(expr=-(m.x458*m.x803 + m.x711*m.x826 + m.x1033*m.x780) == -27.4173)
m.c1449 = Constraint(expr=-(m.x459*m.x804 + m.x712*m.x827 + m.x1034*m.x781) == -31.0362)
m.c1450 = Constraint(expr=-(m.x460*m.x805 + m.x713*m.x828 + m.x1035*m.x782) == -33.1886)
m.c1451 = Constraint(expr=-(m.x461*m.x806 + m.x714*m.x829 + m.x1036*m.x783) == -37.3686)
m.c1452 = Constraint(expr=-(m.x462*m.x784 + m.x715*m.x807 + m.x1037*m.x761) == -0.2941)
m.c1453 = Constraint(expr=-(m.x463*m.x785 + m.x716*m.x808 + m.x1038*m.x762) == -0.3759)
m.c1454 = Constraint(expr=-(m.x464*m.x786 + m.x717*m.x809 + m.x1039*m.x763) == -0.4321)
m.c1455 = Constraint(expr=-(m.x465*m.x787 + m.x718*m.x810 + m.x1040*m.x764) == -0.5605)
m.c1456 = Constraint(expr=-(m.x466*m.x788 + m.x719*m.x811 + m.x1041*m.x765) == -0.7106)
m.c1457 = Constraint(expr=-(m.x467*m.x789 + m.x720*m.x812 + m.x1042*m.x766) == -0.8735)
m.c1458 = Constraint(expr=-(m.x468*m.x790 + m.x721*m.x813 + m.x1043*m.x767) == -1.0371)
m.c1459 = Constraint(expr=-(m.x469*m.x791 + m.x722*m.x814 + m.x1044*m.x768) == -1.245)
m.c1460 = Constraint(expr=-(m.x470*m.x792 + m.x723*m.x815 + m.x1045*m.x769) == -1.5228)
m.c1461 = Constraint(expr=-(m.x471*m.x793 + m.x724*m.x816 + m.x1046*m.x770) == -1.8349)
m.c1462 = Constraint(expr=-(m.x472*m.x794 + m.x725*m.x817 + m.x1047*m.x771) == -2.2122)
m.c1463 = Constraint(expr=-(m.x473*m.x795 + m.x726*m.x818 + m.x1048*m.x772) == -3.227)
m.c1464 = Constraint(expr=-(m.x474*m.x796 + m.x727*m.x819 + m.x1049*m.x773) == -3.9428)
m.c1465 = Constraint(expr=-(m.x475*m.x797 + m.x728*m.x820 + m.x1050*m.x774) == -4.8588)
m.c1466 = Constraint(expr=-(m.x476*m.x798 + m.x729*m.x821 + m.x1051*m.x775) == -6.1289)
m.c1467 = Constraint(expr=-(m.x477*m.x799 + m.x730*m.x822 + m.x1052*m.x776) == -7.7387)
m.c1468 = Constraint(expr=-(m.x478*m.x800 + m.x731*m.x823 + m.x1053*m.x777) == -9.8993)
m.c1469 = Constraint(expr=-(m.x479*m.x801 + m.x732*m.x824 + m.x1054*m.x778) == -12.646)
m.c1470 = Constraint(expr=-(m.x480*m.x802 + m.x733*m.x825 + m.x1055*m.x779) == -16.3002)
m.c1471 = Constraint(expr=-(m.x481*m.x803 + m.x734*m.x826 + m.x1056*m.x780) == -20.8528)
m.c1472 = Constraint(expr=-(m.x482*m.x804 + m.x735*m.x827 + m.x1057*m.x781) == -26.8111)
m.c1473 = Constraint(expr=-(m.x483*m.x805 + m.x736*m.x828 + m.x1058*m.x782) == -34.1759)
m.c1474 = Constraint(expr=-(m.x484*m.x806 + m.x737*m.x829 + m.x1059*m.x783) == -43.0317)
m.c1475 = Constraint(expr=-(m.x485*m.x784 + m.x738*m.x807 + m.x1060*m.x761) == -5.5161)
m.c1476 = Constraint(expr=-(m.x486*m.x785 + m.x739*m.x808 + m.x1061*m.x762) == -6.35)
m.c1477 = Constraint(expr=-(m.x487*m.x786 + m.x740*m.x809 + m.x1062*m.x763) == -6.8699)
m.c1478 = Constraint(expr=-(m.x488*m.x787 + m.x741*m.x810 + m.x1063*m.x764) == -7.6211)
m.c1479 = Constraint(expr=-(m.x489*m.x788 + m.x742*m.x811 + m.x1064*m.x765) == -8.4571)
m.c1480 = Constraint(expr=-(m.x490*m.x789 + m.x743*m.x812 + m.x1065*m.x766) == -9.3036)
m.c1481 = Constraint(expr=-(m.x491*m.x790 + m.x744*m.x813 + m.x1066*m.x767) == -10.1617)
m.c1482 = Constraint(expr=-(m.x492*m.x791 + m.x745*m.x814 + m.x1067*m.x768) == -10.6099)
m.c1483 = Constraint(expr=-(m.x493*m.x792 + m.x746*m.x815 + m.x1068*m.x769) == -11.4541)
m.c1484 = Constraint(expr=-(m.x494*m.x793 + m.x747*m.x816 + m.x1069*m.x770) == -12.3079)
m.c1485 = Constraint(expr=-(m.x495*m.x794 + m.x748*m.x817 + m.x1070*m.x771) == -13.3722)
m.c1486 = Constraint(expr=-(m.x496*m.x795 + m.x749*m.x818 + m.x1071*m.x772) == -13.8965)
m.c1487 = Constraint(expr=-(m.x497*m.x796 + m.x750*m.x819 + m.x1072*m.x773) == -14.3521)
m.c1488 = Constraint(expr=-(m.x498*m.x797 + m.x751*m.x820 + m.x1073*m.x774) == -15.1951)
m.c1489 = Constraint(expr=-(m.x499*m.x798 + m.x752*m.x821 + m.x1074*m.x775) == -16.0728)
m.c1490 = Constraint(expr=-(m.x500*m.x799 + m.x753*m.x822 + m.x1075*m.x776) == -16.9718)
m.c1491 = Constraint(expr=-(m.x501*m.x800 + m.x754*m.x823 + m.x1076*m.x777) == -17.9067)
m.c1492 = Constraint(expr=-(m.x502*m.x801 + m.x755*m.x824 + m.x1077*m.x778) == -18.9582)
m.c1493 = Constraint(expr=-(m.x503*m.x802 + m.x756*m.x825 + m.x1078*m.x779) == -20.0396)
m.c1494 = Constraint(expr=-(m.x504*m.x803 + m.x757*m.x826 + m.x1079*m.x780) == -21.1914)
m.c1495 = Constraint(expr=-(m.x505*m.x804 + m.x758*m.x827 + m.x1080*m.x781) == -22.3772)
m.c1496 = Constraint(expr=-(m.x506*m.x805 + m.x759*m.x828 + m.x1081*m.x782) == -23.5727)
m.c1497 = Constraint(expr=-(m.x507*m.x806 + m.x760*m.x829 + m.x1082*m.x783) == -24.7363)
| StarcoderdataPython |
1671478 | <gh_stars>10-100
### Problem Set 1
# Qn 1
s = 'azcbobobegghakl'
count = 0
for letter in s:
if letter in 'aeiou':
count += 1
print 'Number of vowels: ' + str(count)
# Qn 2
s = 'azcbobobegghakl'
count = 0
for i in range(len(s)):
three_letters = s[i:i+3]
if three_letters == 'bob':
count +=1
print 'Number of times bob occurs is: ' + str(count)
# Qn 3
s = 'abcdefgazcbobobegghakl'
s = 'qrvikzxwpddqqc'
longest_sub = ''
sub = s[0]
for i in range(1, len(s)):
if s[i] >= s[i-1]:
sub += s[i]
#print 'sub: ' + sub
else:
if len(longest_sub) < len(sub):
longest_sub = sub
#print 'longest_sub: ' + longest_sub
sub = s[i]
if len(longest_sub) < len(sub):
longest_sub = sub
print 'Longest substring in alphabetical order is: ' + longest_sub
| StarcoderdataPython |
91157 | <reponame>innofocus/haprestio
import time
from flask import jsonify
from flask_restplus import Resource
from flask_jwt_extended import create_access_token
from . import get_token2, get_token2_m
from ..data.accounts import Account
from ..auth.jwt import admin_required
@get_token2.route('/name=<string:name>/password=<string:password>')
@get_token2.doc(security=[])
class UserLogin2(Resource):
"""Login with account credentials and get a temporary token"""
@get_token2.doc(params={"name": "the tenant ID", "password": "<PASSWORD>"})
@get_token2.response(200,
'Success: Use the Authorization token in rest api call headers (clic the green Authorize) !',
get_token2_m)
@get_token2.response(401, 'Bad credentials. Same player shoot again.')
def get(self, name, password):
"""Login to retrieve a temporary Authorization token"""
if not Account(name).exists():
time.sleep(1)
adm_v1.abort(401, "Bad credentials")
if Account(name).check(password):
access_token = create_access_token(identity=name)
return jsonify(access_token=access_token)
else:
adm_v1.abort(401, "Bad credentials")
@get_token2.route('/impersonate=<string:name>')
class Impersonate(Resource):
"""Get account's token"""
@admin_required
@get_token2.doc(params={"name": "the tenant ID"})
@get_token2.response(200,
'Success: Use the Authorization token in rest api call headers (clic the green Authorize) !',
get_token2_m)
@get_token2.response(401, 'Bad credentials. Same player shoot again.')
def get(self, name):
"""Get temporary Authorization token for account"""
if not Account(name).exists():
time.sleep(1)
adm_v1.abort(401, "Bad account")
access_token = create_access_token(identity=name)
return jsonify(access_token=access_token) | StarcoderdataPython |
4840078 | from .pointer import Pointer
from typing import TypeVar, NoReturn
from .exceptions import IsFrozenError
import gc
__all__ = ("FrozenPointer", "to_const_ptr")
T = TypeVar("T")
class FrozenPointer(Pointer[T]):
def assign(self, _: Pointer[T]) -> NoReturn:
"""Point to a different address."""
raise IsFrozenError("cannot assign to frozen pointer")
def move(self, _: Pointer[T]) -> NoReturn:
"""Move data from another pointer to this pointer. Very dangerous, use with caution.""" # noqa
raise IsFrozenError("cannot move data to frozen pointer")
def to_const_ptr(val: T) -> FrozenPointer[T]:
"""Convert a value to a pointer."""
return FrozenPointer(id(val), type(val), gc.is_tracked(val))
| StarcoderdataPython |
3377625 | <gh_stars>0
#!/usr/bin/env python
"""Find labels that do not traverse through the volume.
"""
import sys
import argparse
import os
from operator import itemgetter
from itertools import groupby
from scipy.ndimage.morphology import binary_dilation as scipy_binary_dilation
import numpy as np
from skimage.measure import label, regionprops
from skimage.morphology import binary_dilation, binary_erosion, ball, watershed
from wmem import parse, utils, Image, LabelImage
from wmem.merge_labels import get_region_slices_around
# TODO: write elsize and axislabels
def main(argv):
"""Find labels that do not traverse through the volume."""
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser = parse.parse_nodes_of_ranvier(parser)
parser = parse.parse_common(parser)
args = parser.parse_args()
nodes_of_ranvier(
args.inputfile,
args.min_labelsize,
args.remove_small_labels,
args.boundarymask,
args.merge_methods,
args.overlap_threshold,
args.data,
args.maskMM,
args.searchradius,
args.outputfile,
args.save_steps,
args.protective,
)
def nodes_of_ranvier(
h5path_in,
min_labelsize=0,
remove_small_labels=False,
h5path_boundarymask='',
merge_methods=['neighbours'],
overlap_threshold=20,
h5path_data='',
h5path_mmm='',
searchradius=[100, 30, 30],
h5path_out='',
save_steps=False,
protective=False,
):
"""Find labels that do not traverse through the volume."""
# check output paths
outpaths = {'out': h5path_out,
'largelabels': '', 'smalllabelmask': '',
'boundarymask': '',
'labels_nt': '', 'labels_tv': '',
'filled': '',
}
root, ds_main = outpaths['out'].split('.h5')
for dsname, outpath in outpaths.items():
grpname = ds_main + "_steps"
outpaths[dsname] = os.path.join(root + '.h5' + grpname, dsname)
status = utils.output_check(outpaths, save_steps, protective)
if status == "CANCELLED":
return
# open data for reading
h5file_in, ds_in, elsize, axlab = utils.h5_load(h5path_in)
labels = ds_in[:] # FIXME: do we make a copy, or use ds_out?
# open data for writing
h5file_out, ds_out = utils.h5_write(None, ds_in.shape, ds_in.dtype,
h5path_out,
element_size_um=elsize,
axislabels=axlab)
# start with the set of all labels
ulabels = np.unique(labels)
maxlabel = np.amax(ulabels)
labelset = set(ulabels)
print("number of labels in labelvolume: {}".format(len(labelset)))
# get the labelsets that touch the borders
# sidesmask = get_boundarymask(h5path_boundarymask, ('ero', 3))
# sidesmask = get_boundarymask(h5path_boundarymask)
top_margin = 1 # 4 or 14
bot_margin = 1 # 4
sidesmask = get_boundarymask(h5path_boundarymask, ('invdil', 3), top_margin, bot_margin)
ls_bot = set(np.unique(labels[:bot_margin, :, :]))
ls_top = set(np.unique(labels[-top_margin:, :, :]))
ls_sides = set(np.unique(labels[sidesmask]))
ls_border = ls_bot | ls_top | ls_sides
ls_centre = labelset - ls_border
# get the labels that do not touch the border twice
ls_bts = (ls_bot ^ ls_top) ^ ls_sides
ls_tbs = (ls_top ^ ls_bot) ^ ls_sides
ls_sbt = (ls_sides ^ ls_bot) ^ ls_top
ls_nt = ls_centre | ls_bts | ls_tbs | ls_sbt
# filter labels on size
root = os.path.splitext(h5file_out.filename)[0]
ls_small = utils.filter_on_size(labels, labelset, min_labelsize,
remove_small_labels,
save_steps, root, ds_out.name[1:],
outpaths, elsize, axlab)[2]
labelset -= ls_small
ls_nt -= ls_small
ls_short = filter_on_heigth(labels, 0) # 5
labelset -= ls_short
ls_nt -= ls_short
ls_tv = labelset - ls_nt
print('number of large, long labels: {}'.format(len(labelset)))
print('number of large, long in-volume labels: {}'.format(len(ls_nt)))
print('number of large, long through-volume labels: {}'.format(len(ls_tv)))
labelsets = {l: set([l]) for l in ls_tv}
filestem = '{}_{}_tv_auto'.format(root, ds_out.name[1:])
utils.write_labelsets(labelsets, filestem, filetypes=['txt'])
labelsets = {l: set([l]) for l in ls_nt}
filestem = '{}_{}_nt_auto'.format(root, ds_out.name[1:])
utils.write_labelsets(labelsets, filestem, filetypes=['txt'])
# map the large labels that don't traverse the volume
fw_nt = np.zeros(maxlabel + 1, dtype='i')
for l in ls_nt:
fw_nt[l] = l
labels_nt = fw_nt[labels]
# automated label merge
labelsets = {}
# min_labelsize = 10
if 0:
labelsets, filled = merge_labels(labels_nt, labelsets, merge_methods,
overlap_threshold,
h5path_data, h5path_mmm,
min_labelsize,
searchradius)
# fw = np.zeros(maxlabel + 1, dtype='i')
ds_out[:] = utils.forward_map(np.array(fw_nt), labels, labelsets)
else:
filled = None
# fw = np.zeros(maxlabel + 1, dtype='i')
ds_out[:] = utils.forward_map(np.array(fw_nt), labels, labelsets)
if save_steps:
utils.save_step(outpaths, 'boundarymask', sidesmask, elsize, axlab)
utils.save_step(outpaths, 'labels_nt', labels_nt, elsize, axlab)
fw_tv = np.zeros(maxlabel + 1, dtype='i')
for l in ls_tv:
fw_tv[l] = l
labels_tv = fw_tv[labels]
utils.save_step(outpaths, 'labels_tv', labels_tv, elsize, axlab)
if filled is not None:
fw = np.zeros(maxlabel + 1, dtype='i')
filled = utils.forward_map(np.array(fw), filled, labelsets)
utils.save_step(outpaths, 'filled', filled, elsize, axlab)
filestem = '{}_{}_automerged'.format(root, ds_out.name[1:])
utils.write_labelsets(labelsets, filestem,
filetypes=['txt', 'pickle'])
# close and return
h5file_in.close()
try:
h5file_out.close()
except (ValueError, AttributeError):
return ds_out
def get_boundarymask(h5path_mask, masktype=('invdil', 7),
top_margin=4, bot_margin=4):
"""Load or generate a mask."""
mask = utils.h5_load(h5path_mask, load_data=True, dtype='bool')[0]
if masktype[0] == 'ero':
mask = binary_erosion(mask, ball(masktype[1]))
elif masktype[0] == 'invdil':
mask = scipy_binary_dilation(~mask, iterations=masktype[1], border_value=0)
mask[:bot_margin, :, :] = False
mask[-top_margin:, :, :] = False
return mask
def find_region_coordinates(direction, labels, prop, searchradius):
"""Find coordinates of a box bordering a partial label."""
"""NOTE:
prop.bbox is in half-open interval
"""
if direction == 'around': # a wider box around the label's bbox
z = max(0, int(prop.bbox[0]) - searchradius[0])
Z = min(labels.shape[0], int(prop.bbox[3]) + searchradius[0])
y = max(0, int(prop.bbox[1]) - searchradius[1])
Y = min(labels.shape[1], int(prop.bbox[4]) + searchradius[1])
x = max(0, int(prop.bbox[2]) - searchradius[2])
X = min(labels.shape[2], int(prop.bbox[5]) + searchradius[2])
return (x, X, y, Y, z, Z)
# get the z-range of a box above/below the label's bbox
elif direction == 'down': # a box below the label bbox
borderslice = int(prop.bbox[0])
z = max(0, borderslice - searchradius[0])
Z = borderslice
elif direction == 'up': # a box above the label bbox
borderslice = int(prop.bbox[3]) - 1
z = borderslice
Z = min(labels.shape[0], borderslice + searchradius[0])
# find the centroid of the label within the borderslice
labels_slc = np.copy(labels[borderslice, :, :])
labels_slc[labels_slc != prop.label] = 0
rp_bs = regionprops(labels_slc)
ctrd = rp_bs[0].centroid
# get the x,y-range of a box above/below the label's bbox
y = max(0, int(ctrd[0]) - searchradius[1])
Y = min(labels.shape[1], int(ctrd[0]) + searchradius[1])
x = max(0, int(ctrd[1]) - searchradius[2])
X = min(labels.shape[2], int(ctrd[1]) + searchradius[2])
return (x, X, y, Y, z, Z)
def merge_labels(labels, labelsets={}, merge_methods=[],
overlap_threshold=20,
h5path_data='', h5path_mmm='',
min_labelsize=10, searchradius=[100, 30, 30]):
"""Find candidate labelsets."""
# find connection candidates
for merge_method in merge_methods:
if merge_method == 'neighbours':
labelsets = merge_neighbours(labels, labelsets,
overlap_threshold)
filled = None
if merge_method == 'neighbours_slices':
labelsets = merge_neighbours_slices(labels, labelsets,
overlap_threshold)
filled = None
elif merge_method == 'conncomp':
labelsets = merge_conncomp(labels, labelsets)
filled = None
elif merge_method == 'watershed':
labelsets, filled = merge_watershed(labels, labelsets,
h5path_data, h5path_mmm,
min_labelsize, searchradius)
return labelsets, filled
def merge_neighbours(labels, labelsets={}, overlap_thr=20):
"""Find candidates for label merge based on overlapping faces."""
rp_nt = regionprops(labels)
for prop in rp_nt:
# get indices to the box surrounding the label
C = find_region_coordinates('around', labels, prop, [1, 1, 1])
x, X, y, Y, z, Z = C
# get a mask of voxels adjacent to the label (boundary)
imregion = labels[z:Z, y:Y, x:X]
labelmask = imregion == prop.label
boundary = np.logical_xor(binary_dilation(labelmask), labelmask)
# evaluate which labels overlap sufficiently with this mask
# TODO: dice-like overlap?
counts = np.bincount(imregion[boundary])
label_neighbours = np.argwhere(counts > overlap_thr)
label_neighbours = [l for ln in label_neighbours for l in ln]
if len(label_neighbours) > 1:
labelset = set([prop.label] + label_neighbours[1:])
labelsets = utils.classify_label_set(labelsets, labelset,
prop.label)
return labelsets
def merge_neighbours_slices(labels, labelsets={}, overlap_thr=20):
"""Find candidates for label merge based on overlapping faces."""
from wmem.merge_slicelabels import merge_neighbours
overlap_thr = 0.20
offsets = 2
rp_nt = regionprops(labels)
for prop in rp_nt:
# get indices to the box surrounding the label
C = find_region_coordinates('around', labels, prop, [0, 0, 0])
x, X, y, Y, z, Z = C
data_section = labels[z, y:Y, x:X]
data_section[data_section != prop.label] = 0
for j in range(1, offsets):
if z-j >= 0:
nb_section = labels[z-j, y:Y, x:X]
labelsets = merge_neighbours(labelsets,
data_section, nb_section,
threshold_overlap=overlap_thr)
data_section = labels[Z-1, y:Y, x:X]
data_section[data_section != prop.label] = 0
for j in range(1, offsets):
if Z-1+j < labels.shape[0]:
nb_section = labels[Z-1+j, y:Y, x:X]
labelsets = merge_neighbours(labelsets,
data_section, nb_section,
threshold_overlap=overlap_thr)
return labelsets
def merge_conncomp(labels, labelsets={}):
"""Find candidates for label merge based on connected components."""
# binarize labelvolume and relabel for connected components
labelmask = labels != 0
labels_connected = label(labelmask, connectivity=1)
# find the original labels contained in each connected component
# TODO: detection of non-contiguous components in the original?
rp = regionprops(labels_connected, labels)
for prop in rp:
counts = np.bincount(prop.intensity_image[prop.image])
labelset = set(list(np.flatnonzero(counts)))
if len(counts) > 1:
labelsets = utils.classify_label_set(labelsets, labelset,
prop.label)
return labelsets
def merge_watershed(labels, labelsets={},
h5path_data='', h5path_mmm='',
min_labelsize=10, searchradius=[100, 30, 30]):
"""Find candidates for label merge based on watershed."""
rp_nt = regionprops(labels)
labels_filled = np.copy(labels)
ds_data = utils.h5_load(h5path_data, load_data=True)[0]
if h5path_mmm:
ds_mask = utils.h5_load(h5path_mmm, load_data=True, dtype='bool')[0]
else:
ds_mask = np.zeros_like(ds_data, dtype='bool')
for prop in rp_nt:
# investigate image region above and below bbox
for direction in ['down', 'up']:
print('processing {}, direction {}'.format(prop.label, direction))
C = find_region_coordinates(direction, labels,
prop, searchradius)
x, X, y, Y, z, Z = C
if ((z == 0) or (z == labels.shape[0] - 1)):
continue
# TODO: improve searchregion by projecting along axon direction
# TODO: improve searchregion by not taking the groundplane of the whole label region
imregion = labels[z:Z, y:Y, x:X]
labels_in_region = np.unique(imregion)
# print(labels_in_region)
if len(labels_in_region) < 2:
continue # label 0 and prop.label assumed to be there
labelsets, wsout = find_candidate_ws(direction, labelsets, prop,
imregion,
ds_data[z:Z, y:Y, x:X],
ds_mask[z:Z, y:Y, x:X],
min_labelsize)
if wsout is not None:
labels_filled[z:Z, y:Y, x:X] = np.copy(wsout)
return labelsets, labels_filled
def find_candidate_ws(direction, labelsets, prop, imregion,
data, maskMM, min_labelsize=10):
"""Find a merge candidate by watershed overlap."""
wsout = None
idx = {'down': -1, 'up': 0}[direction]
# # do the watershed
mask = np.ones_like(imregion, dtype='bool')
mask[data < 0.25] = False
seeds = np.zeros_like(imregion, dtype='int')
seeds[idx, :, :][imregion[idx, :, :] == prop.label] = prop.label
seeds[idx, :, :][imregion[idx, :, :] != prop.label] = -1
ws = watershed(-data, seeds, mask=mask)
# """NOTE:
# seeds are in the borderslice,
# with the current label as prop.label
# (watershedded to fill the full axon),
# the maskMM as background, and the surround as negative label
# """
# # TODO: don't use -data; make it more general
# # TODO: implement string_mask?
# # fill the seedslice (outside of the myelin compartment)
# seeds = np.zeros_like(imregion, dtype='int')
# seeds[idx, :, :] = watershed(-data[idx, :, :],
# imregion[idx, :, :],
# mask=~maskMM[idx, :, :])
# # set all non-prop.label voxels to -1
# seeds[idx, :, :][seeds[idx, :, :] != prop.label] = -1
# # set the myelin voxels to 0
# seeds[idx, :, :][maskMM[idx, :, :]] = 0
# # do the watershed
# ws = watershed(-data, seeds, mask=~maskMM)
rp_ws = regionprops(ws, imregion) # no 0 in rp
labels_ws = [prop_ws.label for prop_ws in rp_ws]
try:
# select the watershed-object of the current label
idx = labels_ws.index(prop.label)
except ValueError:
pass
else:
# get the overlap (voxel count) of labels within the watershed object
counts = np.bincount(imregion[rp_ws[idx].image])
if len(counts) > 1:
# select the largest candidate overlapping the watershed
# TODO: improve criteria for accepting candidate
candidate = np.argmax(counts[1:]) + 1
# only select it if the overlap is larger than min_labelsize
if ((counts[candidate] > min_labelsize) and
(candidate != prop.label)):
print('merging {} and {}'.format(prop.label, candidate))
labelset = set([prop.label, candidate])
labelsets = utils.classify_label_set(labelsets, labelset,
prop.label)
wsout = ws
mask = ws != prop.label
wsout[mask] = imregion[mask]
return labelsets, wsout
def filter_on_heigth(labels, min_height, ls_short=set([])):
rp_nt = regionprops(labels)
for prop in rp_nt:
if prop.bbox[3]-prop.bbox[0] <= min_height:
ls_short |= set([prop.label])
print('number of short labels: {}'.format(len(ls_short)))
return ls_short
def correct_NoR(image_in):
"""Add a manually-defined set of labels to through-volume and remove from not-through."""
from wmem import LabelImage
# read the labelvolume
im = utils.get_image(image_in, imtype='Label')
comps = im.split_path()
# map and write the nt and tv volumes
def write_vol(outputpath, im, ls):
mo = LabelImage(outputpath, **im.get_props())
mo.create()
mo.write(im.forward_map(labelsets=ls, from_empty=True))
mo.close()
# pop manual tv-labels from auto-nt; add to auto-tv; write to tv/nt;
ls_stem = '{}_{}_NoR'.format(comps['base'], comps['dset'])
nt = utils.read_labelsets('{}_{}.txt'.format(ls_stem, 'nt_auto'))
tv = utils.read_labelsets('{}_{}.txt'.format(ls_stem, 'tv_auto'))
tv_man = utils.read_labelsets('{}_{}.txt'.format(ls_stem, 'tv_manual'))
for l in tv_man[0]:
nt.pop(l)
tv[l] = set([l])
for ls_name, ls in zip(['nt', 'tv'], [nt, tv]):
utils.write_labelsets(ls, '{}_{}'.format(ls_stem, ls_name), filetypes=['txt'])
dset_out = '{}_NoR_steps/labels_{}'.format(comps['dset'], ls_name)
outputpath = os.path.join(comps['file'], dset_out)
write_vol(outputpath, im, ls)
im.close()
def detect_NoR(image_in, maskMM, encapsulate_threshold=1.0, min_node_length=10, outputpath=''):
# Read inputs
axons = utils.get_image(image_in, imtype='Label')
mask = utils.get_image(maskMM, imtype='Mask')
# Create outputs
props = axons.get_props(protective=False)
outpaths = {'out': outputpath, 'seg': '', 'rim': '', 'nonodes': ''}
outpaths = utils.gen_steps(outpaths, save_steps=True)
nodes = LabelImage(outpaths['out'], **props)
nodes.create()
nonodes = LabelImage(outpaths['nonodes'], **props)
nonodes.create()
im_rim = LabelImage(outpaths['rim'], **props)
im_rim.create()
im_seg = LabelImage(outpaths['seg'], **props)
im_seg.create()
for prop in regionprops(axons.ds):
print(prop.label)
# Slice the axon region.
slices = get_region_slices_around(axons, prop, searchradius=[1, 1, 1])[0]
axons.slices = mask.slices = im_seg.slices = im_rim.slices = slices
axons_slcd = axons.slice_dataset(squeeze=False) == prop.label
mask_slcd = mask.slice_dataset(squeeze=False).astype('bool')
im_seg_slcd = im_seg.slice_dataset(squeeze=False)
im_rim_slcd = im_rim.slice_dataset(squeeze=False)
# Find labels not surrounded by myelin.
slc_idxs = []
iter_imgs = zip(axons_slcd, mask_slcd, im_seg_slcd, im_rim_slcd)
for i, (slc, slc_aux, slc_out, slc_rim) in enumerate(iter_imgs):
rim = np.logical_xor(binary_dilation(slc), slc)
slc_rim[rim] = prop.label
if encapsulate_threshold == 1.0:
is_encapsulated = slc_aux[rim].all()
else:
encapsulate_ratio = np.sum(slc_aux[rim]) / np.sum(rim)
is_encapsulated = encapsulate_ratio >= encapsulate_threshold
if not is_encapsulated:
slc_idxs.append(i)
slc_out[slc==True] = 1
# TODO: fill to mask OR add to mask
else:
slc_out[slc==True] = 2
# Extract the nodes (more than <min_node_length> consecutive slices).
for _, g in groupby(enumerate(slc_idxs), lambda x: x[1]-x[0]):
consecutive = list(map(itemgetter(1), g))
iter_imgs = zip(axons_slcd, im_seg_slcd)
for i, (slc, slc_out) in enumerate(iter_imgs):
if i in consecutive:
if len(consecutive) > min_node_length:
slc_out[slc==True] = 3
im_seg.write(im_seg_slcd)
im_rim.write(im_rim_slcd)
# Output the segmented nodes.
nodes_mask = im_seg.ds[:] == 3
nodes_data = np.zeros_like(nodes_mask, dtype='uint16')
nodes_data[nodes_mask] = axons.ds[nodes_mask]
nodes.write(nodes_data)
nodeless = np.copy(axons.ds[:])
nodeless[nodes_mask] = 0
nonodes.write(nodeless)
# Close images.
nodes.close()
nonodes.close()
im_rim.close()
im_seg.close()
mask.close()
axons.close()
return nodes
def cut_NoR(images_in, nodes_in, outputpostfix='_nonodes'):
nodes = utils.get_image(nodes_in, imtype='Label')
rp = regionprops(nodes.ds[:])
rp_map = {prop.label: prop for prop in rp}
for image_in in images_in:
labels = utils.get_image(image_in, imtype='Label')
out = np.copy(labels.ds[:])
for label in labels.ulabels:
if label == 0:
continue
try:
prop = rp_map[label]
except KeyError:
pass
else:
slc = slice(prop.bbox[0], prop.bbox[3], 1)
hl_cut = out[slc, :, :]
mask = hl_cut == label
# print(np.sum(out[:, :, :] == label))
hl_cut[mask] = 0
# print(np.sum(out[:, :, :] == label))
outputpath = image_in + outputpostfix
mo = Image(outputpath, **labels.get_props())
mo.create()
mo.write(out)
mo.close()
if __name__ == "__main__":
main(sys.argv[1:])
| StarcoderdataPython |
1650918 | import time, os
def main():
"""Testing CLI for the robot
"""
#os.system('clear')
while True:
data = input("Remote control [r], Calibrate [c] Autonomous [a] or Exit [x]: ").lower()
if data == "r":
print("Waiting for remote control commands")
time.sleep(10)
if data == "c":
print("Disconnect the battery and press Enter")
inp = input() #Add code to do relay connect/disconnect instead
print("Connect the battery now, you will here two beeps, then wait for a gradual falling tone then press Enter")
inp = input() #Add sleep as necessary instead
print("You should another tone from every motor")
for i in range(13):
if i%5==0:
print("{} seconds till next process".format(13-i))
time.sleep(1)
print("Motors spinning up for 10 seconds at the lowest speed")
print("Motors spinning down, and stopping")
elif data == "a":
print("Starting autonomous collection")
time.sleep(10)
elif data == "x":
exit()
else:
pass
print("")
if __name__ == "__main__":
exit(main())
| StarcoderdataPython |
3293680 | <gh_stars>10-100
#!/usr/bin/env python3
"""
This script downloads the latest MTG card data from http://mtgjson.com/ and processes
it to turn the highly-structured data there into a flat list of card names to descriptions
formatted to send down the chat.
"""
import common
common.FRAMEWORK_ONLY = True
import sys
import os
import urllib.request
import urllib.error
import urllib.parse
import contextlib
import time
import json
import re
import dateutil.parser
import psycopg2
from common import utils
from common.config import config
from common.card import clean_text, CARD_GAME_MTG
EXTRAS_FILENAME = 'extracards.json'
URLS = [
('https://mtgjson.com/api/v5/AllPrintings.json.xz', lambda: __import__('lzma').open, lambda f: f),
('https://mtgjson.com/api/v5/AllPrintings.json.bz2', lambda: __import__('bz2').open, lambda f: f),
('https://mtgjson.com/api/v5/AllPrintings.json.gz', lambda: __import__('gzip').open, lambda f: f),
('https://mtgjson.com/api/v5/AllPrintings.json.zip', lambda: __import__('zipfile').ZipFile, lambda zip: zip.open('AllPrintings.json')),
('https://mtgjson.com/api/v5/AllPrintings.json', lambda: open, lambda f: f),
]
def determine_best_file_format():
for url, loader_factory, member_loader in URLS:
try:
loader = loader_factory()
filename = os.path.basename(urllib.parse.urlparse(url).path)
def read_mtgjson():
with loader(filename) as f:
return json.load(member_loader(f))
return url, filename, read_mtgjson
except ImportError:
continue
else:
raise Exception("failed to discover a working file format")
URL, ZIP_FILENAME, read_mtgjson = determine_best_file_format()
def main():
force_run = False
progress = False
if '-f' in sys.argv:
sys.argv.remove('-f')
force_run = True
if '-p' in sys.argv:
sys.argv.remove('-p')
progress = True
if not do_download_file(URL, ZIP_FILENAME) and not os.access(EXTRAS_FILENAME, os.F_OK) and not force_run:
print("No new version of mtgjson data file")
return
print("Reading card data...")
mtgjson = read_mtgjson()['data']
try:
with open(EXTRAS_FILENAME) as fp:
extracards = json.load(fp)
except IOError:
pass
else:
mtgjson.update(extracards)
del extracards
print("Processing...")
processed_cards = {}
# Use raw `psycopg2` because in this case SQLAlchemy has significant overhead (about 60% of the total script runtime)
# without much of a benefit.
with psycopg2.connect(config['postgres']) as conn, conn.cursor() as cur:
cur.execute("DELETE FROM cards WHERE game = %s", (CARD_GAME_MTG, ))
for setid, expansion in sorted(mtgjson.items(), key=lambda e: e[1]['releaseDate'], reverse=True):
# Allow only importing individual sets for faster testing
if len(sys.argv) > 1 and setid not in sys.argv[1:]:
continue
if progress:
print("[%s]: %s - %s" % (expansion['releaseDate'], setid, expansion['name']))
processed_multiverseids = set()
for filteredname, cardname, description, multiverseids, hidden in process_set(setid, expansion):
if filteredname not in processed_cards:
cur.execute("INSERT INTO cards (game, filteredname, name, text, hidden) VALUES (%s, %s, %s, %s, %s) RETURNING id", (
CARD_GAME_MTG,
filteredname,
cardname,
description,
hidden,
))
card_id, = cur.fetchone()
processed_cards[filteredname] = card_id
else:
card_id = processed_cards[filteredname]
multiverseids = set(multiverseids) - processed_multiverseids
if multiverseids:
cur.executemany("INSERT INTO card_multiverse (id, cardid) VALUES (%s, %s)", [
(id, card_id)
for id in multiverseids
])
processed_multiverseids.update(multiverseids)
def do_download_file(url, fn):
"""
Download a file, checking that there is a new version of the file on the
server before doing so. Returns True if a download occurs.
"""
# Much of this code cribbed from urllib.request.urlretrieve, with If-Modified-Since logic added
req = urllib.request.Request(url, headers={
'User-Agent': "LRRbot/2.0 (https://lrrbot.com/)",
})
try:
stat = os.stat(fn)
except FileNotFoundError:
pass
else:
mtime = time.strftime('%a, %d %b %Y %H:%M:%S %z', time.gmtime(stat.st_mtime))
req.add_header('If-Modified-Since', mtime)
try:
fp = urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
if e.code == 304: # Not Modified
return False
else:
raise
print("Downloading %s..." % url)
with contextlib.closing(fp):
headers = fp.info()
with open(fn, 'wb') as tfp:
bs = 1024*8
size = None
read = 0
if "content-length" in headers:
size = int(headers["Content-Length"])
while True:
block = fp.read(bs)
if not block:
break
read += len(block)
tfp.write(block)
if size is not None and read < size:
os.unlink(fn)
raise urllib.error.ContentTooShortError(
"retrieval incomplete: got only %i out of %i bytes"
% (read, size), (fn, headers))
if "last-modified" in headers:
mtime = dateutil.parser.parse(headers['last-modified'])
mtime = mtime.timestamp()
os.utime(fn, (mtime, mtime))
return True
re_check = re.compile(r"^[a-z0-9_]+$")
re_mana = re.compile(r"\{(.)\}")
re_newlines = re.compile(r"[\r\n]+")
re_multiplespaces = re.compile(r"\s{2,}")
re_remindertext = re.compile(r"( *)\([^()]*\)( *)")
re_minuses = re.compile(r"(?:^|(?<=[\s/]))-(?=[\dXY])")
def process_card(card, expansion, include_reminder=False):
if not patch_card(card, expansion):
return
if card['layout'] in ('token', ): # don't care about these special cards for now
return
if card.get('layout') in ('split', 'aftermath', 'adventure'):
# Return split cards as a single card... for all the other pieces, return nothing
if card['side'] != 'a':
return
splits = [card]
for faceid in card['otherFaceIds']:
if faceid not in expansion['by_uuid']:
print("Can't find split card piece: %s" % faceid)
sys.exit(1)
splits.append(expansion['by_uuid'][faceid])
filteredparts = []
nameparts = []
descparts = []
allmultiverseids = []
anyhidden = False
for s in splits:
filtered, name, desc, multiverseids, hidden = process_single_card(s, expansion, include_reminder)
filteredparts.append(filtered)
nameparts.append(name)
descparts.append(desc)
allmultiverseids.extend(multiverseids)
anyhidden = anyhidden or hidden
filteredname = ''.join(filteredparts)
cardname = " // ".join(nameparts)
description = "%s | %s" % (card['name'], " // ".join(descparts))
yield filteredname, cardname, description, allmultiverseids, anyhidden
else:
yield process_single_card(card, expansion, include_reminder)
def try_process_card(card, expansion, include_reminder=False):
try:
yield from process_card(card, expansion, include_reminder)
except:
print("Error processing card %s [%s] %s" % (card['name'], expansion['code'], card['uuid']))
raise
def patch_card(card, expansion):
"""Temporary fixes for issues in mtgjson data.
Remember to also report these upstream."""
return True
def process_single_card(card, expansion, include_reminder=False):
# sanitise card name
cardname = card.get('faceName', card['name'])
filtered = clean_text(card.get('internalname', cardname))
if not re_check.match(filtered):
print("Still some junk left in name %s (%s)" % (card.get('internalname', cardname), json.dumps(filtered)))
print(json.dumps(card))
sys.exit(1)
def build_description():
yield cardname
if 'manaCost' in card:
yield ' ['
yield re_mana.sub(r"\1", card['manaCost'])
yield ']'
if card.get('layout') == 'flip':
if card['side'] == 'a':
yield ' (flip: '
else:
yield ' (unflip: '
yield expansion['by_uuid'][card['otherFaceIds'][0]]['faceName']
yield ')'
elif card.get('layout') in {'transform', 'modal_dfc'}:
if card['side'] == 'a':
yield ' (back: '
else:
yield ' (front: '
yield expansion['by_uuid'][card['otherFaceIds'][0]]['faceName']
yield ')'
elif card.get('layout') == 'meld':
# otherFaceIds on front faces points only to the back face
# otherFaceIds on the back face points to both front faces
if card['side'] == 'a':
melded_card = expansion['by_uuid'][card['otherFaceIds'][0]]
else:
melded_card = card
card_a = expansion['by_uuid'][melded_card['otherFaceIds'][0]]
card_b = expansion['by_uuid'][melded_card['otherFaceIds'][1]]
if card['side'] == 'a':
# mtgjson is inconsistent as to which of these is which
# check if "melds with cardname" is in the card text
if card is card_a:
other_card = card_b
else:
other_card = card_a
if '(Melds with %s.)' % other_card['faceName'] in card['text']:
yield ' (melds with: '
yield other_card['faceName']
yield '; into: '
yield melded_card['faceName']
yield ')'
else:
# The names of what this melds with and into are in the rules text
pass
elif card is melded_card:
yield ' (melds from: '
yield card_a['faceName']
yield '; '
yield card_b['faceName']
yield ')'
yield ' | '
yield card.get('type', '?Type missing?')
if 'power' in card or 'toughness' in card:
yield ' ['
yield shownum(card.get('power', '?'))
yield '/'
yield shownum(card.get('toughness', '?'))
yield ']'
if 'loyalty' in card:
yield ' ['
yield str(card['loyalty'])
yield ']'
if 'hand' in card or 'life' in card:
yield ' [hand: '
if 'hand' in card:
yield card['hand']
else:
yield "?"
yield ', life: '
if 'life' in card:
yield card['life']
else:
yield "?"
yield ']'
if 'text' in card:
yield ' | '
yield process_text(card['text'], include_reminder)
desc = ''.join(build_description())
desc = re_multiplespaces.sub(' ', desc).strip()
desc = utils.trim_length(desc)
if card.get('layout') == 'flip' and card['side'] != 'a':
multiverseids = []
else:
if card.get('layout') in {'transform', 'modal_dfc'}:
if card['side'] == 'b':
card['foreignData'] = [] # mtgjson doesn't seem to have accurate foreign multiverse ids for back faces
multiverseids = [card['identifiers']['multiverseId']] if card.get('identifiers', {}).get('multiverseId') else []
# disabling adding foreign multiverse ids unless we decide we want them for some reason
# they add a lot of time to the running of this script
#for lang in card.get('foreignData', []):
# if lang.get('multiverseId'):
# multiverseids.append(lang['multiverseId'])
hidden = 'internalname' in card
return filtered, cardname, desc, multiverseids, hidden
def process_text(text, include_reminder):
text = re_minuses.sub('\u2212', text) # replace hyphens with real minus signs
# Let Un-set cards keep their reminder text, since there's joeks in there
if not include_reminder:
text = re_remindertext.sub(lambda match: ' ' if match.group(1) and match.group(2) else '', text)
text = re_newlines.sub(' / ', text.strip())
return text
SPECIAL_SETS = {}
def special_set(setid):
def decorator(func):
SPECIAL_SETS[setid] = func
return func
return decorator
def process_set(setid, expansion):
expansion['by_uuid'] = {
card['uuid']: card
for card in expansion['cards']
if card.get('uuid')
}
handler = SPECIAL_SETS.get(setid, process_set_general)
yield from handler(expansion)
def process_set_general(expansion):
for card in expansion['cards']:
yield from try_process_card(card, expansion)
@special_set('AKH')
@special_set('HOU')
def process_set_amonkhet(expansion):
for card in expansion['cards']:
yield from try_process_card(card, expansion)
if {'Embalm', 'Eternalize'}.intersection(card.get('keywords', [])):
card['internalname'] = card['name'] + "_TKN"
card['name'] = card['name'] + " token"
card['subtypes'] = ["Zombie"] + card['subtypes']
make_type(card)
del card['manaCost']
del card['number']
del card['identifiers']
del card['foreignData']
if "Eternalize" in card['keywords']:
card['power'] = card['toughness'] = '4'
yield from try_process_card(card, expansion)
@special_set('UGL')
def process_set_unglued(expansion):
for card in expansion['cards']:
if card['name'] in {'B.F.M. (Big Furry Monster)', 'B.F.M. (Big Furry Monster) (b)'}: # do this card special
continue
yield from try_process_card(card, expansion, include_reminder=True)
yield (
"bfmbigfurrymonster",
"B.F.M. (Big Furry Monster)",
"B.F.M. (Big Furry Monster) (BBBBBBBBBBBBBBB) | Creature \u2014 The Biggest, Baddest, Nastiest, Scariest Creature You'll Ever See [99/99] | You must cast both B.F.M. cards to put B.F.M. onto the battlefield. If one B.F.M. card leaves the battlefield, sacrifice the other. / B.F.M. can’t be blocked except by three or more creatures.",
[9780, 9844],
False,
)
@special_set('UNH')
def process_set_unhinged(expansion):
for card in expansion['cards']:
yield from try_process_card(card, expansion, include_reminder=True)
@special_set('UST')
@special_set('UND')
def process_set_unstable(expansion):
hosts = []
augments = []
for card in expansion['cards']:
yield from try_process_card(card, expansion, include_reminder=True)
if card['layout'] == 'host':
hosts.append(card)
# for the benefit of the overlay
card['internalname'] = card['name'] + "_HOST"
card.pop('identifiers', None)
card.pop('number', None)
yield from try_process_card(card, expansion, include_reminder=True)
elif card['layout'] == 'augment':
augments.append(card)
card['internalname'] = card['name'] + "_AUG"
card.pop('identifiers', None)
card.pop('number', None)
yield from try_process_card(card, expansion, include_reminder=True)
for augment in augments:
for host in hosts:
yield gen_augment(augment, host, expansion)
HOST_PREFIX = "When this creature enters the battlefield,"
def gen_augment(augment, host, expansion):
combined = {
'layout': 'normal',
'internalname': "%s_%s" % (augment['internalname'], host['internalname']),
'manaCost': host['manaCost'],
'power': str(int(host['power']) + int(augment['power'])),
'toughness': str(int(host['toughness']) + int(augment['toughness'])),
}
host_part = host['name'].split()[-1]
augment_part = augment['name']
if augment_part[-1] != '-':
augment_part += ' '
combined['name'] = augment_part + host_part
combined['supertypes'] = [i for i in host.get('supertypes', []) if i != 'Host'] + augment.get('supertypes', [])
combined['types'] = [i for i in host['types'] if i != 'Creature'] + augment['types']
combined['subtypes'] = augment['subtypes'] + host['subtypes']
make_type(combined)
host_lines = host['text'].split("\n")
for host_ix, host_line in enumerate(host_lines):
if host_line.startswith(HOST_PREFIX):
break
else:
raise ValueError("Card text for host %r not expected" % host['name'])
host_line = host_line[len(HOST_PREFIX):].strip()
if host_line:
del host_lines[host_ix]
else:
# for some cards, the text is formatted as:
# "When this creature ETB, effect"
# but for others it's formatted as:
# "When this creature ETB,\neffect"
# for the latter, host_line will be empty at this point, and we need to grab
# the following line
host_line = host_lines[host_ix + 1]
del host_lines[host_ix:host_ix + 2]
augment_lines = augment['text'].split("\n")
for augment_ix, augment_line in enumerate(augment_lines):
if augment_line[-1] in {',', ':'}:
break
else:
raise ValueError("Card text for augment %r not expected" % augment['name'])
del augment_lines[augment_ix]
if augment_line[-1] == ':':
host_line = host_line[:1].upper() + host_line[1:]
combined_lines = host_lines + [augment_line + ' ' + host_line] + augment_lines
combined['text'] = "\n".join(combined_lines)
# don't include reminder text on the merged augment - the main reminder text
# on these cards is the reminder for Augment, which isn't relevent any more
return process_single_card(combined, expansion, include_reminder=False)
def make_type(card):
types = card['types']
if card.get('supertypes'):
types = card['supertypes'] + types
if card.get('subtypes'):
types = types + ["\u2014"] + card['subtypes']
typeline = ' '.join(types)
card['type'] = typeline
return typeline
def shownum(val):
# mtgjson gives the power/toughness of Unhinged cards as eg "3.5" rather than "3½"
# but it uses the "½" symbol in the rules text, so fix it here to match
if val.endswith('.5'):
val = val[:-2] + '½'
return val
if __name__ == '__main__':
main()
| StarcoderdataPython |
1688357 | from jinja2 import Environment, FileSystemLoader
import json
import os
import shutil
from datetime import datetime
from fuzzyset import FuzzySet
import os
currentDir = os.getcwd()
VARS = {
"site-detail":os.path.normpath(currentDir+"/database/site-detail.json"),
"gallery":os.path.normpath(currentDir+"/database/gallery/gallery-list.json"),
"more-gallery":os.path.normpath(currentDir+"/database/gallery/more-gallery.json"),
"service":os.path.normpath(currentDir+"/database/services/service-list.json"),
"category":os.path.normpath(currentDir+"/database/posts/category-list.json"),
"post":os.path.normpath(currentDir+"/database/posts/post-list.json"),
"date":os.path.normpath(currentDir+"/database/posts/date.json"),
"service-dir":os.path.normpath(currentDir+"/database/services"),
"mdHTML-dir":os.path.normpath(currentDir+"/database/posts/html"),
"saved-template":os.path.normpath(currentDir+"/baseHTML/saved/globals.html")
}
Files = {
"index":os.path.normpath(currentDir+"/output/index.html"),
"category":os.path.normpath(currentDir+"/output/category-post.html"),
"search":os.path.normpath(currentDir+"/output/search.html"),
"more":os.path.normpath(currentDir+"/output/more.html"),
"thankyou":os.path.normpath(currentDir+"/output/thankyou.html"),
"search-json":os.path.normpath(currentDir+"/output/posts/search.json"),
"post-cards":os.path.normpath(currentDir+"/output/posts/post-cards.html"),
"recent-posts":os.path.normpath(currentDir+"/output/posts/recent-posts.html"),
"category-dir":os.path.normpath(currentDir+"/output/posts/categories"),
}
class Renderer:
def __init__(self, siteDetail):
self.siteDetail = siteDetail
def homePage(self, galleries, services):
text = self.renderTemplate("index.html",
site = self.siteDetail,
galleries = galleries,
services = services,
)
self.save(text, Files['index'])
def searchPage(self):
text = self.renderTemplate("search.html", site = self.siteDetail)
self.save(text, Files["search"])
def categoryPage(self):
text = self.renderTemplate("category-post.html", site = self.siteDetail)
self.save(text, Files["category"])
def notFoundPage(self):
pass
def thanksPage(self):
text = self.renderTemplate("thankyou.html", site = self.siteDetail)
self.save(text, Files["thankyou"])
def moreGalleryPage(self, galleries):
text = self.renderTemplate("more-gallery.html",
site = self.siteDetail,
galleries = galleries
)
self.save(text, Files["more"])
def blog(self, post, categoriesBlogPage, mdHTML):
text = self.renderTemplate("blog.html",
site = self.siteDetail,
categories = categoriesBlogPage,
post = post,
mdHTML = mdHTML,
date = Model.postDate()
)
postFile = os.path.join(Files["category-dir"], post["category"], post["id"]+".html")
self.save(text, postFile)
def createSearchJson(self, posts):
self.save({"posts":posts}, Files["search-json"])
def postCard(self, posts, postDate):
text = self.renderTemplate("post-card.html",
posts = posts,
postDate = postDate,
)
self.save(text, Files["post-cards"])
def recentPost(self, posts, postDate):
newPosts = sorted(posts, key=lambda k: k['id'] , reverse=True)[:4]
text = self.renderTemplate("recent-posts.html",
posts = newPosts,
postDate = postDate,
)
self.save(text, Files["recent-posts"])
def refreshBlogs(self):
for post in Model.posts():
self.blog(post, Model.categoriesBlogPage(), Model.mdHTML(post["id"]))
def renderTemplate(self, templateName, **kwargs):
import sys
try:
base_path = sys._MEIPASS
except:
base_path = os.path.abspath(".")
templates_path = os.path.join(base_path, "SitegCore", "baseHTML")
fileLoader = FileSystemLoader(templates_path)
env = Environment(loader=fileLoader, trim_blocks=True, lstrip_blocks=True)
template = env.get_template(templateName)
return template.render(kwargs)
def save(self, text, file):
with open(file, 'w') as f:
if file != Files["search-json"]:
f.write(text)
else:
json.dump(text, f)
def deletePost(self, post):
print(post)
postFile = os.path.join(Files["category-dir"], post["category"], post["id"]+".html")
try:
os.remove(postFile)
except OSError:
pass
class Model:
def loadDB(file):
with open(file, "r") as f:
try:
formData = json.load(f)
return formData
except:
return {}
def formatSiteJson():
siteJson = Model.loadDB(VARS['site-detail'])
if "banner-subtitle" in siteJson:
siteJson["banner-subtitle"] = siteJson["banner-subtitle"].replace("\r\n", "<br>")
if "about-intro" in siteJson:
siteJson["about-intro"] = siteJson["about-intro"].split("\r\n")
return siteJson
def postDate():
dates = {}
for postId, postDate in Model.loadDB(VARS['date']).items():
dateTimeObj = datetime.strptime(postDate, "%Y-%m-%d")
dates[postId] = dateTimeObj.strftime("%b %d, %Y")
return dates
def services():
serviceFiles = Model.loadDB(VARS['service'])
if "services" in serviceFiles:
serviceFiles = serviceFiles["services"]
services = []
for serviceFile in serviceFiles:
service = Model.loadDB(os.path.join(VARS["service-dir"], serviceFile))
service["id"] = serviceFile.split(".")[0]
services.append(service)
return services
else:
return []
def galleries():
galleries = Model.loadDB(VARS['gallery'])
if "galleries" in galleries:
return galleries["galleries"]
return galleries
def moreGalleries():
return Model.loadDB(VARS['more-gallery'])
def categoriesBlogPage():
try:
posts = Model.loadDB(VARS['post'])['posts']
categories = Model.loadDB(VARS['category'])['categories']
jsonList = []
for category in categories:
length = 0
for post in posts:
if post["category"] == category:
length = length + 1
prettyName = ""
for pretty in category.strip().split("-"):
prettyName = prettyName+" "+pretty.capitalize()
jsonList.append({
"name":category,
"pretty":prettyName.strip(),
"post-length":length
})
return jsonList
except:
return []
def posts():
posts = Model.loadDB(VARS['post'])
if "posts" in posts:
return posts['posts']
return posts
def mdHTML(postId):
htmlFile = os.path.join(VARS['mdHTML-dir'], postId+".html")
if os.path.exists(htmlFile):
with open(htmlFile, "r") as f:
htmlText = f.read()
return htmlText
else:
return "This post is not written yet"
def post(postId):
posts = Model.loadDB(VARS['post'])
p = {}
if "posts" in posts:
posts = posts['posts']
for post in posts:
if post["id"] == postId:
p = post
return p
def getKeywords():
posts = Model.posts()
keywords = []
for post in posts:
if "keywords" in post:
keyword = list(filter(lambda x: x!="", post["keywords"]))+[post['title']]
else:
keyword = [post['title']]
keywords.append({
"id":post["id"],
"keywords":keyword
})
return keywords
def matchedIds(postId, threshold):
keywords = Model.getKeywords()
postKeywords = list(filter(lambda x: x["id"]==postId, keywords))[0]["keywords"]
matches = []
for keyword in keywords:
fs = FuzzySet(keyword['keywords'])
for pk in postKeywords:
if postId != keyword["id"]:
m = fs.get(pk)
if m:
for score, val in fs.get(pk):
if score>threshold:
matches.append((keyword["id"], score, val))
return matches
| StarcoderdataPython |
126260 | # Project Repository : https://github.com/robertapplin/N-Body-Simulations
# Authored by <NAME>, 2020
from n_body_simulations.body_marker import BodyMarker
from n_body_simulations.error_catcher import catch_errors
from n_body_simulations.simulation_animator import SimulationAnimator
from NBodySimulations import Vector2D
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QTableWidget, QTableWidgetItem
class DummyBodyTable(QTableWidget):
"""A class used as a dummy body data table for the purposes of testing."""
itemExited = pyqtSignal(QTableWidgetItem)
def __init__(self):
super(DummyBodyTable, self).__init__(None)
class DummyErrorProneClass:
"""A class used for testing the error catcher by causing various errors and exceptions."""
def __init__(self):
pass
def cause_an_uncaught_exception(self):
raise RuntimeError("This is a RuntimeError.")
@catch_errors()
def cause_an_exception(self):
raise RuntimeError("This is a RuntimeError.")
@catch_errors()
def divide_by_zero(self):
return 10 / 0
@catch_errors()
def index_out_of_range(self):
test_list = [0, 1, 2, 3]
return test_list[4]
@catch_errors()
def function_that_returns_nothing(self):
_ = 1 + 2
@catch_errors()
def function_that_returns_a_value(self):
return 1.0
class DummyInteractivePlot:
"""A class used as a dummy interactive plot for the purposes of testing the animator."""
def __init__(self):
self._figure = Figure()
self._canvas = FigureCanvas(self._figure)
self._ax = self._figure.add_subplot(111)
self.animator = SimulationAnimator(self._figure)
self.lines = {"Sun": self._ax.plot(0.0, 0.0)[0]}
self.body_markers = {"Sun":
BodyMarker(self._canvas, "green", "Sun", 1.0, Vector2D(0.0, 0.0), Vector2D(0.0, 0.0), True,
True, 1)}
| StarcoderdataPython |
3305466 | <reponame>manaswinidas/oh-github-source
"""
Asynchronous tasks that update data in Open Humans.
These tasks:
1. delete any current files in OH if they match the planned upload filename
2. adds a data file
"""
import logging
import json
import tempfile
import requests
import os
from celery import shared_task
from django.conf import settings
from open_humans.models import OpenHumansMember
from datetime import datetime, timedelta
from demotemplate.settings import rr
from requests_respectful import RequestsRespectfulRateLimitedError
from ohapi import api
import arrow
# Set up logging.
logger = logging.getLogger(__name__)
GITHUB_GRAPHQL_BASE = 'https://api.github.com/graphql'
GITHUB_API_BASE = 'https://api.github.com'
# GITHUB_API_STORY = GITHUB_API_BASE + '/feeds'
# GITHUB_API_REPO = GITHUB_API_BASE + '/user/repos'
# GITHUB_API_STARS = GITHUB_API_BASE + '/user/starred'
@shared_task
def process_github(oh_id):
"""
Update the github file for a given OH user
"""
logger.debug('Starting github processing for {}'.format(oh_id))
oh_member = OpenHumansMember.objects.get(oh_id=oh_id)
oh_access_token = oh_member.get_access_token(
client_id=settings.OPENHUMANS_CLIENT_ID,
client_secret=settings.OPENHUMANS_CLIENT_SECRET)
github_data = get_existing_github(oh_access_token)
github_member = oh_member.datasourcemember
github_access_token = github_member.get_access_token(
client_id=settings.GITHUB_CLIENT_ID,
client_secret=settings.GITHUB_CLIENT_SECRET)
update_github(oh_member, github_access_token, github_data)
def update_github(oh_member, github_access_token, github_data):
print(github_data)
try:
start_date_iso = arrow.get(get_start_date(github_data, github_access_token)).datetime.isocalendar()
print(start_date_iso)
print(type(start_date_iso))
github_data = remove_partial_data(github_data, start_date_iso)
stop_date_iso = (datetime.utcnow()
+ timedelta(days=7)).isocalendar()
# while start_date_iso != stop_date_iso:
print(f'processing {oh_member.oh_id}-{oh_member.oh_id} for member {oh_member.oh_id}')
# query = GITHUB_API_STORY + \
# '/{0}-W{1}?trackPoints=true&access_token={2}'.format(
# start_date_iso,
# stop_date_iso,
# github_access_token
# )
query = """
{
viewer{
login
url
id
email
bio
company
companyHTML
pullRequests{
totalCount
}
gists {
totalCount
}
company
repositoriesContributedTo(first:10){
totalCount
edges{
node{
name
id
forkCount
issues(first:5){
totalCount
edges{
node{
author{
resourcePath
}
assignees{
totalCount
}
}
}
}
}
}
}
repositories(isFork:false, first:10){
totalCount
edges{
node{
name
id
forkCount
issues(first:10){
totalCount
edges{
node{
author{
resourcePath
}
assignees{
totalCount
}
participants{
totalCount
}
}
}
}
}
}
}
forked: repositories(isFork:true, first:10){
totalCount
edges{
node{
name
id
forkCount
}
}
}
starredRepositories(first:10) {
totalCount
edges {
node {
name
id
forkCount
}
}
}
following(first:10){
totalCount
nodes{
name
id
url
}
}
followers(first:10) {
edges {
node {
name
id
url
}
}
}
}
}
"""
# Construct the authorization headers for github
auth_string = "Bearer " + github_access_token
auth_header = {"Authorization": auth_string}
# Make the request via POST, add query string & auth headers
response = rr.post(GITHUB_GRAPHQL_BASE, json={'query': query}, headers=auth_header, realms=['github'])
# Debug print
# response.json())
github_data = response.json()
print(github_data)
print('successfully finished update for {}'.format(oh_member.oh_id))
github_member = oh_member.datasourcemember
github_member.last_updated = arrow.now().format()
github_member.save()
except RequestsRespectfulRateLimitedError:
logger.debug(
'requeued processing for {} with 60 secs delay'.format(
oh_member.oh_id)
)
process_github.apply_async(args=[oh_member.oh_id], countdown=61)
finally:
replace_github(oh_member, github_data)
def replace_github(oh_member, github_data):
# delete old file and upload new to open humans
tmp_directory = tempfile.mkdtemp()
metadata = {
'description':
'Github activity feed, repository contents and stars data.',
'tags': ['demo', 'Github', 'test'],
'updated_at': str(datetime.utcnow()),
}
out_file = os.path.join(tmp_directory, 'github-data.json')
logger.debug('deleted old file for {}'.format(oh_member.oh_id))
api.delete_file(oh_member.access_token,
oh_member.oh_id,
file_basename="dummy-data.json")
with open(out_file, 'w') as json_file:
json.dump(github_data, json_file)
json_file.flush()
api.upload_aws(out_file, metadata,
oh_member.access_token,
project_member_id=oh_member.oh_id)
logger.debug('uploaded new file for {}'.format(oh_member.oh_id))
def remove_partial_data(github_data, start_date):
remove_indexes = []
for i, element in enumerate(github_data):
element_date = datetime.strptime(
element['date'], "%Y%m%d").isocalendar()[:2]
if element_date == start_date:
remove_indexes.append(i)
for index in sorted(remove_indexes, reverse=True):
del github_data[index]
return github_data
def get_start_date(github_data, github_access_token):
if not github_data:
url = GITHUB_API_BASE + "/user?access_token={}".format(
github_access_token
)
response = rr.get(url, wait=True, realms=['github'])
reso = response.json()
print(reso)
return reso['created_at']
else:
return github_data[-1]['date']
def get_existing_github(oh_access_token):
member = api.exchange_oauth2_member(oh_access_token)
for dfile in member['data']:
if 'Github' in dfile['metadata']['tags']:
# get file here and read the json into memory
tf_in = tempfile.NamedTemporaryFile(suffix='.json')
tf_in.write(requests.get(dfile['download_url']).content)
tf_in.flush()
github_data = json.load(open(tf_in.name))
return github_data
return []
| StarcoderdataPython |
3305136 | import requests
import json
import urllib
import pandas as pd
if __name__ == '__main__':
with open('appcreds.txt', 'r') as credfile:
uid, secret = credfile.read().splitlines()
r = requests.post("https://api.intra.42.fr/oauth/token", data={'grant_type': 'client_credentials', 'client_id': uid, 'client_secret': secret})
r.raise_for_status()
access_token = json.loads(r.text)['access_token']
print(access_token)
url = 'https://api.intra.42.fr/v2/cursus/21/projects?access_token=%s' % (access_token)
page = 1
links = []
while 1:
#for i in range(9):
f = urllib.request.urlopen(url + "&page=" + str(page))
res = json.loads(f.read())
print(page)
if res:
links += res
else:
break
page += 1
with open('42_projects_info.json', 'w') as outfile:
json.dump(links, outfile)
#print(df)
| StarcoderdataPython |
1631292 | '''
Author: Ligcox
Date: 2021-04-06 15:20:21
LastEditors: Ligcox
LastEditTime: 2021-08-20 16:15:36
Description: Program decision level, all robot decision information should be processed by this module and then sent.
Apache License (http://www.apache.org/licenses/)
Shanghai University Of Engineering Science
Copyright (c) 2021 Birdiebot R&D department
'''
import math
from module import *
from utils import *
from config.config import *
class Decision(module):
def __init__(self, robot, hide_controls=False):
'''
description: 决策层类
param {*}
return {*}
'''
super().__init__(hide_controls)
self.robot = robot
self.armour_time_queue = Queue()
self.gimbal_filter_Kalman_init()
self.last_yaw_angle, self.last_pitch_angle = 0, 0
def empty_disable_time(self, disableTime=1):
'''
:brief: 清除超过disableTime的时间,防止queue无限扩大
:param: disableTime:清除无效时间的间隔
'''
now_time = time.time()
if not self.armour_time_queue.empty():
try:
while now_time - self.armour_time_queue.queue[0] >= disableTime:
self.armour_time_queue.get(False)
except:
pass
else:
self.last_yaw_angle, self.last_pitch_angle = 0, 0
return None
def gimbal_filter_Kalman_init(self):
'''
description: 卡尔曼滤波函数初始化
param {*}
return {*}
'''
# 初始化测量坐标和鼠标运动预测的数组
self.last_measurement = self.current_measurement = np.array(
(2, 1), np.float32)
self.last_prediction = self.current_prediction = np.zeros(
(2, 1), np.float32)
# 4:状态数,包括(x,y,dx,dy)坐标及速度(每次移动的距离);2:观测量,能看到的是坐标值
self.kalman = cv2.KalmanFilter(4, 2)
self.kalman.measurementMatrix = np.array(
[[1, 0, 0, 0], [0, 1, 0, 0]], np.float32) # 系统测量矩阵
self.kalman.transitionMatrix = np.array(
[[1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]], np.float32) # 状态转移矩阵
self.kalman.processNoiseCov = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [
0, 0, 0, 1]], np.float32) * 0.03 # 系统过程噪声协方差
def gimbal_filter_Kalman(self, yaw, pitch):
'''
description: 卡尔曼滤波函数
param {*yaw: 云台偏转yaw角度, *pitch: 云台偏转pitch角度}
return {*cpx: 补偿后的云台偏转yaw角度, *cpy:补偿后的云台偏转pitch角度}
'''
self.last_prediction = self.current_prediction # 把当前预测存储为上一次预测
self.last_measurement = self.current_measurement # 把当前测量存储为上一次测量
self.current_measurement = np.array(
[[np.float32(yaw)], [np.float32(pitch)]]) # 当前测量
self.kalman.correct(self.current_measurement) # 用当前测量来校正卡尔曼滤波器
self.current_prediction = self.kalman.predict() # 计算卡尔曼预测值,作为当前预测
# 当前预测坐标
cpx, cpy = self.current_prediction[:2]
return cpx, cpy
def adjust_ballistics(self, targetInfo, BarrelPtzOffSetY, BallSpeed):
"""
brief : 弹道补偿
targetInfo : 包括 Angle 目标角度 ,distance 目标距离
BarrelPtzOffSetY : 相机中心和炮管中心距离 向上为正
BallSpeed : 弹丸速度
"""
ration = math.radians(targetInfo.Angle)
distance = targetInfo.distance
Z = distance * math.cos(ration)
Y = distance * math.sin(ration)
DownTime = Y / 1000.0 / BallSpeed # 下坠时间
offsetGravity = 0.5 * 9.8 * DownTime ** 2 * 1000 # 下落距离
Y += offsetGravity
if BarrelPtzOffSetY != 0:
alpha = math.asin(BarrelPtzOffSetY / (Y * Y + Z * Z))
if Y < BarrelPtzOffSetY:
"目标在炮管中心下方"
Beta = math.atan(-Y / Z)
Ration = -(-alpha + Beta)
NeedAngle = math.degrees(Ration)
elif Y < 0:
"目标在相机中心和炮管中心夹角区域"
Beta = math.atan(Y / Z)
Ration = -(alpha - Beta)
NeedAngle = math.degrees(Ration)
else:
"目标在相机中心上方"
Beta = math.atan(Y / Z)
Ration = (Beta - alpha)
NeedAngle = math.degrees(Ration)
return NeedAngle
def pnp_error_compensation(self, ROI_RECT, distance):
'''
description: pnp解算远距离是预测位置偏下额外做补偿
param {*ROI_RECT: 装甲板RECT信息, distance: 装甲板距离}
return {*}
'''
w, h = 640, 480
x, y = ROI_RECT[0]
x, y = x-w/2, y-h/2
# x = x*distance*0.001
# print(y, distance)
if distance > 3000:
x = 0
y = distance*self.getControlVal("pitch_pnp_error")/1000
else:
x, y = 0, 0
return x, y
def differential_filter(self, yaw_speed, pitch_spend):
'''
@description: 通过两次目标之间的差分获得此次击打目标的提前量
@param {*yaw_speed: 当前yaw信息, *pitch_spend: 当前pitch信息}
@return {*}
'''
d_y = yaw_speed - (self.last_yaw_angle)
d_p = pitch_spend - (self.last_pitch_angle)
d_y = abs_min_filter(d_y, 0.3)
d_p = abs_min_filter(d_p, 0.3)
d_y = abs_max_filter(d_y, 1)
d_p = abs_max_filter(d_p, 1)
yaw_speed += d_y
pitch_spend += d_p
return yaw_speed, pitch_spend
def gimbal_send(self, mode, yaw_angle, pitch_angle, isShoot):
'''
description: 将yaw_angle, pitch_angle, isShoot三个数据打包直接发送
param {*}
return {*}
'''
self.robot.mode_ctrl(mode)
self.robot.gimbal(yaw_angle, pitch_angle)
self.robot.barrel(30, isShoot)
class SentryDecision(Decision):
def __init__(self, robot, hide_controls=False):
'''
description: 哨兵决策层,若有多个云台应该由该类派生
param {*}
return {*}
'''
super().__init__(robot, hide_controls=hide_controls)
def armour_process(self, armour_list):
'''
@description: 装甲板识别任务,取出最近的装甲板作为击打的对象
@param {*}
@return {*}yaw、pitch偏转角度,枪口是否发射
'''
yaw_angle, pitch_angle, isShoot = 0, 0, 0
# 先清除失效时间
self.empty_disable_time()
if len(armour_list) != 0:
# 寻找装甲板列表中最近的装甲板
def f(x): return x[-1][0]
armour_list.sort(key=f)
ROI_RECT, ROI_BOX, PNP_LIST = armour_list[0]
distance, yaw_angle, pitch_angle = PNP_LIST
# 将最后发现装甲板的时间点存入时间序列、
self.armour_time_queue.put(time.time())
# 弹道补偿
# 远距离给予额外的控制量
yaw_angle_error, pitch_angle_error = self.pnp_error_compensation(
ROI_RECT, distance)
yaw_angle += yaw_angle_error
pitch_angle += pitch_angle_error
yaw_angle += self.getControlVal("yaw_angle_offset")
pitch_angle += self.getControlVal("pitch_angle_offset")
yaw_angle = abs_max_filter(yaw_angle, 3)
pitch_angle = abs_max_filter(pitch_angle, 3)
# 一秒内发现五帧目标
if self.armour_time_queue.qsize() >= 5:
yaw_angle, pitch_angle = self.differential_filter(
yaw_angle, pitch_angle)
self.gimbal_send(1, yaw_angle, pitch_angle, 1)
self.last_yaw_angle = yaw_angle
self.last_pitch_angle = pitch_angle
else:
self.gimbal_send(1, yaw_angle, pitch_angle, 0)
# 未发现装甲板
else:
# 由于击打装甲板闪烁无法找到装甲板
if self.armour_time_queue.qsize() >= 30:
self.gimbal_send(1, self.last_yaw_angle,
self.last_pitch_angle, 1)
# 未发现目标,由下位机接管或进入微调模式
else:
isShoot = 0xFF
return yaw_angle, pitch_angle, isShoot
class SentryDownDecision(SentryDecision):
def __init__(self, robot, hide_controls=False):
'''
description: 哨兵下云台决策层
param {*}
return {*}
'''
self.controls = sentryDown_decision_controls
self.name = "sentryDown_decision"
super().__init__(robot, hide_controls)
class SentryUpDecision(SentryDecision):
def __init__(self, robot, hide_controls=False):
'''
description: 哨兵上云台决策层
param {*}
return {*}
'''
self.controls = sentryUp_decision_controls
self.name = "sentryUp_decision"
super().__init__(robot, hide_controls)
class GroundDecison(Decision):
def __init__(self, robot, hide_controls=False):
'''
description: 地面机器人决策层,其他地面机器人应该由该类派生
param {*}
return {*}
'''
super().__init__(robot, hide_controls=hide_controls)
def armour_process(self, armour_list):
'''
:breif: 装甲板识别任务,取出最近的装甲板作为击打的对象
:return: yaw、pitch偏转角度,枪口是否发射
'''
yaw_angle, pitch_angle, isShoot = 0, 0, 0
yaw_angle_offset = self.getControlVal("yaw_angle_offset")
pitch_angle_offset = self.getControlVal("pitch_angle_offset")
if len(armour_list) != 0:
# 寻找装甲板列表中最靠近中心的装甲板
def f(x):
return (x[-1][1]-yaw_angle_offset)**2 + (x[-1][2]-pitch_angle_offset)**2
armour_list.sort(key=f)
ROI_RECT, ROI_BOX, PNP_LIST = armour_list[0]
distance, yaw_angle, pitch_angle = PNP_LIST
yaw_angle += yaw_angle_offset
pitch_angle += pitch_angle_offset
yaw_angle = abs_max_filter(yaw_angle, 3)
pitch_angle = abs_max_filter(pitch_angle, 3)
isShoot = 1
self.last_yaw_angle = yaw_angle
self.last_pitch_angle = pitch_angle
# 未发现目标,由下位机接管
else:
isShoot = 0xFF
self.last_yaw_angle = 0xFFFF
self.last_pitch_angle = 0xFFFF
return yaw_angle, pitch_angle, isShoot
class HeroDecision(GroundDecison):
def __init__(self, robot, hide_controls=False):
'''
description: 英雄机器人决策层
param {*}
return {*}
'''
self.controls = hero_decision_controls
self.name = "hero_decision"
self.armour_time_queue = Queue()
super().__init__(robot, hide_controls)
class InfantryDecision(GroundDecison):
def __init__(self, robot, hide_controls=False):
'''
description: 步兵机器人决策层
param {*}
return {*}
'''
self.controls = decision_controls
self.name = "infantry_decision"
self.armour_time_queue = Queue()
super().__init__(robot, hide_controls)
def energy_process(self, armour_list):
'''
:breif: 能量机关识别任务,识别点亮的能量机关
:return: yaw、pitch偏转角度
'''
yaw_angle, pitch_angle, isShoot = 0, 0, 0
# 先清除失效时间
self.empty_disable_time()
if len(armour_list) != 0:
ROI_RECT, ROI_BOX, PNP_LIST = armour_list[0]
distance, yaw_angle, pitch_angle = PNP_LIST
if distance>4000:
pitch_angle += 0.2*distance/1000
yaw_angle += self.getControlVal("yaw_angle_offset")
pitch_angle += self.getControlVal("pitch_angle_offset")
isShoot = 1
# 未发现目标,由下位机接管
else:
isShoot = 0
return yaw_angle, pitch_angle, isShoot
| StarcoderdataPython |
10457 | <filename>model/net_qspline_A.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 21 19:52:22 2020
#Plan A
@author: 18096
"""
'''Defines the neural network, loss function and metrics'''
#from functools import reduce
import torch
import torch.nn as nn
from torch.nn.functional import pad
from torch.autograd import Variable
import logging
logger = logging.getLogger('DeepAR.Net')
class Net(nn.Module):
def __init__(self, params,device):
'''
We define a recurrent network that predicts the future values
of a time-dependent variable based on past inputs and covariates.
'''
super(Net, self).__init__()
self.params = params
self.device = device
self.lstm = nn.LSTM(input_size=params.lstm_input_size,
hidden_size=params.lstm_hidden_dim,
num_layers=params.lstm_layers,
bias=True,
batch_first=False,
dropout=params.lstm_dropout)
# initialize LSTM forget gate bias to be 1 as recommanded by
# http://proceedings.mlr.press/v37/jozefowicz15.pdf
for names in self.lstm._all_weights:
for name in filter(lambda n: "bias" in n, names):
bias = getattr(self.lstm, name)
n = bias.size(0)
start, end = n // 4, n // 2
bias.data[start:end].fill_(1.)
#Plan A:
#beta_01:[beta0,beta1]
self.beta_n1 = nn.Linear(
params.lstm_hidden_dim * params.lstm_layers, 1)
self.pre_beta_1 = nn.Linear(
params.lstm_hidden_dim * params.lstm_layers, 1)
self.pre_sigma = nn.Linear(
params.lstm_hidden_dim * params.lstm_layers, params.num_spline)
self.pre_gamma = nn.Linear(
params.lstm_hidden_dim * params.lstm_layers, params.num_spline)
# softmax to make sure Σu equals to 1
self.sigma = nn.Softmax(dim=1)
# softplus to make sure gamma is positive
self.gamma = nn.Softplus()
# softplus to make sure beta0 is positive
self.beta_1 = nn.Softplus()
def forward(self, x, hidden, cell):
_, (hidden, cell) = self.lstm(x, (hidden, cell))
# use h from all three layers to calculate mu and sigma
hidden_permute = \
hidden.permute(1, 2, 0).contiguous().view(hidden.shape[1], -1)
#Plan A:
beta_n1 = self.beta_n1(hidden_permute)
pre_beta_1 = self.pre_beta_1(hidden_permute)
beta_1 = self.beta_1(pre_beta_1)
beta_1=-beta_1
pre_sigma = self.pre_sigma(hidden_permute)
sigma = self.sigma(pre_sigma)
pre_gamma = self.pre_gamma(hidden_permute)
gamma = self.gamma(pre_gamma)
#Plan A:
return ((beta_n1,beta_1,sigma,torch.squeeze(gamma)),hidden,cell)
def init_hidden(self, input_size):
return torch.zeros(self.params.lstm_layers, input_size,
self.params.lstm_hidden_dim,
device=self.device)
def init_cell(self, input_size):
return torch.zeros(self.params.lstm_layers, input_size,
self.params.lstm_hidden_dim,
device=self.device)
def predict(self, x, hidden, cell, sampling=False):
"""
generate samples by sampling from
"""
batch_size = x.shape[1]
samples = torch.zeros(self.params.sample_times,batch_size,
self.params.pred_steps,
device=self.device)
for j in range(self.params.sample_times):
decoder_hidden = hidden
decoder_cell = cell
for t in range(self.params.pred_steps):
func_param,decoder_hidden,decoder_cell=\
self(x[self.params.pred_start+t].unsqueeze(0),
decoder_hidden,decoder_cell)
beta_n1,beta_1,sigma,gamma=func_param
#pred_cdf is a uniform ditribution
uniform = torch.distributions.uniform.Uniform(
torch.tensor([0.0], device=sigma.device),
torch.tensor([1.0], device=sigma.device))
pred_cdf=uniform.sample([batch_size])
beta_0=gamma[:,:1]-2*beta_1*sigma[:,:1]
beta_N=torch.cat((beta_n1,beta_0),dim=1)
beta=pad(gamma,(1,0))[:,:-1]
beta[:,0]=beta_0[:,0]
beta=(gamma-beta)/(2*sigma)
beta=beta-pad(beta,(1,0))[:,:-1]
beta[:,-1]=gamma[:,-1]-beta[:,:-1].sum(dim=1)
ksi=pad(torch.cumsum(sigma,dim=1),(1,0))[:,:-1]
indices=ksi<pred_cdf
pred=(beta_N*pad(pred_cdf,(1,0),value=1)).sum(dim=1)
pred=pred+((pred_cdf-ksi).pow(2)*beta*indices).sum(dim=1)
samples[j, :, t] = pred
#predict value at t-1 is as a covars for t,t+1,...,t+lag
for lag in range(self.params.lag):
if t<self.params.pred_steps-lag-1:
x[self.params.pred_start+t+1,:,0]=pred
sample_mu = torch.mean(samples, dim=0) # mean or median ?
sample_std = samples.std(dim=0)
return samples, sample_mu, sample_std
def loss_fn(func_param, labels: Variable):
beta_n1,beta_1,sigma,gamma=func_param
beta_0=gamma[:,:1]-2*beta_1*sigma[:,:1]
beta_N=torch.cat((beta_n1,beta_0),dim=1)
beta=pad(gamma,(1,0))[:,:-1]
beta[:,0]=beta_0[:,0]
beta=(gamma-beta)/(2*sigma)
beta=beta-pad(beta,(1,0))[:,:-1]
beta[:,-1]=gamma[:,-1]-beta[:,:-1].sum(dim=1)
#calculate the maximum for each segment of the spline
ksi=torch.cumsum(sigma,dim=1)
df1=ksi.expand(sigma.shape[1],sigma.shape[0],sigma.shape[1]).T.clone()
df2=pad(ksi.T.unsqueeze(2),(1,0),'constant',value=1)
ksi=pad(ksi,(1,0))[:,:-1]
knots=df1-ksi
knots[knots<0]=0
knots=(df2*beta_N).sum(dim=2)+(knots.pow(2)*beta).sum(dim=2)
knots=pad(knots.T,(1,0))[:,:-1]#F(ksi_1~K)=0~max
diff=labels.view(-1,1)-knots
alpha_l=diff>0
alpha_A=torch.sum(alpha_l*beta,dim=1)
alpha_B=beta_N[:,1]-2*torch.sum(alpha_l*beta*ksi,dim=1)
alpha_C=beta_N[:,0]-labels+torch.sum(alpha_l*beta*ksi*ksi,dim=1)
#since A may be zero, roots can be from different methods.
not_zero=(alpha_A!=0)
alpha=torch.zeros_like(alpha_A)
#since there may be numerical calculation error,#0
idx=(alpha_B**2-4*alpha_A*alpha_C)<0#0
diff=diff.abs()
index=diff==(diff.min(dim=1)[0].view(-1,1))
index[~idx,:]=False
#index=diff.abs()<1e-4#0,1e-4 is a threshold
#idx=index.sum(dim=1)>0#0
alpha[idx]=ksi[index]#0
alpha[~not_zero]=-alpha_C[~not_zero]/alpha_B[~not_zero]
not_zero=~(~not_zero | idx)#0
delta=alpha_B[not_zero].pow(2)-4*alpha_A[not_zero]*alpha_C[not_zero]
alpha[not_zero]=(-alpha_B[not_zero]+torch.sqrt(delta))/(2*alpha_A[not_zero])
crps_1=labels*(2*alpha-1)
#lam2=lambda n:2*beta_N[:,n-1]*(1/n/(n+1)-alpha.pow(n)/n)
#crps_2=reduce(lambda a,b:a+b,[lam2(n) for n in range(1,2+1)])
crps_2=beta_N[:,0]*(1-2*alpha)+beta_N[:,1]*(1/3-alpha.pow(2))
crps_3=torch.sum(2*beta/((2+1)*(2+2))*(1-ksi).pow(2+2),dim=1)
crps_4=torch.sum(alpha_l*2*beta/(2+1)*(torch.unsqueeze(alpha,1)-ksi).pow(2+1),dim=1)
crps=crps_1+crps_2+crps_3-crps_4
crps = torch.mean(crps)
return crps
| StarcoderdataPython |
85557 | import logging
import os
import pickle
import sys
from functools import partial
from os.path import join, exists, basename, dirname
try:
from typing import Dict
except:
pass
try:
import notify2 as notify
notify.init('Youtube Playlist')
except:
pass
import unicodedata
from youtube_dl import YoutubeDL
from youtube_dl.utils import sanitize_filename, ExtractorError
def _print_progress(current_idx, total_songs, song_title):
# Clear the line from the previous download
sys.stdout.write('\r' + ' ' * 80)
sys.stdout.flush()
# Truncate the song title to fit into console
if len(song_title) > 80:
# Remove 12 because 3 for ellipsis and 9 for progress format
song_title = '%s...' % song_title[:80 - 12]
# We show the currently being downloaded song
sys.stdout.write(
'\r[%3d/%3d] %s' % (current_idx, total_songs, song_title)
)
sys.stdout.flush()
def _print_message(message):
sys.stdout.write('\r' + ' ' * 80)
sys.stdout.flush()
sys.stdout.write('\r%s\n' % message)
sys.stdout.flush()
def _send_notification(title, message):
# type: (str, str) -> None
"""Send a system notification."""
try:
notification = notify.Notification(summary=title, message=message)
notification.set_urgency(notify.URGENCY_LOW)
notification.show()
except:
pass
class Playlist:
DATA_FILE_NAME = 'data.p'
def __init__(self, playlist_info, directory, ytl):
# type: (Dict, str, YoutubeDL) -> None
self.id = playlist_info['id']
self.name = playlist_info['title']
self.uploader = playlist_info['uploader']
self.directory = join(directory, self.name)
self.data_file = join(self.directory, self.DATA_FILE_NAME)
self._upstream_data = {
entry['id']: Song(entry, ytl, playlist=self)
for entry in playlist_info['entries']
}
self.__ytl = ytl
self._local_data = self.__get_local_data()
self.non_tracked_songs = self.get_non_tracked_songs()
self.__local_ids = set(self._local_data.keys())
self.__upstream_ids = set(self._upstream_data.keys())
self.__synced_song_ids = self.__upstream_ids & self.__local_ids
self.__to_remove_song_ids = self.__local_ids - self.__upstream_ids
self.__to_download_song_ids = self.__upstream_ids - self.__local_ids
def __get_local_data(self):
local_data = {}
# Attempt to read pickled list of song data from fs, otherwise assume
# no songs have been downloaded
try:
with open(self.data_file, 'rb') as file:
loaded_data = pickle.load(file)
# Check that the loaded playlist is the same as this one
assert loaded_data['id'] == self.id
assert loaded_data['name'] == self.name
except FileNotFoundError:
logging.info('Data file not found. Assume empty local data.')
# If the data is corrupt, there's nothing we can do, so remove it
except (EOFError, TypeError):
logging.warning('Unable to read data file. Removing...')
os.remove(self.data_file)
except AssertionError:
logging.warning('The data file contains data for different '
'playlist. Removing...')
os.remove(self.data_file)
# Process the local data file and set up the `local_data`
try:
if exists(self.directory):
normalize = partial(unicodedata.normalize, 'NFC')
all_files = os.listdir(self.directory)
normalized_files = filter(lambda f: '.mp3' in f, all_files)
normalized_files = list(map(normalize, normalized_files))
normalized_files_set = set(normalized_files)
else:
all_files = normalized_files = []
normalized_files_set = set()
for song_id in loaded_data['songs']:
song = Song.from_info(
loaded_data['songs'][song_id], self.__ytl, playlist=self
)
# Check if the song actually exists on the file system, if it
# does, add it to the local data. Also keep the song in local
# data if it has been copyrighted
if exists(song.file_path) or song.copyrighted:
local_data[song_id] = song
# Some tracks contain special characters in their titles, and
# are written to disk differently, therefore we normalize them
# first, then compare
elif normalize(basename(song.file_path)) in normalized_files_set:
song_dir = dirname(song.file_path)
song.file_path = join(
song_dir,
all_files[normalized_files.index(
normalize(basename(song.file_path)))]
)
local_data[song_id] = song
logging.info('Track `%s` was matched with utf decoded '
'filename' % song.title)
else:
logging.info('%s found in data file, but not on disk. '
'Removing from data...' % song.title)
# `loaded_data` only exists when parsing the data file succeeded. This
# is in a separate try/except to make logging simpler.
except UnboundLocalError:
pass
return local_data
def get_non_tracked_songs(self):
"""List all mp3 files that are not being tracked."""
non_tracked_songs = []
if exists(self.directory):
all_files = os.listdir(self.directory)
all_files = filter(lambda f: '.mp3' in f, all_files)
tracked_songs = {
basename(song.file_path) for song in self._local_data.values()
}
for file in all_files:
if file not in tracked_songs:
non_tracked_songs.append(file)
return non_tracked_songs
def update_non_tracked_songs(self):
self.non_tracked_songs = self.get_non_tracked_songs()
@property
def synced(self):
"""Synced tracks include all tracks that have been downloaded."""
return [self._local_data[song_id] for song_id in self._local_data
if song_id in self.__synced_song_ids and
not self._local_data[song_id].copyrighted]
@property
def copyrighted(self):
"""Copyrighted tracks have been synced, but can't be downloaded."""
return [self._local_data[song_id] for song_id in self._local_data
if song_id in self.__synced_song_ids and
self._local_data[song_id].copyrighted]
@property
def to_remove(self):
return [self._local_data[song_id] for song_id in self._local_data
if song_id in self.__to_remove_song_ids]
@property
def to_download(self):
return [self._upstream_data[song_id] for song_id in self._upstream_data
if song_id in self.__to_download_song_ids]
def sync(self):
if len(self.to_remove):
print('Deleting removed tracks from local file system.')
self._remove_songs()
print('\n')
if len(self.to_download):
print('Downloading added tracks to local file system.')
self._download_songs()
print('\n')
# Show a notification if anything was done
if len(self.to_remove) or len(self.to_download):
notify_message = 'Synchronization complete. Playlist contains ' \
'%d tracks.\n' % len(self._local_data)
if len(self.to_remove):
notify_message += 'Removed %d tracks.\n' % len(self.to_remove)
if len(self.to_download):
notify_message += 'Downloaded %d tracks.\n' % len(
self.to_download)
_send_notification('%s Sync Complete' % self.name, notify_message)
def _remove_songs(self):
for idx, song in enumerate(self.to_remove):
_print_progress(idx + 1, len(self.to_remove), song.title)
os.remove(song.file_path)
def _download_songs(self):
for idx, song in enumerate(self.to_download):
_print_progress(idx + 1, len(self.to_download), song.title)
# Perform download if necessary
if exists(song.file_path):
_print_message('`%s` already exists. Skipping download.' %
song.title)
logging.info('%s was not found in data file, but already '
'existed on file system. Skipping download' %
song.title)
else:
try:
song.download()
except ExtractorError as e:
if 'copyright grounds' in str(e):
song.copyrighted = True
_print_message(
'Unable to download `%s` due to copyright '
'restrictions' % song.title
)
# If we don't know why it failed, better to throw again
else:
raise e
self._local_data[song.id] = song
with open(self.data_file, 'wb') as file:
pickle.dump(self.info(), file)
def info(self):
return {
'id': self.id,
'name': self.name,
'songs': {
song_id: self._local_data[song_id].info()
for song_id in self._local_data
},
}
@classmethod
def from_id(cls, playlist_id, directory, ytl):
# type: (str, str, YoutubeDL) -> Playlist
"""Create playlist instance from the given playlist name."""
ie = ytl.get_info_extractor('YoutubePlaylist')
assert ie.suitable(playlist_id), \
'The info extractor is not suitable for the given URL. Are you ' \
'sure you provided a valid playlist id?'
playlist_info = ie.extract(playlist_id)
playlist_info['entries'] = list(playlist_info['entries'])
return cls(playlist_info, directory, ytl)
class Song:
def __init__(self, song_info, ytl, playlist):
# type: (Dict, YoutubeDL, Playlist) -> None
self.id = song_info['id']
self.title = sanitize_filename(song_info['title'])
self.url = song_info['url']
self.playlist = playlist
self.file_path = join(playlist.directory, '%s.mp3' % self.title)
self.copyrighted = song_info.get('copyright', False)
self.__data = song_info
self.__ytl = ytl
def download(self):
info_extractor = self.__ytl.get_info_extractor(self.__data['ie_key'])
assert info_extractor.suitable(self.url), \
'Info extractor is not suitable for song %s' % self.url
ie_result = info_extractor.extract(self.url)
self.__ytl.add_extra_info(ie_result, {'playlist': self.playlist.name})
self.__ytl.process_video_result(ie_result, download=True)
def info(self):
return {
'id': self.id,
'title': self.title,
'url': self.url,
'copyright': self.copyrighted,
}
@classmethod
def from_info(cls, info, ytl, playlist=None):
# type: (Dict, YoutubeDL, Playlist) -> Song
return cls(info, ytl, playlist)
def check(playlist):
print('%s by %s' % (playlist.name, playlist.uploader))
print('-' * 80)
print('Synced songs: %d' % len(playlist.synced))
print('Songs to remove: %d' % len(playlist.to_remove))
for song in playlist.to_remove:
print(' - %s' % song.title)
print('Songs to download: %d' % len(playlist.to_download))
for song in playlist.to_download:
print(' - %s' % song.title)
print('Untracked songs: %d' % len(playlist.non_tracked_songs))
for file_name in playlist.non_tracked_songs:
print(' - %s' % file_name)
print('Copyrighted songs: %d (not downloaded)' % len(playlist.copyrighted))
for song in playlist.copyrighted:
print(' - %s' % song.title)
def remove_untracked(playlist):
# type: (Playlist) -> None
"""Remove all tracks which are not tracked."""
num_non_tracked = len(playlist.non_tracked_songs)
for idx, song in enumerate(playlist.non_tracked_songs):
os.remove(join(playlist.directory, song))
_print_progress('Removed %d/%d untracked files' % (idx, num_non_tracked))
playlist.update_non_tracked_songs()
if num_non_tracked:
_send_notification('Finished removing untracked', '%d tracks removed'
% num_non_tracked)
else:
_print_message('Nothing to do.')
def needs_sync(playlist):
# type: (Playlist) -> None
return print(len(playlist.to_download) + len(playlist.to_remove))
def needs_download(playlist):
# type: (Playlist) -> None
return print(len(playlist.to_download))
| StarcoderdataPython |
156323 | import os
from subprocess import call
from sys import argv, exit
import numpy as np
import scipy.io as sio
(STATE_IDLE, STATE_READTEX, STATE_READFACES) = (0, 1, 2)
#Extract the texture coordinates and faces from WRL files
#in the BU-3DFE dataset
def saveTexCoordsAndFaces(filePrefix):
fHandle = open("%s.wrl"%filePrefix, 'r')
texCoords = []
faces = []
state = STATE_IDLE
for line in fHandle.readlines():
if state == STATE_IDLE:
fields = line.split()
if len(fields) == 0:
continue
if fields[0] == "texCoord":
state = STATE_READTEX
elif fields[0] == "texCoordIndex":
state = STATE_READFACES
elif state == STATE_READTEX:
fields = line.split(",")[0].split()
if fields[0] == ']':
state = STATE_IDLE
else:
texCoords.append([float(fields[0]), float(fields[1])])
elif state == STATE_READFACES:
fields = line.split(",")
if len(fields) < 4:
break
#1-index for Matlab
faces.append([int(fields[0]) + 1, int(fields[1]) + 1, int(fields[2]) + 1])
texCoords = np.array(texCoords)
faces = np.array(faces)
fileOut = "%sTexCoords.mat"%filePrefix
sio.savemat(fileOut, {'texCoords':texCoords, 'faces':faces})
if __name__ == '__main__':
faces = ["F%.3i"%i for i in range(1, 10)]
types = ['Angry', 'Disgust', 'Fear', 'Happy', 'Sad', 'Surprise']
for face in faces:
for t in types:
directory = "BU_4DFE/%s/%s"%(face, t)
files = os.listdir(directory)
counter = 0
for f in files:
if f[-3:] == "wrl":
fnew = "%s.off"%f[0:-4]
filePrefix = "%s/%s"%(directory, f[0:-4])
print filePrefix
command = "meshlabserver -i %s/%s -o %s/%s"%(directory, f, directory, fnew)
print command
os.system(command)
counter = counter + 1
# print ".",
# if counter % 50 == 0:
# print ""
saveTexCoordsAndFaces(filePrefix)
print "Finished %s"%directory
| StarcoderdataPython |
76064 | """
[2015-04-29] Challenge #212 [Intermediate] Animal Guess Game
Description:
There exists a classic game which I knew by the name of "Animal". The computer would ask you to
think of an animal. If would then ask a bunch of questions that could be answered with a Yes or No.
It would then make a guess of what animal you are thinking of. If the computer was right the program
ended with smug satisfaction. If the program was wrong it would ask you type in a specific Yes/No
question about your Animal. It would then update its library of animals to include it. As it already
had a bunch of yes/no questions it would just add the final one to that animal. As you played this
game it would learn. The more you played the more animals it learned. it got better. You taught this
program. For today's challenge we will implement this game.
Input:
The program will display an intro message and then just ask a series of yes/no questions. How you
implement this interface I leave the design to you. It must prompt you with questions and you must
be able to answer yes/no.
Output:
The program will have an intro message welcoming you to the game and then ask you to think of an
animal and then proceed to start asking questions once you prompt you are ready. For this challenge
the exact design and text I leave for you to develop as part of the challenge. The computer will
continue to output questions for yes/no responses. Eventually the computer will take a guess. You
can then tell the computer by a yes/no if it was a correct guess. If the computer is correct you may
output a success message for the computer and exit. if the computer was wrong in the guess picked
you will be asked to enter your animal and a yes/no question string that would answer a "yes". The
computer program will prompt for this data and you must supply it. You are teaching the program.
Again exact design and words I leave to you to design. I give a rough example below in examples.
AI:
The requirements for this game is a learning game. Every time you play it must load contain all
previous game learning. You therefore must find a way to design and implement this. The tricky part
is what questions to ask. I leave it to you and your design to develop those initial or base
questions and then using the learned questions.
Example of Play 1:
Welcome to Animal Guess. Please think of an Animal and type "y" to proceed --> y
Is your animal a mammal? --> y
Is your animal a swimmer? --> y
Is your animal grey? --> y
I think your animal is a grey whale. Am I correct? --> n
Oh well. please help me learn. What is the name of your animal-> dolphin
What is a unique question that answers yes for dolphin -> Does your animal have high intelligence
Thank you for teaching me.
Example of Play 2:
Welcome to Animal Guess. Please think of an Animal and type "y" to proceed --> y
Is your animal a mammal? --> y
Is your animal a swimmer? --> n
Is your animal grey? --> y
I think your animal is an elephant. Am I correct? --> y
It is okay to feel bad you did not stump me. I am a computer. :)
Thank you for playing!
"""
import random
from pickle import Pickler, Unpickler
MEMORY_FILENAME = 'animal_memory.pickle'
#TODO: Generalize for a "ThingMemory"
class AnimalMemory(object):
def __init__(self):
"""Initialize animal memory."""
self.questions = {}
def is_empty(self):
"""Check if memory is still empty."""
return len(self.questions) == 0
def guess_animal(self, question_list):
"""Try to guess an animal based on all the questions the user answered yes."""
if len(question_list) == 0:
return None
candidates = set(self.questions[question_list[0]])
for question_text in question_list:
candidates = candidates.intersection(set(self.questions[question_text]))
if len(candidates) < 2:
break
if len(candidates) == 1:
return candidates.pop()
return None
def add_question(self, question_text):
"""Add a new question to the memory."""
self.questions[question_text] = [] # TODO: Convert this to a set (need to change the pickle file saved)
def add_animal(self, animal_name, yes_question_list):
"""Add an animal name to all the questions the player answered yes."""
for question_text in yes_question_list:
if animal_name not in self.questions[question_text]:
self.questions[question_text].append(animal_name)
def decribe_animal(self, animal_name):
"""Returns a raw description of the animal, with all the questions that answer yes for it."""
description = []
for question_text in self.questions:
if animal_name in self.questions[question_text]:
description.append(question_text)
return description
def other_yes_questions(self, question_answered):
"""Returns a list of questions that could also answer yes."""
animals = set(self.questions[question_answered])
other_list = []
for question in self.questions:
current_animals = set(self.questions[question])
if animals.intersection(current_animals):
other_list.append(question)
return other_list
def forget(self, animal_name, wrong_description):
"""Correct a wrong memory, removing animal name from all questions that doesn't answer yes."""
for question in wrong_description:
self.questions[question].remove(animal_name)
#TODO: Generalize for a "GeneralGuessingGame"
#TODO: Write docs for all methods
class AnimalGuessingGame(object):
def __init__(self, memory):
self.memory = memory
def play(self):
"""Main animal guessing game loop."""
print('Welcome to Animal Guess.')
while True:
welcome_answer = input('Please think of an Animal and type "y" to proceed --> ')
if welcome_answer != 'y':
break
guess, yes_questions = self.try_to_guess()
if guess:
guess_answer = input('I think your animal is %s %s. Am I correct? --> ' % (get_article(guess), guess) )
if guess_answer == 'y':
self.do_right_answer(guess, yes_questions)
else:
self.do_wrong_answer(yes_questions)
else:
print('I have no idea what that is.')
self.do_wrong_answer(yes_questions)
def get_questions_to_ask(self):
return list(self.memory.questions.keys())
def filter_questions(self, question, questions_to_ask):
other_questions = self.memory.other_yes_questions(question)
questions_to_ask = list(set(questions_to_ask).intersection(set(other_questions)))
return questions_to_ask
def try_to_guess(self):
guess = None
yes_questions = []
if not self.memory.is_empty():
questions_to_ask = self.get_questions_to_ask()
while len(questions_to_ask) > 0:
rnd_question = random.randrange(len(questions_to_ask))
question = questions_to_ask.pop(rnd_question)
answer = input('%s? --> ' % question)
if answer == 'y':
yes_questions.append(question)
guess = self.memory.guess_animal(yes_questions)
if guess:
break
questions_to_ask = self.filter_questions(question, questions_to_ask)
return guess, yes_questions
def do_right_answer(self, guess, yes_questions):
self.memory.add_animal(guess, yes_questions)
print('It is okay to feel bad you did not stump me. I am a computer. :)')
print('Thank you for playing!')
def do_wrong_answer(self, yes_questions):
animal_name = input('Oh well. please help me learn. What is the name of your animal --> ').strip().lower()
if animal_name:
self.correct_me(animal_name)
self.teach_me(animal_name, yes_questions)
else:
print("Ok, you're not sure either.")
def correct_me(self, animal_name):
description = self.memory.decribe_animal(animal_name)
if description:
print('As far as I know, %s is described as this:' % animal_name)
for i, text in enumerate(description):
print('(%i) %s? -> Yes' % (i, text))
right = input('Are all of these right? -> ')
if right == 'n':
wrong = input('Which of them are wrong?').split()
wrong_description = []
for i in wrong:
wrong_description.append(description[int(i)])
self.memory.forget(animal_name, wrong_description)
print('Thank you for correcting me.')
def teach_me(self, animal_name, yes_questions):
question_text = input('What is a unique question that answers yes for %s -> ' % animal_name).capitalize().strip('?').strip()
if question_text:
yes_questions.append(question_text)
self.memory.add_question(question_text)
self.memory.add_animal(animal_name, yes_questions)
print('Thank you for teaching me.')
else:
print("So you don't know it also.")
def get_article(noun):
"""Get the proper english article (a/an) for a noun."""
if noun[0].lower() in 'aeiou':
return 'an'
else:
return 'a'
def load_memory():
"""Restores animal memory from a file (or create a new one if file not found)."""
memory = None
try:
memory = Unpickler(open(MEMORY_FILENAME, 'rb')).load()
except FileNotFoundError:
memory = AnimalMemory()
return memory
def save_memory(memory):
"""Saves current memory to a file."""
Pickler(open(MEMORY_FILENAME, 'wb')).dump(memory)
def tests():
test_memory()
def test_memory():
"""Run tests for the AnimalMemory object."""
memory = AnimalMemory()
assert memory.guess_animal([]) == None, 'Empty memory, empty guess list'
memory.add_question('what?')
assert memory.questions == {'what?': []}, 'One question added'
memory.add_animal('it', ['what?'])
assert memory.questions == {'what?': ['it']}, 'One question added with an animal'
assert memory.guess_animal([]) == None, 'One animal memory, empty guess list'
assert memory.guess_animal(['what?']) == 'it', 'One animal memory, one guess list, right answer'
memory.add_question('when?')
assert memory.questions['when?'] == [], 'Another question added'
memory.add_animal('now', ['when?', 'what?'])
assert memory.guess_animal(['when?', 'what?']) == 'now', 'Two animals, guess list, right answer'
print('all tests passed')
#TODO: Write tests for AnimalGuessingGame
#TODO: Test inputs: with mock.patch('builtins.input', return_value='...') / mock.patch('builtins.input', side_effect=['abc', 'def'])
def main():
memory = load_memory()
AnimalGuessingGame(memory).play()
save_memory(memory)
if __name__ == '__main__':
main()
#test()
| StarcoderdataPython |
4839991 | def isNaN(Nummer):
try:
Nummer = int(Nummer)
return False
except:
return True
def MtxCurrencyConverter(VBucks):
VBucks = int(VBucks)
Price = int(0)
while VBucks > 13500 or VBucks == 13500:
Price += 99.99
VBucks -= 13500
while VBucks > 7500 or VBucks == 7500:
Price += 59.99
VBucks -= 7500
while VBucks > 2800 or VBucks == 2800:
Price += 24.99
VBucks -= 2800
while VBucks > 1000 or VBucks == 1000:
Price += 9.99
VBucks -= 1000
while VBucks > 0:
Price += 9.99
VBucks -= 1000
return round(Price, 2)
| StarcoderdataPython |
1797666 | """ Info objects
"""
import numbers
import numpy
import autofile.info
from autofile.system._util import utc_time as _utc_time
def conformer_trunk(nsamp, tors_ranges):
""" conformer trunk information
:param nsamp: the number of samples
:type nsamp: int
:param tors_ranges: sampling ranges [(start, end)] for each torsional
coordinate, by z-matrix coordinate name
:type tors_ranges: dict[str: (float, float)]
"""
tors_range_dct = dict(tors_ranges)
for key, rng in tors_range_dct.items():
tors_range_dct[key] = (rng[0]*180./numpy.pi, rng[1]*180./numpy.pi)
assert all(isinstance(key, str) and len(rng) == 2
and all(isinstance(x, numbers.Real) for x in rng)
for key, rng in tors_range_dct.items())
tors_ranges = autofile.info.Info(**tors_range_dct)
assert isinstance(nsamp, numbers.Integral)
inf_obj = autofile.info.Info(nsamp=nsamp, tors_ranges=tors_ranges)
assert autofile.info.matches_function_signature(inf_obj, conformer_trunk)
return inf_obj
def tau_trunk(nsamp, tors_ranges):
""" tau trunk information
:param nsamp: the number of samples
:type nsamp: int
:param tors_ranges: sampling ranges [(start, end)] for each torsional
coordinate, by z-matrix coordinate name
:type tors_ranges: dict[str: (float, float)]
"""
tors_range_dct = dict(tors_ranges)
for key, rng in tors_range_dct.items():
tors_range_dct[key] = (rng[0]*180./numpy.pi, rng[1]*180./numpy.pi)
assert all(isinstance(key, str) and len(rng) == 2
and all(isinstance(x, numbers.Real) for x in rng)
for key, rng in tors_range_dct.items())
tors_ranges = autofile.info.Info(**tors_range_dct)
assert isinstance(nsamp, numbers.Integral)
inf_obj = autofile.info.Info(nsamp=nsamp, tors_ranges=tors_ranges)
assert autofile.info.matches_function_signature(inf_obj, tau_trunk)
return inf_obj
def scan_branch(grids):
""" scan trunk information
:param grids: sampling grids, [val1, val2, ...], for each coordinate,
by coordinate name
:type grids: dict[str: list[float]]
"""
grid_dct = dict(grids)
# note:renormalization of angle ranges needs to be updated for 2D grids.
for key, rng in grid_dct.items():
if 'R' not in key:
grid_dct[key] = rng*180./numpy.pi
assert all(isinstance(key, str) and numpy.ndim(vals) == 1
and all(isinstance(x, numbers.Real) for x in vals)
for key, vals in grid_dct.items())
grids = autofile.info.Info(**grid_dct)
inf_obj = autofile.info.Info(grids=grids)
assert autofile.info.matches_function_signature(inf_obj, scan_branch)
return inf_obj
def vpt2_trunk(fermi):
""" vpt2 trunk information
:param fermi: description of fermi resonance treatment
:type fermi: str
"""
assert isinstance(fermi, str)
inf_obj = autofile.info.Info(fermi=fermi)
assert autofile.info.matches_function_signature(inf_obj, vpt2_trunk)
return inf_obj
def lennard_jones(potential, nsamp,
method, basis, program, version):
""" energy transfer trunk """
inf_obj = autofile.info.Info(potential=potential, nsamp=nsamp,
method=method, basis=basis,
program=program, version=version)
assert autofile.info.matches_function_signature(
inf_obj, lennard_jones)
return inf_obj
class RunStatus():
""" run statuses """
RUNNING = "running"
SUCCESS = "succeeded"
FAILURE = "failed"
def run(job, prog, version, method, basis, status, utc_start_time=None,
utc_end_time=None):
""" run information
"""
inf_obj = autofile.info.Info(
job=job,
prog=prog,
version=version,
method=method,
basis=basis,
status=status,
utc_start_time=utc_start_time,
utc_end_time=utc_end_time,
)
assert autofile.info.matches_function_signature(inf_obj, run)
return inf_obj
def utc_time():
""" current run time
"""
return _utc_time()
| StarcoderdataPython |
1760 | import os
import numpy as np
import cv2
import albumentations
from PIL import Image
from torch.utils.data import Dataset
from taming.data.sflckr import SegmentationBase # for examples included in repo
class Examples(SegmentationBase):
def __init__(self, size=256, random_crop=False, interpolation="bicubic"):
super().__init__(data_csv="data/ade20k_examples.txt",
data_root="data/ade20k_images",
segmentation_root="data/ade20k_segmentations",
size=size, random_crop=random_crop,
interpolation=interpolation,
n_labels=151, shift_segmentation=False)
# With semantic map and scene label
class ADE20kBase(Dataset):
def __init__(self, config=None, size=None, random_crop=False, interpolation="bicubic", crop_size=None):
self.split = self.get_split()
self.n_labels = 151 # unknown + 150
self.data_csv = {"train": "data/ade20k_train.txt",
"validation": "data/ade20k_test.txt"}[self.split]
self.data_root = "./data/ade20k_root"
with open(os.path.join(self.data_root, "sceneCategories.txt"), "r") as f:
self.scene_categories = f.read().splitlines()
self.scene_categories = dict(line.split() for line in self.scene_categories)
with open(self.data_csv, "r") as f:
self.image_paths = f.read().splitlines()
self._length = len(self.image_paths)
ss = self.split
if ss=='train':
ss='training'
self.labels = {
"relative_file_path_": [l for l in self.image_paths],
"file_path_": [os.path.join(self.data_root, "images",ss, l)
for l in self.image_paths],
"relative_segmentation_path_": [l.replace(".jpg", ".png")
for l in self.image_paths],
"segmentation_path_": [os.path.join(self.data_root, "annotations",ss,
l.replace(".jpg", ".png"))
for l in self.image_paths],
"scene_category": [self.scene_categories[l.replace(".jpg", "")]
for l in self.image_paths],
}
size = None if size is not None and size<=0 else size
self.size = size
if crop_size is None:
self.crop_size = size if size is not None else None
else:
self.crop_size = crop_size
if self.size is not None:
self.interpolation = interpolation
self.interpolation = {
"nearest": cv2.INTER_NEAREST,
"bilinear": cv2.INTER_LINEAR,
"bicubic": cv2.INTER_CUBIC,
"area": cv2.INTER_AREA,
"lanczos": cv2.INTER_LANCZOS4}[self.interpolation]
self.image_rescaler = albumentations.SmallestMaxSize(max_size=self.size,
interpolation=self.interpolation)
self.segmentation_rescaler = albumentations.SmallestMaxSize(max_size=self.size,
interpolation=cv2.INTER_NEAREST)
if crop_size is not None:
self.center_crop = not random_crop
if self.center_crop:
self.cropper = albumentations.CenterCrop(height=self.crop_size, width=self.crop_size)
else:
self.cropper = albumentations.RandomCrop(height=self.crop_size, width=self.crop_size)
self.preprocessor = self.cropper
def __len__(self):
return self._length
def __getitem__(self, i):
example = dict((k, self.labels[k][i]) for k in self.labels)
image = Image.open(example["file_path_"])
if not image.mode == "RGB":
image = image.convert("RGB")
image = np.array(image).astype(np.uint8)
if self.size is not None:
image = self.image_rescaler(image=image)["image"]
segmentation = Image.open(example["segmentation_path_"])
segmentation = np.array(segmentation).astype(np.uint8)
if self.size is not None:
segmentation = self.segmentation_rescaler(image=segmentation)["image"]
if self.size is not None:
processed = self.preprocessor(image=image, mask=segmentation)
else:
processed = {"image": image, "mask": segmentation}
example["image"] = (processed["image"]/127.5 - 1.0).astype(np.float32)
segmentation = processed["mask"]
onehot = np.eye(self.n_labels)[segmentation]
example["segmentation"] = onehot
return example
class ADE20kTrain(ADE20kBase):
# default to random_crop=True
def __init__(self, config=None, size=None, random_crop=True, interpolation="bicubic", crop_size=None):
super().__init__(config=config, size=size, random_crop=random_crop,
interpolation=interpolation, crop_size=crop_size)
def get_split(self):
return "train"
class ADE20kValidation(ADE20kBase):
def get_split(self):
return "validation"
if __name__ == "__main__":
dset = ADE20kValidation()
ex = dset[0]
for k in ["image", "scene_category", "segmentation"]:
print(type(ex[k]))
try:
print(ex[k].shape)
except:
print(ex[k])
| StarcoderdataPython |
3370725 | <filename>{{ cookiecutter.repo_name }}/src/visualization/visualize.py
# -*- coding: utf-8 -*-
import click
from dotenv import find_dotenv, load_dotenv
from src.utils import config_logging, time_func
from src.features.build_features import read_feature_vector, get_feature_names, get_label_column_name
import logging
import matplotlib
matplotlib.use('agg')
import seaborn as sns
import sys
def exploratory_visualization(dframe):
return sns.pairplot(dframe, diag_kind='kde', vars=get_feature_names(), hue=get_label_column_name()[0])
@click.command()
@click.argument('input_file', type=click.Path(exists=True, dir_okay=False))
@click.argument('output_file', type=click.Path(writable=True, dir_okay=False))
def create_figures(input_file, output_file):
""" Evaluates a model using a specific test file. The Test file must be preprocessed and featurized
:param input_file: File path to featurized vector of all data
:type input_file: str
:param output_file: Filename to save the visualization to.
:type output_file: str
"""
logger = logging.getLogger(__name__)
logger.info('Plotting pairwise distribution...')
dframe = read_feature_vector(input_file)
plot = exploratory_visualization(dframe)
plot.savefig(output_file)
if __name__ == '__main__':
config_logging()
# find .env automagically by walking up directories until it's found, then
# load up the .env entries as environment variables
load_dotenv(find_dotenv())
if not create_figures(sys.argv[1:]):
sys.exit(1)
| StarcoderdataPython |
1637017 | <gh_stars>1000+
from plugin.core.helpers import regex as re
import logging
import os
import shutil
log = logging.getLogger(__name__)
class StorageHelper(object):
base_names = [
'plug-ins',
'plug-in support',
'trakttv.bundle'
]
framework_patterns = re.compile_list([
# Windows
r'plex media server$',
r'plex media server\/dlls',
r'plex media server\/exts',
r'plex media server\/python27.zip$',
r'plex media server\/resources\/plug-ins-\w+',
# Linux
r'resources\/plug-ins-\w+',
r'resources\/python'
], re.IGNORECASE)
@classmethod
def create_directories(cls, path, *args, **kwargs):
"""Create directory at `path` include any parent directories
:type path: str
"""
try:
os.makedirs(path, *args, **kwargs)
return True
except OSError as ex:
if ex.errno == 17:
# Directory already exists
return True
log.warn('Unable to create directories: %r - (%s) %s', cls.to_relative_path(path), ex.errno, ex)
except Exception as ex:
log.warn('Unable to create directories: %r - (%s) %s', cls.to_relative_path(path), type(ex), ex)
return False
@classmethod
def copy(cls, source, destination):
"""Copy the file at `source` to `destination`
:type source: str
:type destination: str
"""
if os.path.isdir(source):
return cls.copy_tree(source, destination)
try:
shutil.copy2(source, destination)
log.debug('Copied %r to %r', cls.to_relative_path(source), cls.to_relative_path(destination))
return True
except Exception as ex:
log.warn('Unable to copy %r to %r - %s', cls.to_relative_path(source), cls.to_relative_path(destination), ex)
return False
@classmethod
def copy_tree(cls, source, destination):
"""Copy the directory at `source` to `destination`
:type source: str
:type destination: str
"""
try:
shutil.copytree(source, destination)
log.debug('Copied %r to %r', cls.to_relative_path(source), cls.to_relative_path(destination))
return True
except Exception as ex:
log.warn('Unable to copy %r to %r - %s', cls.to_relative_path(source), cls.to_relative_path(destination), ex)
return False
@classmethod
def delete(cls, path):
"""Delete the file (at `path`)
:type path: str
"""
if os.path.isdir(path):
return cls.delete_tree(path)
try:
os.remove(path)
log.debug('Deleted %r', cls.to_relative_path(path))
return True
except Exception as ex:
log.warn('Unable to delete file: %r - %s', cls.to_relative_path(path), ex)
return False
@classmethod
def delete_tree(cls, path):
"""Delete the directory (at `path`)
:type path: str
"""
try:
shutil.rmtree(path)
log.debug('Deleted %r', cls.to_relative_path(path))
return True
except Exception as ex:
log.warn('Unable to delete directory: %r - %s', cls.to_relative_path(path), ex)
return False
@classmethod
def to_relative_path(cls, path):
"""Convert `path` to be relative to `StorageHelper.base_names`
:type path: str
"""
path_lower = path.lower()
# Find base path
base_path = None
for base in cls.base_names:
if base not in path_lower:
continue
base_path = path[:path_lower.find(base)]
break
# Check if `base_path` was found
if not base_path:
return path
# Return relative path
return os.path.relpath(path, base_path)
@classmethod
def is_relative_path(cls, path):
"""Check if `path` is relative to `StorageHelper.base_names`
:type path: str
"""
path = path.lower()
# Ignore framework paths
if 'framework.bundle' in path:
return False
# Find base path
for base in cls.base_names:
if base not in path:
continue
return True
return False
@classmethod
def is_framework_path(cls, path):
path = path.replace('\\', '/')
# Check for framework fragments
for pattern in cls.framework_patterns:
if pattern.search(path):
return True
return False
| StarcoderdataPython |
1767005 | # 🚨 Don't change the code below 👇
year = int(input("Which year do you want to check? "))
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
# #Checking if math checks out
# #If year is evenly divisible by 4
# if (year/4).is_integer():
# print("Is leap")
# else:
# print("Is not leap")
# #Except every year that is evenly divisible by 100
# if (year/100) % 2 == 0:
# print("Is not leap")
# else:
# print("Is not leap")
# #Unless the year is also evenly divisible by 400
# if (year/400).is_integer():
# print("Is leap")
# else:
# print("Is not leap")
#Wrapping it into a proper statement
if (year/4).is_integer() and (year/100)%2==0 and (year/400).is_integer():
print(f"{year} is a leap year")
else:
print(f"{year} is not a leap year")
#Facit Solution
if year % 4 == 0:
if year % 100:
if year % 400 == 0:
print("Leap Year")
else:
print("Not leap year")
else:
print("Leap Year")
else:
print("Not leap year.") | StarcoderdataPython |
1708033 | """
Command-line interface for the bib_lookup package.
"""
import argparse
from pathlib import Path
from typing import Union
try:
from bib_lookup.bib_lookup import BibLookup
except ImportError:
# https://gist.github.com/vaultah/d63cb4c86be2774377aa674b009f759a
import sys
level = 1
global __package__
file = Path(__file__).resolve()
parent, top = file.parent, file.parents[level]
sys.path.append(str(top))
try:
sys.path.remove(str(parent))
except ValueError: # already removed
pass
__package__ = ".".join(parent.parts[len(top.parts) :])
from bib_lookup.bib_lookup import BibLookup
def required_length(nmin: int, nmax: int) -> argparse.Action:
# https://stackoverflow.com/questions/4194948/python-argparse-is-there-a-way-to-specify-a-range-in-nargs
class RequiredLength(argparse.Action):
def __call__(self, parser, args, values, option_string=None):
if not nmin <= len(values) <= nmax:
msg = f"""argument "{self.dest}" requires between {nmin} and {nmax} arguments"""
raise argparse.ArgumentTypeError(msg)
setattr(args, self.dest, values)
return RequiredLength
def str2bool(v: Union[str, bool]) -> bool:
"""
converts a "boolean" value possibly in the format of str to bool
Parameters
----------
v: str or bool,
the "boolean" value
Returns
-------
b: bool,
`v` in the format of bool
References
----------
https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse
"""
if isinstance(v, bool):
b = v
elif v.lower() in ("yes", "true", "t", "y", "1"):
b = True
elif v.lower() in ("no", "false", "f", "n", "0"):
b = False
else:
raise ValueError("Boolean value expected.")
return b
def main():
"""
Command-line interface for the bib_lookup package.
"""
parser = argparse.ArgumentParser(
description="Look up a BibTeX entry from a DOI identifier, PMID (URL) or arXiv ID (URL)."
)
parser.add_argument(
"identifiers",
nargs="*",
type=str,
help="DOI, PMID or arXiv ID (URL) to look up.",
)
parser.add_argument(
"-a",
"--align",
type=str,
default="middle",
help="Alignment of the output text.",
choices=["left", "middle", "left-middle"],
)
parser.add_argument(
"-c",
"--check-file",
help="Can be boolean or path to a Bib File. Checks the input Bib file or output bib file for errors.",
dest="check_file",
)
parser.add_argument(
"-o",
"--output",
type=str,
help="Output file to write the BibTeX entries to.",
dest="output_file",
)
parser.add_argument(
"-i",
"--input",
type=str,
help="Input file to read the identifiers (DOI, PMID or arXiv ID (URL)) from.",
dest="input_file",
)
parser.add_argument(
"--ignore-fields",
nargs="*",
type=str,
default=["url"],
help="List of fields to ignore.",
dest="ignore_fields",
)
parser.add_argument(
"--email",
type=str,
help="Email address to use for the lookup, optional.",
dest="email",
)
parser.add_argument(
"--ordering",
type=str,
nargs="*",
default=["author", "title", "journal", "booktitle"],
help="Order of the fields in the output.",
dest="ordering",
)
parser.add_argument(
"--allow-duplicates",
action="store_true",
help="allow duplicate entries when writing to file.",
dest="allow_duplicates",
)
parser.add_argument(
"--arxiv2doi",
action="store_true",
help="Convert arXiv ID to DOI to look up.",
dest="arxiv2doi",
)
args = vars(parser.parse_args())
check_file = args["check_file"]
if check_file is not None:
if Path(check_file).is_file() and Path(check_file).suffix == ".bib":
# check this file, other augments are ignored
check_file = Path(check_file)
else:
check_file = str2bool(check_file)
bl = BibLookup(
align=args["align"],
ignore_fields=args["ignore_fields"],
output_file=args["output_file"],
email=args["email"],
ordering=args["ordering"],
arxiv2doi=args["arxiv2doi"],
verbose=0,
)
if check_file is not None and isinstance(check_file, Path):
bl.check_bib_file(check_file)
return
else:
assert (
len(args["identifiers"]) > 0 or args["input_file"] is not None
), "No identifiers given."
if len(args["identifiers"]) > 0:
bl(args["identifiers"])
if args["input_file"] is not None:
bl(args["input_file"])
if args["output_file"] is not None:
bl.save(skip_existing=not args["allow_duplicates"])
if check_file:
bl.check_bib_file(bl.output_file)
else:
if len(bl) == 0:
print("No entries found.")
else:
bl.print()
if __name__ == "__main__":
main()
| StarcoderdataPython |
1769159 | import csv
import pandas as pd
from collections import Counter
from nltk.tokenize import RegexpTokenizer
import time
def getFoodIdDf(description, foodIdFilePath="foodData/input_food.csv"):
colList = ["sr_description", "fdc_id"]
df = pd.read_csv(foodIdFilePath, usecols=colList)
tokenizer = RegexpTokenizer(r'\w+')
inputDescriptionTokensCount = Counter(
tokenizer.tokenize(description.lower()))
maxMatches = 0
bestMatch = "No Match"
for _, row in df.iterrows():
descriptionTokensCount = Counter(tokenizer.tokenize(row["sr_description"].lower()))
matches = descriptionTokensCount & inputDescriptionTokensCount
if len(descriptionTokensCount) > 0:
numMatches = sum(matches.values()) / len(descriptionTokensCount)
if numMatches > maxMatches:
maxMatches = numMatches
bestMatch = row["fdc_id"]
return bestMatch
def getFoodIdCsv(description, foodIdFilePath="foodData/input_food.csv"):
openFoodIdFile = open(foodIdFilePath)
tokenizer = RegexpTokenizer(r'\w+')
inputDescriptionTokensCount = Counter(
tokenizer.tokenize(description.lower()))
maxMatches = 0
bestMatch = "No Match"
for row in csv.reader(openFoodIdFile):
descriptionTokensCount = Counter(tokenizer.tokenize(row[6].lower()))
matches = descriptionTokensCount & inputDescriptionTokensCount
if len(descriptionTokensCount) > 0:
numMatches = sum(matches.values()) / len(descriptionTokensCount)
if numMatches > maxMatches:
maxMatches = numMatches
bestMatch = row[1]
return bestMatch
def getNutrientAmount(foodId, nutrientId=1008, nutrientFilePath="foodData/food_nutrient.csv"):
df = pd.read_csv(nutrientFilePath, low_memory=False)
food_row = df.loc[(df['fdc_id'] == foodId) & (df['nutrient_id'] == nutrientId)]
nutrientAmt = food_row["amount"].iloc[0]
return nutrientAmt
def getNutrientAmount2(foodId, nutrientId='1008', nutrientFilePath="foodData/food_nutrient.csv"):
openNutrientFile = open(nutrientFilePath)
for row in csv.reader(openNutrientFile):
if row[1] == foodId and row[2] == nutrientId:
nutrientAmt = row[3]
return float(nutrientAmt)
| StarcoderdataPython |
70652 | <filename>cold_posterior_bnn/core/diagnostics.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Lint as: python3
"""Diagnostics helpful in characterising deep neural network behavior.
This module implements statistics that characterise neural network behavior.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import tensorflow.compat.v1 as tf
__all__ = [
'symmetric_alpha_stable_invstability_estimator',
'variable_gradient_stability_estimate',
]
def symmetric_alpha_stable_invstability_estimator(data, axis, nelem_per_piece):
"""Estimate the stability coefficient of the S-alpha-S distribution.
The [symmetric alpha-stable
distribution](https://en.wikipedia.org/wiki/Stable_distribution) contains the
class of symmetric distributions which are closed under linear combinations.
These distributions have recently been shown to accurately characterise the
gradient noise distribution due to minibatch sampling in deep neural networks,
see [(Simsekli et al., 2019)](https://arxiv.org/pdf/1901.06053.pdf).
The relevance of this characterization is that many methods assume Gaussian
tails of the noise distribution arising from the central limit theorem; for
alpha < 2 these resulting average-minibatch-gradient noise tails are no longer
Gaussian.
This method estimates the inverse of the alpha tail index of the S-alpha-S
distribution using the method proposed by [(Mohammadi et al.,
2015)](https://link.springer.com/article/10.1007%2Fs00184-014-0515-7).
The tail index alpha is in the range (0,2], where 2 corresponds to Gaussian
tails.
Args:
data: Tensor, with zero-mean observations. One designated axis corresponds
to the sample dimension; for example data may be (100,16,8) composed of
100 independent samples of (16,8) Tensors. Note that the samples need to
be independent and identically distributed (iid).
axis: int, axis that corresponds to the sampling dimension.
nelem_per_piece: int, how many elements to group to carry out estimation.
A recommended value is around sqrt(data.shape[axis]).
Returns:
invstability_estimate: Tensor, shape is the shape of data with the sampling
axis removed. Each element of the Tensor contains an estimate of the
inverse of the alpha stability coefficient of the symmetric alpha stable
distribution.
"""
n = data.shape[axis]
num_pieces = n // nelem_per_piece
# How many samples to use for estimation (discarding remainder)
nestimate = num_pieces * nelem_per_piece
data_samples, _ = tf.split(data, [nestimate, n-nestimate], axis=axis)
term_all = tf.reduce_mean(tf.log(tf.abs(data_samples)), axis=axis)
data_splits = tf.split(data_samples, num_pieces, axis=axis)
term_batch = tf.reduce_mean(tf.stack(
[tf.log(tf.abs(tf.reduce_sum(data_i, axis=axis)))
for data_i in data_splits]), axis=0)
invstability_estimate = (term_batch - term_all) / math.log(nelem_per_piece)
return invstability_estimate
def _filter_gradient_tensors(gradients):
"""Filter a list of gradients and remove all tf.IndexedSlices instances."""
return list(filter(
lambda tensor: not isinstance(tensor, tf.IndexedSlices),
gradients))
def variable_gradient_stability_estimate(model, tape, losses, batchsize,
nelem_per_piece=8,
aggregate_variable_estimates=True):
"""Estimate the symmetric alpha-stable tail index of gradient noise.
We construct the estimate based on a model and gradient tape and a vector of
per-instance losses. The set of losses is grouped into batches and we
compute per-batch gradients. The total gradient is used to center the
per-batch gradients, resulting in a set of independent gradient noise
samples. These zero-mean gradient noise samples form the input to a tail
index estimator.
Args:
model: tf.keras.Model.
tape: tf.GradientTape(persistent=True) that has been used to compute losses.
losses: Tensor of shape (n,), one loss element per instance.
batchsize: int, the number of instances per batch.
nelem_per_piece: int, number of elements to group per block in the tail
index estimator. Ideally this is around sqrt(n//batchsize).
aggregate_variable_estimates: bool, if True all estimates in a tf.Variable
are mean-reduced. If False individual estimates for each parameter are
computed.
Returns:
stability_estimate: list of tf.Tensor objects containing the estimates of
the tail index (stability == alpha).
"""
n = int(tf.size(losses)) # number of instances
with tape:
loss_total = tf.reduce_mean(losses)
losses_batched = tf.split(losses, n // batchsize)
loss_batches = list(map(tf.reduce_mean, losses_batched))
gradients_total = tape.gradient(loss_total, model.trainable_variables)
gradients_total = _filter_gradient_tensors(gradients_total)
gradients_batches = list(map(
lambda loss_i: tape.gradient(loss_i, model.trainable_variables),
loss_batches))
gradients_batches = list(map(_filter_gradient_tensors, gradients_batches))
gradients_noise = list(map(
lambda gradients_batch_j: list(map( # pylint: disable=g-long-lambda
lambda grads: grads[1] - grads[0],
zip(gradients_total, gradients_batch_j))),
gradients_batches))
noises = list(map(tf.stack, zip(*gradients_noise)))
sample_axis = 0
invalphas_estimate = list(map(
lambda noise: symmetric_alpha_stable_invstability_estimator( # pylint: disable=g-long-lambda
noise, sample_axis, nelem_per_piece),
noises))
if aggregate_variable_estimates:
stability_estimate = list(map(
lambda invalpha: 1.0 / tf.reduce_mean(invalpha),
invalphas_estimate))
else:
stability_estimate = list(map(
lambda invalpha: 1.0 / invalpha, invalphas_estimate))
return stability_estimate
class GradientNoiseEstimator(tf.keras.optimizers.Optimizer):
"""Optimizer class that can estimate gradient noise."""
def __init__(self,
name='GradientNoiseEstimator',
preconditioner_regularization=1.0e-7,
**kwargs):
"""Create a new gradient noise estimator object.
Args:
name: Optimizer name.
preconditioner_regularization: float, >= 0.0, the estimated noise variance
used to estimate the mass matrix in the estimate_fixed_preconditioner
method will be regularized with this additive constant.
**kwargs: arguments passed the tf.keras.optimizers.Optimizer base class.
"""
super(GradientNoiseEstimator, self).__init__(name, **kwargs)
self.preconditioner_regularization = preconditioner_regularization
def gradient_noise_variance_estimate(self, var):
"""Estimate the gradient noise variance using a sample variance estimate.
Args:
var: tf.Variable to estimate the noise variance.
Returns:
variance_estimate: tf.Tensor of the same shape as 'var', containing a
sample variance estimate of the gradient noise. The resulting
estimate is unregularized.
"""
count = self.get_slot(var, 'count')
m2 = self.get_slot(var, 'm2')
variance_estimate = m2 / (count-1.0)
return variance_estimate
def gradient_second_moment_estimate(self, var):
"""Estimate the raw second moment of the gradient.
We have E[G^2] = (E[G])^2 + Var[G]. Here the variance is over the
minibatch sampling.
Args:
var: tf.Variable to estimate the second moment of.
Returns:
m2_estimate: tf.Tensor of the same shape as 'var', containing a raw second
moment estimate of the gradient. The resulting estimate is
unregularized.
"""
count = self.get_slot(var, 'count')
mean = self.get_slot(var, 'mean')
m2 = self.get_slot(var, 'm2')
variance_estimate = m2 / count
m2_estimate = tf.square(mean) + variance_estimate
return m2_estimate
def estimate_fixed_preconditioner(self, model, scale_to_min=True,
raw_second_moment=False):
"""Produce a preconditioner dictionary suitable for SGMCMCOptimizer.
Example:
The following example estimates the gradient noise and then instantiates a
SG-MCMC method using the estimated preconditioner.
>>> grad_est = bnn.diagnostics.GradientNoiseEstimator()
>>> @tf.function
def train_gest_step(optimizer, model, data, labels):
with tf.GradientTape(persistent=True) as tape:
logits = model(data, training=True)
ce_full = tf.nn.sparse_softmax_cross_entropy_with_logits(
logits=logits, labels=labels)
prior = sum(model.losses)
loss = tf.reduce_mean(ce_full)
obj = loss + prior
gradients = tape.gradient(obj, model.trainable_variables)
gradients = map(tf.convert_to_tensor, gradients) # densify
optimizer.apply_gradients(zip(gradients, model.trainable_variables))
>>> for batch in range(100): # use 100 minibatch gradients to estimate
data, labels = next(train_iter)
train_gest_step(grad_est, model, data, labels)
>>> precond_dict = grad_est.estimate_fixed_preconditioner(model)
>>> optimizer = sgmcmc.BAOABMCMC(total_sample_size=50000,
preconditioner='fixed',
preconditioner_Mdict=precond_dict)
Args:
model: tf.keras.Model that the gradient noise was estimated for.
scale_to_min: bool, if True then the resulting preconditioner is scaled
such that the least sensitive variable has unit one, and the most
sensitive variable has a mass higher than one. Recommended.
raw_second_moment: bool, if True then we estimate the raw second moment,
akin to RMSprop. If False we only estimate the gradient noise variance.
Returns:
precond_dict: dict, suitable as preconditioner_Mdict argument to the
SGMCMCOptimizer base class.
"""
def estimate_mass(var):
"""Estimate preconditioner mass matrix element for given variable."""
if raw_second_moment:
# Raw second moment (RMSprop)
moment_estimate = self.gradient_second_moment_estimate(var)
else:
# Central second moment
moment_estimate = self.gradient_noise_variance_estimate(var)
mean_variance = tf.reduce_mean(moment_estimate)
mean_variance_reg = mean_variance + self.preconditioner_regularization
mass_estimate = float(tf.sqrt(mean_variance_reg))
return mass_estimate
precond_dict = {
var.name: estimate_mass(var) for var in model.trainable_variables
}
# Scale so that smallest mass becomes one
if scale_to_min:
minimum_mass = min(precond_dict[name] for name in precond_dict)
for name in precond_dict:
precond_dict[name] /= minimum_mass
return precond_dict
def _create_slots(self, var_list):
for var in var_list:
self.add_slot(var, 'count', initializer='zeros')
self.add_slot(var, 'mean', initializer='zeros')
self.add_slot(var, 'm2', initializer='zeros')
def _resource_apply_dense(self, grad, var):
# Welford's streaming variance estimation update
count = self.get_slot(var, 'count')
mean = self.get_slot(var, 'mean')
m2 = self.get_slot(var, 'm2')
count_updated = count + 1.0
delta = grad - mean
mean_updated = mean + (delta/count_updated)
delta2 = grad - mean_updated
m2_updated = m2 + delta*delta2
return tf.group(*([mean.assign(mean_updated),
m2.assign(m2_updated),
count.assign(count_updated)]))
def get_config(self):
config = super(GradientNoiseEstimator, self).get_config()
config.update({
'preconditioner_regularization': self.preconditioner_regularization,
})
return config
class AutoCorrelationEstimator(object):
"""Coarse-graining running estimation of autocorrelation.
This class implements a hierarchical approximation (coarse-graining) scheme
for autocorrelation estimation suitable for estimating the effective sample
size and other autocorrelation statistics on Markov chain Monte Carlo (MCMC)
output.
The procedure is based on a procedure developed in the molecular dynamics
community, in particular the so-called _order-n_ algorithm described in
Section 4.4.2 of [1].
The _order-n_ algorithm is a coarse-graining approximation which retains a
fine estimation for small lags and an iteratively coarsened approximation for
larger lags.
There are two parameters defining the approximation:
1. The `nlevels` parameter, specifying the depth of the temporal hierarchy.
2. The `nsteps_per_level` parameter, specifying the number of time steps
explicitly maintained by each level of the hierarchy.
The overall memory complexity is `O(nsteps_per_level * nlevels)`.
For each call to `update` the time complexity is `O(nsteps_per_level)`.
The approximation is accurate for smooth autocorrelation functions.
### References
[1] [(Frenkel and Smit, "Understanding Molecular Simulation: From Algorithms
to Applications",
1996)](https://www.sciencedirect.com/book/9780122673511/understanding-molecular-simulation).
"""
def __init__(self, shape, nlevels=3, nsteps_per_level=32, dtype=tf.float32):
"""Create a new autocorrelation estimator.
The estimator estimates the autocorrelation at lags between zero and
total_time(), for a Tensor of statistics. Each Tensor element is treated
independent and the autocorrelation is estimated separately for all of them.
Args:
shape: tuple or TensorShape, the shape of the statistics passed to
`update`. Typically these would be statistics of a validation batch,
e.g. a log-likelihood Tensor or a prediction statistic, e.g. the logits
of a fixed validation batch. It can also be the shape of a parameter
tensor.
The autocorrelation estimates obtained from `__call__` will be of the
same size as the given `shape`.
nlevels: int, >=1, the number of levels in the approximation hierarchy.
nsteps_per_level: int, >=2, the number of explicit statistics in each
level.
dtype: tf.dtype, the element type of the statistics passed to `update`.
"""
self.nlevels = nlevels
self.nsteps_per_level = nsteps_per_level
self.shape = shape
# Marginal
self.count = tf.convert_to_tensor(0, dtype=tf.int64)
self.mean = tf.zeros(shape, dtype=dtype)
self.moment2 = tf.zeros(shape, dtype=dtype)
# Hierarchical raw and correlation statistics:
# 1. corr[level][step] is Tensor with given shape, storing correlations.
# 2. corr_count[level][step] counts the number of updates.
# 3. stat[level][step] is Tensor with given shape, storing raw statistics.
self.corr = []
for _ in range(nlevels):
self.corr.append([tf.zeros(shape, dtype=dtype)
for _ in range(nsteps_per_level)])
self.corr_count = []
for _ in range(nlevels):
self.corr_count.append(
[tf.convert_to_tensor(0, dtype=tf.int64)
for _ in range(nsteps_per_level)])
self.stat = []
for _ in range(nlevels):
self.stat.append(
[tf.zeros(shape, dtype=dtype) for _ in range(nsteps_per_level)])
def lag(self, level, step):
"""Return the time lag maintained at a particular position in the hierarchy.
Args:
level: int, >= 0, < nlevels, the level of the hierarchy.
step: int, >= 0, < nsteps_per_level, the step within the level.
Returns:
lag: int, >= 1, <= total_time(), the lag.
Raises:
ValueError: level or step values outside the correct range.
"""
if level < 0 or level >= self.nlevels:
raise ValueError('level must be >= 0 and < nlevels.')
if step < 0 or step >= self.nsteps_per_level:
raise ValueError('step must be >= 0 and < nsteps_per_level')
lag = (step+1)*(self.nsteps_per_level**level)
return lag
def _lag_to_level_and_step(self, time_lag):
"""Convert a lag to the rounded level and step in the hierarchy.
Args:
time_lag: int, >= 1, <= total_time(), the autocorrelation time lag.
Returns:
level: int, >= 0, < nlevels, the level in the hierarchy.
step: int, >= 0, < nsteps_per_level, the step in the level.
Raises:
RuntimeError: level and step cannot be determined.
ValueError: lag value outside the correct range.
"""
if time_lag >= self.total_time():
raise ValueError('Lag %d is outside valid range [1,%d].' % (
time_lag, self.total_time()))
if time_lag < 1:
raise ValueError('Lag %d must be >= 1.' % time_lag)
for level in range(self.nlevels):
step_shift = self.nsteps_per_level**level
step = time_lag // step_shift - 1
if step < self.nsteps_per_level:
return level, step
raise RuntimeError('lag_to_level reached impossible state.')
def _level_and_step_next(self, level, step):
"""Given a level and step, return the temporally next position.
Args:
level: int, >= 0, < nlevels, the level in the hierarchy.
step: int, >= 0, < nsteps_per_level, the step in the level.
Returns:
level: int, >= level, < nlevels, the level in the hierarchy.
step: int, >= 0, < nsteps_per_level, the step in the level.
Raises:
RuntimeError: level and step advanced beyond end of hierarchy.
ValueError: level or step values outside the correct range.
"""
if level < 0 or level >= self.nlevels:
raise ValueError('level must be >= 0 and < nlevels.')
if step < 0 or step >= self.nsteps_per_level:
raise ValueError('step must be >= 0 and < nsteps_per_level')
if step < (self.nsteps_per_level-1):
return level, step+1
level += 1
step = 2
if level >= self.nlevels:
raise RuntimeError('_lag_and_step_next called after end')
return level, step
def _autocorr_level_step(self, level, step):
"""Return the autocorrelation at an approximation point.
Args:
level: int, >= 0, < nlevels, the level in the hierarchy.
step: int, >= 0, < nsteps_per_level, the step in the level.
Returns:
acorr: Tensor, same shape and dtype as statistics in `update`.
Raises:
ValueError: level or step values outside the correct range.
"""
if level < 0 or level >= self.nlevels:
raise ValueError('level must be >= 0 and < nlevels.')
if step < 0 or step >= self.nsteps_per_level:
raise ValueError('step must be >= 0 and < nsteps_per_level')
acorr = (self.corr[level][step] - self.mean**2.0) / self.variance()
return acorr
def _autocorr(self, time_lag):
"""Return the autocorrelation at a time_lag.
Args:
time_lag: int, >= 0, <= total_time().
Returns:
acorr: Tensor, shape as statistic passed to `update`, the autocorrelation
at the approximation point at or before the given `time_lag`.
Raises:
ValueError: time_lag value outside the correct range.
"""
if time_lag < 0 or time_lag > self.total_time():
raise ValueError('time_lag must be >= 0 and <= total_time().')
if time_lag == 0:
return tf.ones_like(self.stat[0][0])
level, step = self._lag_to_level_and_step(time_lag)
return self._autocorr_level_step(level, step)
def __call__(self, time_lag):
"""Return the interpolated autocorrelation estimate at lag `time_lag`.
Args:
time_lag: int, >= 0, <= total_time().
Returns:
acorr: Tensor, shape as statistic passed to `update`, the inteprolated
autocorrelation estimate at the `time_lag`.
Raises:
ValueError: time_lag value outside the correct range.
"""
if time_lag < 0 or time_lag > self.total_time():
raise ValueError('time_lag must be >= 0 and <= total_time().')
if time_lag == 0:
return tf.ones_like(self.stat[0][0])
level1, step1 = self._lag_to_level_and_step(time_lag)
acorr1 = self._autocorr_level_step(level1, step1)
level2, step2 = self._level_and_step_next(level1, step1)
acorr2 = self._autocorr_level_step(level2, step2)
t1 = self.lag(level1, step1)
t2 = self.lag(level2, step2)
if t1 == t2:
return acorr1 # the most accurate estimate
assert time_lag >= t1 and time_lag <= t2, 'time_lag out of bounds'
# Linearly interpolate
weight1 = float(t2 - time_lag) / float(t2 - t1)
acorr = weight1*acorr1 + (1.0-weight1)*acorr2
return acorr
def total_time(self):
"""Return the largest lag for which we can estimate autocorrelation."""
return self.lag(self.nlevels-1, self.nsteps_per_level-1)
def variance(self):
"""Return an estimate of the marginal variance.
Returns:
var: Tensor, same shape as statistics passed to `update`.
The estimated marginal variance (unbiased sample variance).
"""
var = self.moment2 / (tf.cast(self.count, self.moment2.dtype)-1.0)
return var
def _update_stat(self, stat):
"""Update the marginal statistics.
Args:
stat: Tensor, same shape and dtype as the `shape` and `dtype` parameters
in the call to the constructor.
Raises:
ValueError: stat.shape does not match self.shape.
"""
# Check that the statistics shape matches
if stat.shape != self.shape:
raise ValueError('shape of statistic must match constructor shape.')
# Online update, using Welford's algorithm for running mean and variance,
# https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm
self.count += 1
delta = stat - self.mean
self.mean += delta / tf.cast(self.count, delta.dtype)
delta2 = stat - self.mean
self.moment2 += delta*delta2
def _update_corr_level(self, stat, level):
"""Update correlation statistics at a given level.
This method updated the autocorrelation estimates at the given `level`.
For this it uses the raw statistics stored at the current level.
Args:
stat: Tensor, same shape and dtype as the `shape` and `dtype` parameters
in the call to the constructor.
level: int, >= 0, < nlevels, the level to update the correlation
statistics.
"""
assert level >= 0 and level < self.nlevels, 'level out of bounds'
for step in range(self.nsteps_per_level):
if self.count < self.lag(level, step):
break
self.corr_count[level][step] += 1
delta = stat*self.stat[level][step] - self.corr[level][step]
self.corr[level][step] += delta / tf.cast(
self.corr_count[level][step], delta.dtype)
def _update_stat_level(self, stat, level):
"""Update the raw statistics at a given level.
This method renews the raw statistics at the given `level` so that the
oldest statistics are discarded and `stat` is stored.
Args:
stat: Tensor, same shape and dtype as the `shape` and `dtype` parameters
in the call to the constructor.
level: int, >= 0, < nlevels, the level to update the correlation
statistics.
"""
assert level >= 0 and level < self.nlevels, 'level out of bounds'
for step in range(self.nsteps_per_level-1, 0, -1):
self.stat[level][step] = self.stat[level][step-1]
self.stat[level][0] = stat
def _is_hstep(self, count, level):
"""Decide whether the given `level` should be updated.
Args:
count: int, >= 0, global time step, i.e. the number of calls to `update`.
level: int, >= 0, < nlevels, the level to decide about.
Returns:
do_update: true if layer should be updated, false otherwise.
"""
assert level >= 0 and level < self.nlevels, 'level out of bounds'
hstep = count % (self.nsteps_per_level**level)
do_update = tf.equal(hstep, 0)
return do_update
def update(self, stat):
"""Update the autocorrelation estimates using the given statistics.
Args:
stat: Tensor, same shape and dtype as the `shape` and `dtype` parameters
in the call to the constructor.
"""
for level in range(self.nlevels):
if self._is_hstep(self.count, level):
self._update_corr_level(stat, level)
self._update_stat_level(stat, level)
self._update_stat(stat)
def time_to_one_sample(self):
"""Estimate the time-to-one-sample (TT1).
The time-to-one-sample (TT1) is related to the effective sample size: TT1
measures the number of MCMC steps required to obtain one approximately
independent sample. The effective sample size (ESS) is related as `ESS = N
/ TT1`, where `N` is the number of iterations of the MCMC chain.
Returns:
time_to_one_sample: float, the number of iterations to obtain one
approximately independent sample.
"""
autocorr_sum = 0.5
for level in range(self.nlevels):
for step1 in range(self.nsteps_per_level-1):
step2 = step1 + 1
acorr1 = tf.reduce_mean(self._autocorr_level_step(level, step1))
acorr2 = tf.reduce_mean(self._autocorr_level_step(level, step2))
# Truncate computation if estimation uncertainty becomes too large.
# To estimate this uncertainty we use the current ESS estimate (1/asum).
# 2*autocorr_sum = 1/ess
sigma1 = math.sqrt(2.0*autocorr_sum /
float(self.corr_count[level][step1]))
sigma2 = math.sqrt(2.0*autocorr_sum /
float(self.corr_count[level][step2]))
truncate = False
if acorr1 <= sigma1 or acorr2 <= sigma2:
# Reached too small estimation accuracy to continue
truncate = True
acorr1 = max(acorr1, 0.0)
acorr2 = max(acorr2, 0.0)
# Integrate area under step1-step2 segment
lag1 = self.lag(level, step1)
lag2 = self.lag(level, step2)
delta = float(lag2 - lag1)
autocorr_sum += 0.5*(acorr1 + acorr2)*delta
if truncate:
time_to_one_sample = 2.0*autocorr_sum
return time_to_one_sample
time_to_one_sample = 2.0*autocorr_sum
return time_to_one_sample
| StarcoderdataPython |
1644934 | <reponame>TheBugYouCantFix/wiki-reddit-bot<filename>sentences.py<gh_stars>10-100
from datetime import datetime
# Reddit markdown is used in this string
comment_reply = f"\n\n\n\n*This comment was left automatically (by a bot)." \
f" If I don't get this right, don't get mad at me, I'm still learning!*\n\n" \
f"[^(opt out)](https://www.reddit.com/r/wikipedia_answer_bot/comments/ozztfy/post_for_opting_out/)" \
f" ^(|) [^(report/suggest)](https://www.reddit.com/r/wikipedia_answer_bot)" \
f" ^(|) [^(GitHub)](https://github.com/TheBugYouCantFix/wiki-reddit-bot)"
def few_meanings_reply(text):
return f'This word/phrase({text.strip()}) has a few different meanings.'
def festivity_reply():
now = datetime.now()
if datetime.date(now) == datetime(now.year, 12, 25).date():
return "\n\nHappy Xmas to you! <3"
elif datetime.date(now) == datetime(now.year, 12, 31).date():
return "\n\nHappy New Year's Eve, Redditor!"
elif datetime.date(now) == datetime(now.year, 1, 1).date():
return "\n\nHappy New Year, Redditor!"
return ""
| StarcoderdataPython |
3214108 | <reponame>lite3/Adbtool
import sys
def raise_error(err, code=1):
sys.exit(err)
| StarcoderdataPython |
82475 | '''
Utility functions to analyze particle data.
@author: <NAME> <<EMAIL>>
Units: unless otherwise noted, all quantities are in (combinations of):
mass [M_sun]
position [kpc comoving]
distance, radius [kpc physical]
velocity [km / s]
time [Gyr]
'''
# system ----
from __future__ import absolute_import, division, print_function # python 2 compatability
import numpy as np
from numpy import Inf
# local ----
from . import basic as ut
from . import halo_property
from . import orbit
from . import catalog
#===================================================================================================
# utilities - parsing input arguments
#===================================================================================================
def parse_species(part, species):
'''
Parse input list of species to ensure all are in catalog.
Parameters
----------
part : dict : catalog of particles
species : str or list : name[s] of particle species to analyze
Returns
-------
species : list : name[s] of particle species
'''
Say = ut.io.SayClass(parse_species)
if np.isscalar(species):
species = [species]
if species == ['all'] or species == ['total']:
species = list(part.keys())
elif species == ['baryon']:
species = ['gas', 'star']
for spec in list(species):
if spec not in part:
species.remove(spec)
Say.say('! {} not in particle catalog'.format(spec))
return species
def parse_indices(part_spec, part_indices):
'''
Parse input list of particle indices.
If none, generate via arange.
Parameters
----------
part_spec : dict : catalog of particles of given species
part_indices : array-like : indices of particles
Returns
-------
part_indices : array : indices of particles
'''
if part_indices is None or not len(part_indices):
if 'position' in part_spec:
part_indices = ut.array.get_arange(part_spec['position'].shape[0])
elif 'id' in part_spec:
part_indices = ut.array.get_arange(part_spec['id'].size)
elif 'mass' in part_spec:
part_indices = ut.array.get_arange(part_spec['mass'].size)
return part_indices
def parse_property(parts_or_species, property_name, property_values=None, single_host=True):
'''
Get property values, either input or stored in particle catalog.
List-ify as necessary to match input particle catalog.
Parameters
----------
parts_or_species : dict or string or list thereof :
catalog[s] of particles or string[s] of species
property_name : str : options: 'center_position', 'center_velocity', 'indices'
property_values : float/array or list thereof : property values to assign
single_host : bool : use only the primary host (if not input any property_values)
Returns
-------
property_values : float or list
'''
def parse_property_single(part_or_spec, property_name, property_values, single_host):
if property_name in ['center_position', 'center_velocity']:
if property_values is None or not len(property_values):
if property_name == 'center_position':
property_values = part_or_spec.host_positions
elif property_name == 'center_velocity':
# default to the primary host
property_values = part_or_spec.host_velocities
if property_values is None or not len(property_values):
raise ValueError('no input {} and no {} in input catalog'.format(
property_name, property_name))
if single_host:
property_values = property_values[0] # use omly the primary host
if isinstance(property_values, list):
raise ValueError('input list of {}s but input single catalog'.format(property_name))
return property_values
assert property_name in ['center_position', 'center_velocity', 'indices']
if isinstance(parts_or_species, list):
# input list of particle catalogs
if (property_values is None or not len(property_values) or
not isinstance(property_values, list)):
property_values = [property_values for _ in parts_or_species]
if len(property_values) != len(parts_or_species):
raise ValueError('number of input {}s not match number of input catalogs'.format(
property_name))
for i, part_or_spec in enumerate(parts_or_species):
property_values[i] = parse_property_single(
part_or_spec, property_name, property_values[i], single_host)
else:
# input single particle catalog
property_values = parse_property_single(
parts_or_species, property_name, property_values, single_host)
return property_values
#===================================================================================================
# id <-> index conversion
#===================================================================================================
def assign_id_to_index(
part, species=['all'], id_name='id', id_min=0, store_as_dict=False, print_diagnostic=True):
'''
Assign, to particle dictionary, arrays that points from object id to species kind and index in
species array.
This is useful for analyses multi-species catalogs with intermixed ids.
Do not assign pointers for ids below id_min.
Parameters
----------
part : dict : catalog of particles of various species
species : str or list : name[s] of species to use: 'all' = use all in particle dictionary
id_name : str : key name for particle id
id_min : int : minimum id in catalog
store_as_dict : bool : whether to store id-to-index pointer as dict instead of array
print_diagnostic : bool : whether to print diagnostic information
'''
Say = ut.io.SayClass(assign_id_to_index)
# get list of species that have valid id key
species = parse_species(part, species)
for spec in species:
assert id_name in part[spec]
# get list of all ids
ids_all = []
for spec in species:
ids_all.extend(part[spec][id_name])
ids_all = np.array(ids_all, dtype=part[spec][id_name].dtype)
if print_diagnostic:
# check if duplicate ids within species
for spec in species:
masks = (part[spec][id_name] >= id_min)
total_number = np.sum(masks)
unique_number = np.unique(part[spec][id_name][masks]).size
if total_number != unique_number:
Say.say('species {} has {} ids that are repeated'.format(
spec, total_number - unique_number))
# check if duplicate ids across species
if len(species) > 1:
masks = (ids_all >= id_min)
total_number = np.sum(masks)
unique_number = np.unique(ids_all[masks]).size
if total_number != unique_number:
Say.say('across all species, {} ids are repeated'.format(
total_number - unique_number))
Say.say('maximum id = {}'.format(ids_all.max()))
part.id_to_index = {}
if store_as_dict:
# store pointers as a dictionary
# store overall dictionary (across all species) and dictionary within each species
for spec in species:
part[spec].id_to_index = {}
for part_i, part_id in enumerate(part[spec][id_name]):
if part_id in part.id_to_index:
# redundant ids - add to existing entry as list
if isinstance(part.id_to_index[part_id], tuple):
part.id_to_index[part_id] = [part.id_to_index[part_id]]
part.id_to_index[part_id].append((spec, part_i))
if part_id in part[spec].id_to_index:
if np.isscalar(part[spec].id_to_index[part_id]):
part[spec].id_to_index[part_id] = [part[spec].id_to_index[part_id]]
part[spec].id_to_index[part_id].append(part_i)
else:
# new id - add as new entry
part.id_to_index[part_id] = (spec, part_i)
part[spec].id_to_index[part_id] = part_i
# convert lists to arrays
dtype = part[spec][id_name].dtype
for part_id in part[spec].id_to_index:
if isinstance(part[spec].id_to_index[part_id], list):
part[spec].id_to_index[part_id] = np.array(
part[spec].id_to_index[part_id], dtype=dtype)
else:
# store pointers as arrays
part.id_to_index['species'] = np.zeros(ids_all.max() + 1, dtype='|S6')
dtype = ut.array.parse_data_type(ids_all.max() + 1)
part.id_to_index['index'] = ut.array.get_array_null(ids_all.max() + 1, dtype=dtype)
for spec in species:
masks = (part[spec][id_name] >= id_min)
part.id_to_index['species'][part[spec][id_name][masks]] = spec
part.id_to_index['index'][part[spec][id_name][masks]] = ut.array.get_arange(
part[spec][id_name], dtype=dtype)[masks]
#===================================================================================================
# position, velocity
#===================================================================================================
def get_center_positions(
part, species=['star', 'dark', 'gas'], part_indicess=None, method='center-of-mass',
center_number=1, exclusion_distance=200, center_positions=None, distance_max=Inf,
compare_centers=False, return_array=True):
'''
Get position[s] of center of mass [kpc comoving] using iterative zoom-in on input species.
Parameters
----------
part : dict : dictionary of particles
species : str or list : name[s] of species to use: 'all' = use all in particle dictionary
part_indicess : array or list of arrays : indices of particle to use to define center
use this to include only particles that you know are relevant
method : str : method of centering: 'center-of-mass', 'potential'
center_number : int : number of centers to compute
exclusion_distance : float :
radius around previous center to cut before finding next center [kpc comoving]
center_position : array-like : initial center position[s] to use
distance_max : float : maximum radius to consider initially
compare_centers : bool : whether to run sanity check to compare centers via zoom v potential
return_array : bool :
whether to return single array instead of array of arrays, if center_number = 1
Returns
-------
center_positions : array or array of arrays: position[s] of center[s] [kpc comoving]
'''
Say = ut.io.SayClass(get_center_positions)
assert method in ['center-of-mass', 'potential']
species = parse_species(part, species)
part_indicess = parse_property(species, 'indices', part_indicess)
if center_positions is None or np.ndim(center_positions) == 1:
# list-ify center_positions
center_positions = [center_positions for _ in range(center_number)]
if np.shape(center_positions)[0] != center_number:
raise ValueError('! input center_positions = {} but also input center_number = {}'.format(
center_positions, center_number))
if method == 'potential':
if len(species) > 1:
Say.say('! using only first species = {} for centering via potential'.format(
species[0]))
if 'potential' not in part[species[0]]:
Say.say('! {} does not have potential, using center-of-mass zoom instead'.format(
species[0]))
method = 'center-of-mass'
if method == 'potential':
# use single (first) species
spec_i = 0
spec_name = species[spec_i]
part_indices = parse_indices(spec_name, part_indicess[spec_i])
for center_i, center_position in enumerate(center_positions):
if center_i > 0:
# cull out particles near previous center
distances = get_distances_wrt_center(
part, spec_name, part_indices, center_positions[center_i - 1],
total_distance=True, return_array=True)
# exclusion distance in [kpc comoving]
part_indices = part_indices[
distances > (exclusion_distance * part.info['scalefactor'])]
if center_position is not None and distance_max > 0 and distance_max < Inf:
# impose distance cut around input center
part_indices = get_indices_within_coordinates(
part, spec_name, [0, distance_max], center_position, part_indicess=part_indices,
return_array=True)
part_index = np.nanargmin(part[spec_name]['potential'][part_indices])
center_positions[center_i] = part[spec_name]['position'][part_index]
else:
for spec_i, spec_name in enumerate(species):
part_indices = parse_indices(part[spec_name], part_indicess[spec_i])
if spec_i == 0:
positions = part[spec_name]['position'][part_indices]
masses = part[spec_name]['mass'][part_indices]
else:
positions = np.concatenate(
[positions, part[spec_name]['position'][part_indices]])
masses = np.concatenate([masses, part[spec_name]['mass'][part_indices]])
for center_i, center_position in enumerate(center_positions):
if center_i > 0:
# remove particles near previous center
distances = ut.coordinate.get_distances(
positions, center_positions[center_i - 1], part.info['box.length'],
part.snapshot['scalefactor'], total_distance=True) # [kpc physical]
masks = (distances > (exclusion_distance * part.info['scalefactor']))
positions = positions[masks]
masses = masses[masks]
center_positions[center_i] = ut.coordinate.get_center_position_zoom(
positions, masses, part.info['box.length'], center_position=center_position,
distance_max=distance_max)
center_positions = np.array(center_positions)
if compare_centers:
position_dif_max = 1 # [kpc comoving]
if 'potential' not in part[species[0]]:
Say.say('! {} not have potential, cannot compare against zoom center-of-mass'.format(
species[0]))
return center_positions
if method == 'potential':
method_other = 'center-of-mass'
else:
method_other = 'potential'
center_positions_other = get_center_positions(
part, species, part_indicess, method_other, center_number, exclusion_distance,
center_positions, distance_max, compare_centers=False, return_array=False)
position_difs = np.abs(center_positions - center_positions_other)
for pi, position_dif in enumerate(position_difs):
if np.max(position_dif) > position_dif_max:
Say.say('! offset center positions')
Say.say('center position via {}: '.format(method), end='')
ut.io.print_array(center_positions[pi], '{:.3f}')
Say.say('center position via {}: '.format(method_other), end='')
ut.io.print_array(center_positions_other[pi], '{:.3f}')
Say.say('position difference: ', end='')
ut.io.print_array(position_dif, '{:.3f}')
if return_array and center_number == 1:
center_positions = center_positions[0]
return center_positions
def get_center_velocities(
part, species_name='star', part_indices=None, distance_max=15, center_positions=None,
return_array=True):
'''
Get velocity[s] [km / s] of center of mass of input species.
Parameters
----------
part : dict : dictionary of particles
species_name : str : name of particle species to use
part_indices : array : indices of particle to use to define center
use this to exclude particles that you know are not relevant
distance_max : float : maximum radius to consider [kpc physical]
center_positions : array or list of arrays: center position[s] [kpc comoving]
if None, will use default center position[s] in catalog
return_array : bool :
whether to return single array instead of array of arrays, if input single center position
Returns
-------
center_velocities : array or array of arrays : velocity[s] of center of mass [km / s]
'''
center_positions = parse_property(part, 'center_position', center_positions, single_host=False)
part_indices = parse_indices(part[species_name], part_indices)
distance_max /= part.snapshot['scalefactor'] # convert to [kpc comoving] to match positions
center_velocities = np.zeros(center_positions.shape, part[species_name]['velocity'].dtype)
for center_i, center_position in enumerate(center_positions):
center_velocities[center_i] = ut.coordinate.get_center_velocity(
part[species_name]['velocity'][part_indices],
part[species_name]['mass'][part_indices],
part[species_name]['position'][part_indices],
center_position, distance_max, part.info['box.length'])
if return_array and len(center_velocities) == 1:
center_velocities = center_velocities[0]
return center_velocities
def get_distances_wrt_center(
part, species=['star'], part_indicess=None, center_position=None, rotation=None,
coordinate_system='cartesian', total_distance=False, return_array=True):
'''
Get distances (scalar or vector) between input particles and center_position (input or stored
in particle catalog).
Parameters
----------
part : dict : catalog of particles at snapshot
species : str or list : name[s] of particle species to compute
part_indicess : array or list : indices[s] of particles to compute, one array per input species
center_position : array : position of center [kpc comoving]
if None, will use default center position in particle catalog
rotation : bool or array : whether to rotate particles
two options:
(a) if input array of eigen-vectors, will define rotation axes for all species
(b) if True, will rotate to align with principal axes defined by input species
coordinate_system : str : which coordinates to get distances in:
'cartesian' (default), 'cylindrical', 'spherical'
total_distance : bool : whether to compute total/scalar distance
return_array : bool : whether to return single array instead of dict if input single species
Returns
-------
dist : array (object number x dimension number) or dict thereof : [kpc physical]
3-D distance vectors aligned with default x,y,z axes OR
3-D distance vectors aligned with major, medium, minor axis OR
2-D distance vectors along major axes and along minor axis OR
1-D scalar distances
OR
dictionary of above for each species
'''
assert coordinate_system in ('cartesian', 'cylindrical', 'spherical')
species = parse_species(part, species)
center_position = parse_property(part, 'center_position', center_position)
part_indicess = parse_property(species, 'indices', part_indicess)
dist = {}
for spec_i, spec in enumerate(species):
part_indices = parse_indices(part[spec], part_indicess[spec_i])
dist[spec] = ut.coordinate.get_distances(
part[spec]['position'][part_indices], center_position, part.info['box.length'],
part.snapshot['scalefactor'], total_distance) # [kpc physical]
if not total_distance:
if rotation is not None:
if rotation is True:
# get principal axes stored in particle dictionary
if (len(part[spec].host_rotation_tensors) and
len(part[spec].host_rotation_tensors[0])):
rotation_tensor = part[spec].host_rotation_tensors[0]
else:
raise ValueError('! cannot find principal_axes_tensor in species dict')
elif len(rotation):
# use input rotation vectors
rotation_tensor = rotation
dist[spec] = ut.coordinate.get_coordinates_rotated(dist[spec], rotation_tensor)
if coordinate_system in ['cylindrical', 'spherical']:
dist[spec] = ut.coordinate.get_positions_in_coordinate_system(
dist[spec], 'cartesian', coordinate_system)
if return_array and len(species) == 1:
dist = dist[species[0]]
return dist
def get_velocities_wrt_center(
part, species=['star'], part_indicess=None, center_velocity=None, center_position=None,
rotation=False, coordinate_system='cartesian', total_velocity=False, return_array=True):
'''
Get velocities (either scalar or vector) between input particles and center_velocity
(input or stored in particle catalog).
Parameters
----------
part : dict : catalog of particles at snapshot
species : str or list : name[s] of particle species to get
part_indicess : array or list : indices[s] of particles to select, one array per input species
center_velocity : array : center velocity [km / s]
if None, will use default center velocity in catalog
center_position : array : center position [kpc comoving], to use in computing Hubble flow
if None, will use default center position in catalog
rotation : bool or array : whether to rotate particles
two options:
(a) if input array of eigen-vectors, will define rotation axes for all species
(b) if True, will rotate to align with principal axes defined by input species
coordinate_system : str : which coordinates to get positions in:
'cartesian' (default), 'cylindrical', 'spherical'
total_velocity : bool : whether to compute total/scalar velocity
return_array : bool : whether to return array (instead of dict) if input single species
Returns
-------
vel : array or dict thereof :
velocities (object number x dimension number, or object number) [km / s]
'''
assert coordinate_system in ('cartesian', 'cylindrical', 'spherical')
species = parse_species(part, species)
center_velocity = parse_property(part, 'center_velocity', center_velocity)
center_position = parse_property(part, 'center_position', center_position)
part_indicess = parse_property(species, 'indices', part_indicess)
vel = {}
for spec_i, spec in enumerate(species):
part_indices = parse_indices(part[spec], part_indicess[spec_i])
vel[spec] = ut.coordinate.get_velocity_differences(
part[spec]['velocity'][part_indices], center_velocity,
part[spec]['position'][part_indices], center_position, part.info['box.length'],
part.snapshot['scalefactor'], part.snapshot['time.hubble'], total_velocity)
if not total_velocity:
if rotation is not None:
if rotation is True:
# get principal axes stored in particle dictionary
if (len(part[spec].host_rotation_tensors) and
len(part[spec].host_rotation_tensors[0])):
rotation_tensor = part[spec].host_rotation_tensors[0]
else:
raise ValueError('! cannot find principal_axes_tensor in species dict')
elif len(rotation):
# use input rotation vectors
rotation_tensor = rotation
vel[spec] = ut.coordinate.get_coordinates_rotated(vel[spec], rotation_tensor)
if coordinate_system in ('cylindrical', 'spherical'):
# need to compute distance vectors
distances = ut.coordinate.get_distances(
part[spec]['position'][part_indices], center_position,
part.info['box.length'], part.snapshot['scalefactor']) # [kpc physical]
if rotation is not None:
# need to rotate distances too
distances = ut.coordinate.get_coordinates_rotated(distances, rotation_tensor)
vel[spec] = ut.coordinate.get_velocities_in_coordinate_system(
vel[spec], distances, 'cartesian', coordinate_system)
if return_array and len(species) == 1:
vel = vel[species[0]]
return vel
def get_orbit_dictionary(
part, species=['star'], part_indicess=None, center_position=None, center_velocity=None,
return_single=True):
'''
Get dictionary of orbital parameters.
Parameters
----------
part : dict : catalog of particles at snapshot
species : str or list : name[s] of particle species to compute
part_indicess : array or list : indices[s] of particles to select, one array per input species
center_position : array : center (reference) position
center_position : array : center (reference) velociy
return_single : bool :
whether to return single dict instead of dict of dicts, if single species
Returns
-------
orb : dict : dictionary of orbital properties, one for each species (unless scalarize is True)
'''
species = parse_species(part, species)
center_position = parse_property(part, 'center_position', center_position)
center_velocity = parse_property(part, 'center_velocity', center_velocity)
part_indicess = parse_property(species, 'indices', part_indicess)
orb = {}
for spec_i, spec in enumerate(species):
part_indices = parse_indices(part[spec], part_indicess[spec_i])
distance_vectors = ut.coordinate.get_distances(
part[spec]['position'][part_indices], center_position, part.info['box.length'],
part.snapshot['scalefactor'])
velocity_vectors = ut.coordinate.get_velocity_differences(
part[spec]['velocity'][part_indices], center_velocity,
part[spec]['position'][part_indices], center_position,
part.info['box.length'], part.snapshot['scalefactor'], part.snapshot['time.hubble'])
orb[spec] = orbit.get_orbit_dictionary(distance_vectors, velocity_vectors)
if return_single and len(species) == 1:
orb = orb[species[0]]
return orb
#===================================================================================================
# subsample
#===================================================================================================
def get_indices_within_coordinates(
part, species=['star'],
distance_limitss=[], center_position=None,
velocity_limitss=[], center_velocity=None,
rotation=None, coordinate_system='cartesian',
part_indicess=None, return_array=True):
'''
Get indices of particles that are within distance and/or velocity coordinate limits from center
(either input or stored in particle catalog).
Parameters
----------
part : dict : catalog of particles at snapshot
species : str or list : name[s] of particle species to use
distance_limitss : list or list of lists:
min and max distance[s], relative to center, to get particles [kpc physical]
default is 1-D list, but can be 2-D or 3-D list to select separately along dimensions
if 2-D or 3-D, need to input *signed* limits
center_position : array : center position [kpc comoving]
if None, will use default center position in particle catalog
velocity_limitss : list or list of lists:
min and max velocities, relative to center, to get particles [km / s]
default is 1-D list, but can be 2-D or 3-D list to select separately along dimensions
if 2-D or 3-D, need to input *signed* limits
center_velocity : array : center velocity [km / s]
if None, will use default center velocity in particle catalog
rotation : bool or array : whether to rotate particle coordinates
two options:
(a) if input array of eigen-vectors, will use to define rotation axes for all species
(b) if True, will rotate to align with principal axes defined by each input species
coordinate_system : str : which coordinates to get positions in:
'cartesian' (default), 'cylindrical', 'spherical'
part_indicess : array : prior indices[s] of particles to select, one array per input species
return_array : bool : whether to return single array instead of dict, if input single species
Returns
-------
part_index : dict or array : array or dict of arrays of indices of particles in region
'''
assert coordinate_system in ['cartesian', 'cylindrical', 'spherical']
species = parse_species(part, species)
center_position = parse_property(part, 'center_position', center_position)
if velocity_limitss is not None and len(velocity_limitss):
center_velocity = parse_property(part, 'center_velocity', center_velocity)
part_indicess = parse_property(species, 'indices', part_indicess)
part_index = {}
for spec_i, spec in enumerate(species):
part_indices = parse_indices(part[spec], part_indicess[spec_i])
if len(part_indices) and distance_limitss is not None and len(distance_limitss):
distance_limits_dimen = np.ndim(distance_limitss)
if distance_limits_dimen == 1:
total_distance = True
elif distance_limits_dimen == 2:
total_distance = False
assert len(distance_limitss) in [2, 3]
else:
raise ValueError('! cannot parse distance_limitss = {}'.format(distance_limitss))
if (distance_limits_dimen == 1 and distance_limitss[0] <= 0 and
distance_limitss[1] >= Inf):
pass # null case, no actual limits imposed, so skip rest
else:
"""
# an attempt to be clever, but gains seem modest
distances = np.abs(coordinate.get_position_difference(
part[spec]['position'] - center_position,
part.info['box.length'])) * part.snapshot['scalefactor'] # [kpc physical]
for dimension_i in range(part[spec]['position'].shape[1]):
masks *= ((distances[:, dimension_i] < np.max(distance_limits)) *
(distances[:, dimension_i] >= np.min(distance_limits)))
part_indices[spec] = part_indices[spec][masks]
distances = distances[masks]
distances = np.sum(distances ** 2, 1) # assume 3-d position
"""
distancess = get_distances_wrt_center(
part, spec, part_indices, center_position, rotation, coordinate_system,
total_distance)
if distance_limits_dimen == 1:
# distances are absolute
masks = (
(distancess >= np.min(distance_limitss)) *
(distancess < np.max(distance_limitss))
)
elif distance_limits_dimen == 2:
if len(distance_limitss) == 2:
# distances are signed
masks = (
(distancess[0] >= np.min(distance_limitss[0])) *
(distancess[0] < np.max(distance_limitss[0])) *
(distancess[1] >= np.min(distance_limitss[1])) *
(distancess[1] < np.max(distance_limitss[1]))
)
elif distance_limits_dimen == 3:
# distances are signed
masks = (
(distancess[0] >= np.min(distance_limitss[0])) *
(distancess[0] < np.max(distance_limitss[0])) *
(distancess[1] >= np.min(distance_limitss[1])) *
(distancess[1] < np.max(distance_limitss[1]))
(distancess[2] >= np.min(distance_limitss[2])) *
(distancess[2] < np.max(distance_limitss[2]))
)
part_indices = part_indices[masks]
if len(part_indices) and velocity_limitss is not None and len(velocity_limitss):
velocity_limits_dimen = np.ndim(velocity_limitss)
if velocity_limits_dimen == 1:
return_total_velocity = True
elif velocity_limits_dimen == 2:
return_total_velocity = False
assert len(velocity_limitss) in [2, 3]
else:
raise ValueError('! cannot parse velocity_limitss = {}'.format(velocity_limitss))
if (velocity_limits_dimen == 1 and velocity_limitss[0] <= 0 and
velocity_limitss[1] >= Inf):
pass # null case, no actual limits imposed, so skip rest
else:
velocitiess = get_velocities_wrt_center(
part, spec, part_indices, center_velocity, center_position, rotation,
coordinate_system, return_total_velocity)
if velocity_limits_dimen == 1:
# velocities are absolute
masks = (
(velocitiess >= np.min(velocity_limitss)) *
(velocitiess < np.max(velocity_limitss))
)
elif velocity_limits_dimen == 2:
if len(velocity_limitss) == 2:
# velocities are signed
masks = (
(velocitiess[0] >= np.min(velocity_limitss[0])) *
(velocitiess[0] < np.max(velocity_limitss[0])) *
(velocitiess[1] >= np.min(velocity_limitss[1])) *
(velocitiess[1] < np.max(velocity_limitss[1]))
)
elif len(velocity_limitss) == 3:
# velocities are signed
masks = (
(velocitiess[0] >= np.min(velocity_limitss[0])) *
(velocitiess[0] < np.max(velocity_limitss[0])) *
(velocitiess[1] >= np.min(velocity_limitss[1])) *
(velocitiess[1] < np.max(velocity_limitss[1]))
(velocitiess[2] >= np.min(velocity_limitss[2])) *
(velocitiess[2] < np.max(velocity_limitss[2]))
)
part_indices = part_indices[masks]
part_index[spec] = part_indices
if return_array and len(species) == 1:
part_index = part_index[species[0]]
return part_index
def get_indices_id_kind(
part, species=['star'], id_kind='unique', part_indicess=None, return_array=True):
'''
Get indices of particles that either are unique (no other particles of same species have
same id) or multiple (other particle of same species has same id).
Parameters
----------
part : dict : catalog of particles at snapshot
species : str or list : name[s] of particle species
split_kind : str : id kind of particles to get: 'unique', 'multiple'
part_indicess : array : prior indices[s] of particles to select, one array per input species
return_array : bool : whether to return single array instead of dict, if input single species
Returns
-------
part_index : dict or array : array or dict of arrays of indices of particles of given split kind
'''
species = parse_species(part, species)
part_indicess = parse_property(species, 'indices', part_indicess)
assert id_kind in ['unique', 'multiple']
part_index = {}
for spec_i, spec in enumerate(species):
part_indices = parse_indices(part[spec], part_indicess[spec_i])
_pids, piis, counts = np.unique(
part[spec]['id'][part_indices], return_index=True, return_counts=True)
pis_unsplit = np.sort(part_indices[piis[counts == 1]])
if id_kind == 'unique':
part_index[spec] = pis_unsplit
elif id_kind == 'multiple':
part_index[spec] = np.setdiff1d(part_indices, pis_unsplit)
else:
raise ValueError('! not recognize id_kind = {}'.format(id_kind))
if return_array and len(species) == 1:
part_index = part_index[species[0]]
return part_index
#===================================================================================================
# halo/galaxy major/minor axes
#===================================================================================================
def get_principal_axes(
part, species_name='star', distance_max=Inf, mass_percent=None, age_percent=None, age_limits=[],
center_positions=None, center_velocities=None, part_indices=None, return_array=True,
print_results=True):
'''
Get reverse-sorted eigen-vectors, eigen-values, and axis ratios of principal axes of
each host galaxy/halo.
Ensure that principal axes are oriented so median v_phi > 0.
Parameters
----------
part : dict : catalog of particles at snapshot
species : str or list : name[s] of particle species to use
distance_max : float : maximum distance to select particles [kpc physical]
mass_percent : float : keep particles within the distance that encloses mass percent [0, 100]
of all particles within distance_max
age_percent : float : use the youngest age_percent of particles within distance cut
age_limits : float : use only particles within age limits
center_positions : array or array of arrays : position[s] of center[s] [kpc comoving]
center_velocities : array or array of arrays : velocity[s] of center[s] [km / s]
part_indices : array : indices[s] of particles to select
return_array : bool :
whether to return single array for each property, instead of array of arrays, if single host
print_results : bool : whether to print axis ratios
Returns
-------
principal_axes = {
'rotation.tensor': array : rotation vectors that define max, med, min axes
'eigen.values': array : eigen-values of max, med, min axes
'axis.ratios': array : ratios of principal axes
}
'''
Say = ut.io.SayClass(get_principal_axes)
center_positions = parse_property(part, 'center_position', center_positions, single_host=False)
center_velocities = parse_property(
part, 'center_velocity', center_velocities, single_host=False)
part_indices = parse_indices(part[species_name], part_indices)
principal_axes = {
'rotation.tensor': [],
'eigen.values': [],
'axis.ratios': [],
}
for center_i, center_position in enumerate(center_positions):
distance_vectors = ut.coordinate.get_distances(
part[species_name]['position'][part_indices], center_position, part.info['box.length'],
part.snapshot['scalefactor']) # [kpc physical]
distances = np.sqrt(np.sum(distance_vectors ** 2, 1))
masks = (distances < distance_max)
if mass_percent:
distance_percent = ut.math.percentile_weighted(
distances[masks], mass_percent,
part[species_name].prop('mass', part_indices[masks]))
masks *= (distances < distance_percent)
if age_percent or (age_limits is not None and len(age_limits)):
if 'form.scalefactor' not in part[species_name]:
raise ValueError('! input age constraints but age not in {} catalog'.format(
species_name))
if age_percent and (age_limits is not None and len(age_limits)):
Say.say('input both age_percent and age_limits, using only age_percent')
if age_percent:
age_max = ut.math.percentile_weighted(
part[species_name].prop('age', part_indices[masks]), age_percent,
part[species_name].prop('mass', part_indices[masks]))
age_limits_use = [0, age_max]
else:
age_limits_use = age_limits
Say.say('using {} particles with age = {} Gyr'.format(
species_name, ut.array.get_limits_string(age_limits_use)))
masks *= ((part[species_name].prop('age', part_indices) >= min(age_limits_use)) *
(part[species_name].prop('age', part_indices) < max(age_limits_use)))
rotation_tensor, eigen_values, axis_ratios = ut.coordinate.get_principal_axes(
distance_vectors[masks], part[species_name].prop('mass', part_indices[masks]),
print_results)
# test if need to flip a principal axis to ensure that net v_phi > 0
velocity_vectors = ut.coordinate.get_velocity_differences(
part[species_name].prop('velocity', part_indices[masks]), center_velocities[center_i])
velocity_vectors_rot = ut.coordinate.get_coordinates_rotated(
velocity_vectors, rotation_tensor)
distance_vectors_rot = ut.coordinate.get_coordinates_rotated(
distance_vectors[masks], rotation_tensor)
velocity_vectors_cyl = ut.coordinate.get_velocities_in_coordinate_system(
velocity_vectors_rot, distance_vectors_rot, 'cartesian', 'cylindrical')
if np.median(velocity_vectors_cyl[:, 2]) < 0:
rotation_tensor[1] *= -1 # flip so net v_phi is positive
principal_axes['rotation.tensor'].append(rotation_tensor)
principal_axes['eigen.values'].append(eigen_values)
principal_axes['axis.ratios'].append(axis_ratios)
for k in principal_axes:
principal_axes[k] = np.array(principal_axes[k])
if return_array and np.shape(center_positions)[0] == 1:
for k in principal_axes:
principal_axes[k] = principal_axes[k][0]
return principal_axes
#===================================================================================================
# halo/galaxy radius
#===================================================================================================
def get_halo_properties(
part, species=['dark', 'star', 'gas'], virial_kind='200m',
distance_limits=[10, 600], distance_bin_width=0.02, distance_scaling='log',
center_position=None, return_array=True, print_results=True):
'''
Compute halo radius according to virial_kind.
Return this radius, the mass from each species within this radius, and particle indices within
this radius (if get_part_indices).
Parameters
----------
part : dict : catalog of particles at snapshot
species : str or list : name[s] of particle species to use: 'all' = use all in dictionary
virial_kind : str : virial overdensity definition
'200m' -> average density is 200 x matter
'200c' -> average density is 200 x critical
'vir' -> average density is Bryan & Norman
'fof.100m' -> edge density is 100 x matter, for FoF(ll=0.168)
'fof.60m' -> edge density is 60 x matter, for FoF(ll=0.2)
distance_limits : list : min and max distance to consider [kpc physical]
distance_bin_width : float : width of distance bin
distance_scaling : str : scaling of distance: 'log', 'linear'
center_position : array : center position to use
if None, will use default center position in catalog
return_array : bool : whether to return array (instead of dict) if input single species
print_results : bool : whether to print radius and mass
Returns
-------
halo_prop : dict : dictionary of halo properties:
radius : float : halo radius [kpc physical]
mass : float : mass within radius [M_sun]
indices : array : indices of partices within radius (if get_part_indices)
'''
distance_limits = np.asarray(distance_limits)
Say = ut.io.SayClass(get_halo_properties)
species = parse_species(part, species)
center_position = parse_property(part, 'center_position', center_position)
HaloProperty = halo_property.HaloPropertyClass(part.Cosmology, part.snapshot['redshift'])
DistanceBin = ut.binning.DistanceBinClass(
distance_scaling, distance_limits, width=distance_bin_width, dimension_number=3)
overdensity, reference_density = HaloProperty.get_overdensity(virial_kind, units='kpc physical')
virial_density = overdensity * reference_density
mass_cum_in_bins = np.zeros(DistanceBin.number)
distancess = []
for spec_i, spec in enumerate(species):
distances = ut.coordinate.get_distances(
part[spec]['position'], center_position, part.info['box.length'],
part.snapshot['scalefactor'], total_distance=True) # [kpc physical]
distancess.append(distances)
mass_in_bins = DistanceBin.get_histogram(distancess[spec_i], False, part[spec]['mass'])
# get mass within distance minimum, for computing cumulative values
distance_indices = np.where(distancess[spec_i] < np.min(distance_limits))[0]
mass_cum_in_bins += (np.sum(part[spec]['mass'][distance_indices]) +
np.cumsum(mass_in_bins))
if part.info['baryonic'] and len(species) == 1 and species[0] == 'dark':
# correct for baryonic mass if analyzing only dark matter in baryonic simulation
Say.say('! using only dark particles, so correcting for baryonic mass')
mass_factor = 1 + part.Cosmology['omega_baryon'] / part.Cosmology['omega_matter']
mass_cum_in_bins *= mass_factor
# cumulative densities in bins
density_cum_in_bins = mass_cum_in_bins / DistanceBin.volumes_cum
# get smallest radius that satisfies virial density
for d_bin_i in range(DistanceBin.number - 1):
if (density_cum_in_bins[d_bin_i] >= virial_density and
density_cum_in_bins[d_bin_i + 1] < virial_density):
# interpolate in log space
log_halo_radius = np.interp(
np.log10(virial_density), np.log10(density_cum_in_bins[[d_bin_i + 1, d_bin_i]]),
DistanceBin.log_maxs[[d_bin_i + 1, d_bin_i]])
halo_radius = 10 ** log_halo_radius
break
else:
Say.say('! could not determine halo R_{}'.format(virial_kind))
if density_cum_in_bins[0] < virial_density:
Say.say('distance min = {:.1f} kpc already is below virial density = {}'.format(
distance_limits.min(), virial_density))
Say.say('decrease distance_limits')
elif density_cum_in_bins[-1] > virial_density:
Say.say('distance max = {:.1f} kpc still is above virial density = {}'.format(
distance_limits.max(), virial_density))
Say.say('increase distance_limits')
else:
Say.say('not sure why!')
return
# get maximum of V_circ = sqrt(G M(< r) / r)
vel_circ_in_bins = ut.constant.km_per_kpc * np.sqrt(
ut.constant.grav_kpc_msun_sec * mass_cum_in_bins / DistanceBin.maxs)
vel_circ_max = np.max(vel_circ_in_bins)
vel_circ_max_radius = DistanceBin.maxs[np.argmax(vel_circ_in_bins)]
halo_mass = 0
part_indices = {}
for spec_i, spec in enumerate(species):
masks = (distancess[spec_i] < halo_radius)
halo_mass += np.sum(part[spec]['mass'][masks])
part_indices[spec] = ut.array.get_arange(part[spec]['mass'])[masks]
if print_results:
Say.say(
'R_{} = {:.1f} kpc\n M_{} = {} M_sun, log = {}\n V_max = {:.1f} km/s'.format(
virial_kind, halo_radius, virial_kind,
ut.io.get_string_from_numbers(halo_mass, 2),
ut.io.get_string_from_numbers(np.log10(halo_mass), 2),
vel_circ_max)
)
halo_prop = {}
halo_prop['radius'] = halo_radius
halo_prop['mass'] = halo_mass
halo_prop['vel.circ.max'] = vel_circ_max
halo_prop['vel.circ.max.radius'] = vel_circ_max_radius
if return_array and len(species) == 1:
part_indices = part_indices[species[0]]
halo_prop['indices'] = part_indices
return halo_prop
def get_galaxy_properties(
part, species_name='star', edge_kind='mass.percent', edge_value=90,
distance_max=20, distance_bin_width=0.02, distance_scaling='log', center_position=None,
axis_kind='', rotation_tensor=None, rotation_distance_max=20,
other_axis_distance_limits=None, part_indices=None, print_results=True):
'''
Compute galaxy radius according to edge_kind.
Return this radius, the mass from species within this radius, particle indices within this
radius, and rotation vectors (if applicable).
Parameters
----------
part : dict : catalog of particles at snapshot
species_name : str : name of particle species to use
edge_kind : str : method to define galaxy radius
'mass.percent' = radius at which edge_value (percent) of stellar mass within distance_max
'density' = radius at which density is edge_value [log(M_sun / kpc^3)]
edge_value : float : value to use to define galaxy radius
mass_percent : float : percent of mass (out to distance_max) to define radius
distance_max : float : maximum distance to consider [kpc physical]
distance_bin_width : float : width of distance bin
distance_scaling : str : distance bin scaling: 'log', 'linear'
axis_kind : str : 'major', 'minor', 'both'
rotation_tensor : array : rotation vectors that define principal axes
rotation_distance_max : float :
maximum distance to use in defining rotation vectors of principal axes [kpc physical]
other_axis_distance_limits : float :
min and max distances along other axis[s] to keep particles [kpc physical]
center_position : array : center position [kpc comoving]
if None, will use default center position in catalog
part_indices : array : star particle indices (if already know which ones are close)
print_results : bool : whether to print radius and mass of galaxy
Returns
-------
gal_prop : dict : dictionary of galaxy properties:
radius or radius.major & radius.minor : float : galaxy radius[s] [kpc physical]
mass : float : mass within radius[s] [M_sun]
indices : array : indices of partices within radius[s] (if get_part_indices)
rotation.vectors : array : eigen-vectors that defined rotation
'''
def get_radius_mass_indices(
masses, distances, distance_scaling, distance_limits, distance_bin_width, dimension_number,
edge_kind, edge_value):
'''
Utility function.
'''
Say = ut.io.SayClass(get_radius_mass_indices)
DistanceBin = ut.binning.DistanceBinClass(
distance_scaling, distance_limits, width=distance_bin_width,
dimension_number=dimension_number)
# get masses in distance bins
mass_in_bins = DistanceBin.get_histogram(distances, False, masses)
if edge_kind == 'mass.percent':
# get mass within distance minimum, for computing cumulative values
d_indices = np.where(distances < np.min(distance_limits))[0]
log_masses_cum = ut.math.get_log(np.sum(masses[d_indices]) + np.cumsum(mass_in_bins))
log_mass = np.log10(edge_value / 100) + log_masses_cum.max()
try:
# interpolate in log space
log_radius = np.interp(log_mass, log_masses_cum, DistanceBin.log_maxs)
except ValueError:
Say.say('! could not find object radius - increase distance_max')
return
elif edge_kind == 'density':
log_density_in_bins = ut.math.get_log(mass_in_bins / DistanceBin.volumes)
# use only bins with defined density (has particles)
d_bin_indices = np.arange(DistanceBin.number)[np.isfinite(log_density_in_bins)]
# get smallest radius that satisfies density threshold
for d_bin_ii, d_bin_i in enumerate(d_bin_indices):
d_bin_i_plus_1 = d_bin_indices[d_bin_ii + 1]
if (log_density_in_bins[d_bin_i] >= edge_value and
log_density_in_bins[d_bin_i_plus_1] < edge_value):
# interpolate in log space
log_radius = np.interp(
edge_value, log_density_in_bins[[d_bin_i_plus_1, d_bin_i]],
DistanceBin.log_maxs[[d_bin_i_plus_1, d_bin_i]])
break
else:
Say.say('! could not find object radius - increase distance_max')
return
radius = 10 ** log_radius
masks = (distances < radius)
mass = np.sum(masses[masks])
indices = ut.array.get_arange(masses)[masks]
return radius, mass, indices
# start function
Say = ut.io.SayClass(get_galaxy_properties)
distance_min = 0.001 # [kpc physical]
distance_limits = [distance_min, distance_max]
if edge_kind == 'mass.percent':
# dealing with cumulative value - stable enough to decrease bin with
distance_bin_width *= 0.1
center_position = parse_property(part, 'center_position', center_position)
if part_indices is None or not len(part_indices):
part_indices = ut.array.get_arange(part[species_name]['position'].shape[0])
distance_vectors = ut.coordinate.get_distances(
part[species_name]['position'][part_indices], center_position,
part.info['box.length'], part.snapshot['scalefactor']) # [kpc physical]
distances = np.sqrt(np.sum(distance_vectors ** 2, 1)) # 3-D distance
masses = part[species_name].prop('mass', part_indices)
if axis_kind:
# radius along 2-D major axes (projected radius) or along 1-D minor axis (height)
assert axis_kind in ['major', 'minor', 'both']
if rotation_tensor is None or not len(rotation_tensor):
if (len(part[species_name].host_rotation_tensors) and
len(part[species_name].host_rotation_tensors[0])):
# use only the primary host
rotation_tensor = part[species_name].host_rotation_tensors[0]
else:
masks = (distances < rotation_distance_max)
rotation_tensor = ut.coordinate.get_principal_axes(
distance_vectors[masks], masses[masks])[0]
distance_vectors = ut.coordinate.get_coordinates_rotated(
distance_vectors, rotation_tensor=rotation_tensor)
distances_cyl = ut.coordinate.get_positions_in_coordinate_system(
distance_vectors, 'cartesian', 'cylindrical')
major_distances, minor_distances = distances_cyl[:, 0], distances_cyl[:, 1]
minor_distances = np.abs(minor_distances) # need only absolute distances
if axis_kind in ['major', 'minor']:
if axis_kind == 'minor':
dimension_number = 1
distances = minor_distances
other_distances = major_distances
elif axis_kind == 'major':
dimension_number = 2
distances = major_distances
other_distances = minor_distances
if (other_axis_distance_limits is not None and
(min(other_axis_distance_limits) > 0 or max(other_axis_distance_limits) < Inf)):
masks = ((other_distances >= min(other_axis_distance_limits)) *
(other_distances < max(other_axis_distance_limits)))
distances = distances[masks]
masses = masses[masks]
else:
# spherical average
dimension_number = 3
gal_prop = {}
if axis_kind == 'both':
# first get 3-D radius
galaxy_radius_3d, _galaxy_mass_3d, indices = get_radius_mass_indices(
masses, distances, distance_scaling, distance_limits, distance_bin_width, 3,
edge_kind, edge_value)
galaxy_radius_major = galaxy_radius_3d
axes_mass_dif = 1
# then iterate to get both major and minor axes
while axes_mass_dif > 0.005:
# get 1-D radius along minor axis
masks = (major_distances < galaxy_radius_major)
galaxy_radius_minor, galaxy_mass_minor, indices = get_radius_mass_indices(
masses[masks], minor_distances[masks], distance_scaling, distance_limits,
distance_bin_width, 1, edge_kind, edge_value)
# get 2-D radius along major axes
masks = (minor_distances < galaxy_radius_minor)
galaxy_radius_major, galaxy_mass_major, indices = get_radius_mass_indices(
masses[masks], major_distances[masks], distance_scaling, distance_limits,
distance_bin_width, 2, edge_kind, edge_value)
axes_mass_dif = (abs(galaxy_mass_major - galaxy_mass_minor) /
(0.5 * (galaxy_mass_major + galaxy_mass_minor)))
indices = (major_distances < galaxy_radius_major) * (minor_distances < galaxy_radius_minor)
gal_prop['radius.major'] = galaxy_radius_major
gal_prop['radius.minor'] = galaxy_radius_minor
gal_prop['mass'] = galaxy_mass_major
gal_prop['log mass'] = np.log10(galaxy_mass_major)
gal_prop['rotation.tensor'] = rotation_tensor
gal_prop['indices'] = part_indices[indices]
if print_results:
Say.say('R_{:.0f} along major, minor axes = {:.2f}, {:.2f} kpc physical'.format(
edge_value, galaxy_radius_major, galaxy_radius_minor))
else:
galaxy_radius, galaxy_mass, indices = get_radius_mass_indices(
masses, distances, distance_scaling, distance_limits, distance_bin_width,
dimension_number, edge_kind, edge_value)
gal_prop['radius'] = galaxy_radius
gal_prop['mass'] = galaxy_mass
gal_prop['log mass'] = np.log10(galaxy_mass)
gal_prop['indices'] = part_indices[indices]
if print_results:
Say.say('R_{:.0f} = {:.2f} kpc physical'.format(edge_value, galaxy_radius))
if print_results:
Say.say('M_star = {:.2e} M_sun, log = {:.2f}'.format(
gal_prop['mass'], gal_prop['log mass']))
return gal_prop
#===================================================================================================
# profiles of properties
#===================================================================================================
class SpeciesProfileClass(ut.binning.DistanceBinClass):
'''
Get profiles of either histogram/sum or stastitics (such as average, median) of given
property for given particle species.
__init__ is defined via ut.binning.DistanceBinClass
'''
def get_profiles(
self, part, species=['all'],
property_name='', property_statistic='sum', weight_by_mass=False,
center_position=None, center_velocity=None, rotation=None,
other_axis_distance_limits=None, property_select={}, part_indicess=None):
'''
Parse inputs into either get_sum_profiles() or get_statistics_profiles().
If know what you want, can skip this and jump to those functions.
Parameters
----------
part : dict : catalog of particles
species : str or list : name[s] of particle species to compute mass from
property_name : str : name of property to get statistics of
property_statistic : str : statistic to get profile of:
'sum', 'sum.cum', 'density', 'density.cum', 'vel.circ'
weight_by_mass : bool : whether to weight property by species mass
center_position : array : position of center
center_velocity : array : velocity of center
rotation : bool or array : whether to rotate particles - two options:
(a) if input array of eigen-vectors, will define rotation axes
(b) if True, will rotate to align with principal axes stored in species dictionary
other_axis_distance_limits : float :
min and max distances along other axis[s] to keep particles [kpc physical]
property_select : dict : (other) properties to select on: names as keys and limits as values
part_indicess : array (species number x particle number) :
indices of particles from which to select
Returns
-------
pros : dict : dictionary of profiles for each particle species
'''
if ('sum' in property_statistic or 'vel.circ' in property_statistic or
'density' in property_statistic):
pros = self.get_sum_profiles(
part, species, property_name, center_position, rotation, other_axis_distance_limits,
property_select, part_indicess)
else:
pros = self.get_statistics_profiles(
part, species, property_name, weight_by_mass, center_position, center_velocity,
rotation, other_axis_distance_limits, property_select, part_indicess)
for k in pros:
if '.cum' in property_statistic or 'vel.circ' in property_statistic:
pros[k]['distance'] = pros[k]['distance.cum']
pros[k]['log distance'] = pros[k]['log distance.cum']
else:
pros[k]['distance'] = pros[k]['distance.mid']
pros[k]['log distance'] = pros[k]['log distance.mid']
return pros
def get_sum_profiles(
self, part, species=['all'], property_name='mass', center_position=None,
rotation=None, other_axis_distance_limits=None, property_select={}, part_indicess=None):
'''
Get profiles of summed quantity (such as mass or density) for given property for each
particle species.
Parameters
----------
part : dict : catalog of particles
species : str or list : name[s] of particle species to compute mass from
property_name : str : property to get sum of
center_position : list : center position
rotation : bool or array : whether to rotate particles - two options:
(a) if input array of eigen-vectors, will define rotation axes
(b) if True, will rotate to align with principal axes stored in species dictionary
other_axis_distance_limits : float :
min and max distances along other axis[s] to keep particles [kpc physical]
property_select : dict : (other) properties to select on: names as keys and limits as values
part_indicess : array (species number x particle number) :
indices of particles from which to select
Returns
-------
pros : dict : dictionary of profiles for each particle species
'''
if 'gas' in species and 'consume.time' in property_name:
pros_mass = self.get_sum_profiles(
part, species, 'mass', center_position, rotation, other_axis_distance_limits,
property_select, part_indicess)
pros_sfr = self.get_sum_profiles(
part, species, 'sfr', center_position, rotation, other_axis_distance_limits,
property_select, part_indicess)
pros = pros_sfr
for k in pros_sfr['gas']:
if 'distance' not in k:
pros['gas'][k] = pros_mass['gas'][k] / pros_sfr['gas'][k] / 1e9
return pros
pros = {}
Fraction = ut.math.FractionClass()
if np.isscalar(species):
species = [species]
if species == ['baryon']:
# treat this case specially for baryon fraction
species = ['gas', 'star', 'dark', 'dark2']
species = parse_species(part, species)
center_position = parse_property(part, 'center_position', center_position)
part_indicess = parse_property(species, 'indices', part_indicess)
assert 0 < self.dimension_number <= 3
for spec_i, spec in enumerate(species):
part_indices = part_indicess[spec_i]
if part_indices is None or not len(part_indices):
part_indices = ut.array.get_arange(part[spec].prop(property_name))
if property_select:
part_indices = catalog.get_indices_catalog(
part[spec], property_select, part_indices)
prop_values = part[spec].prop(property_name, part_indices)
if self.dimension_number == 3:
# simple case: profile using scalar distance
distances = ut.coordinate.get_distances(
part[spec]['position'][part_indices], center_position, part.info['box.length'],
part.snapshot['scalefactor'], total_distance=True) # [kpc physical]
elif self.dimension_number in [1, 2]:
# other cases: profile along R (2 major axes) or Z (minor axis)
if rotation is not None and not isinstance(rotation, bool) and len(rotation):
rotation_tensor = rotation
elif (len(part[spec].host_rotation_tensors) and
len(part[spec].host_rotation_tensors[0])):
rotation_tensor = part[spec].host_rotation_tensors[0]
else:
raise ValueError('want 2-D or 1-D profile but no means to define rotation')
distancess = get_distances_wrt_center(
part, spec, part_indices, center_position, rotation_tensor,
coordinate_system='cylindrical')
# ensure all distances are positive definite
distancess = np.abs(distancess)
if self.dimension_number == 1:
# compute profile along minor axis (Z)
distances = distancess[:, 1]
other_distances = distancess[:, 0]
elif self.dimension_number == 2:
# compute profile along major axes (R)
distances = distancess[:, 0]
other_distances = distancess[:, 1]
if (other_axis_distance_limits is not None and
(min(other_axis_distance_limits) > 0 or
max(other_axis_distance_limits) < Inf)):
masks = ((other_distances >= min(other_axis_distance_limits)) *
(other_distances < max(other_axis_distance_limits)))
distances = distances[masks]
prop_values = prop_values[masks]
pros[spec] = self.get_sum_profile(distances, prop_values) # defined in DistanceBinClass
props = [pro_prop for pro_prop in pros[species[0]] if 'distance' not in pro_prop]
props_dist = [pro_prop for pro_prop in pros[species[0]] if 'distance' in pro_prop]
if property_name == 'mass':
# create dictionary for baryonic mass
if 'star' in species or 'gas' in species:
spec_new = 'baryon'
pros[spec_new] = {}
for spec in np.intersect1d(species, ['star', 'gas']):
for pro_prop in props:
if pro_prop not in pros[spec_new]:
pros[spec_new][pro_prop] = np.array(pros[spec][pro_prop])
elif 'log' in pro_prop:
pros[spec_new][pro_prop] = ut.math.get_log(
10 ** pros[spec_new][pro_prop] +
10 ** pros[spec][pro_prop])
else:
pros[spec_new][pro_prop] += pros[spec][pro_prop]
for pro_prop in props_dist:
pros[spec_new][pro_prop] = pros[species[0]][pro_prop]
species.append(spec_new)
if len(species) > 1:
# create dictionary for total mass
spec_new = 'total'
pros[spec_new] = {}
for spec in np.setdiff1d(species, ['baryon', 'total']):
for pro_prop in props:
if pro_prop not in pros[spec_new]:
pros[spec_new][pro_prop] = np.array(pros[spec][pro_prop])
elif 'log' in pro_prop:
pros[spec_new][pro_prop] = ut.math.get_log(
10 ** pros[spec_new][pro_prop] +
10 ** pros[spec][pro_prop])
else:
pros[spec_new][pro_prop] += pros[spec][pro_prop]
for pro_prop in props_dist:
pros[spec_new][pro_prop] = pros[species[0]][pro_prop]
species.append(spec_new)
# create mass fraction wrt total mass
for spec in np.setdiff1d(species, ['total']):
for pro_prop in ['sum', 'sum.cum']:
pros[spec][pro_prop + '.fraction'] = Fraction.get_fraction(
pros[spec][pro_prop], pros['total'][pro_prop])
if spec == 'baryon':
# units of cosmic baryon fraction
pros[spec][pro_prop + '.fraction'] /= (
part.Cosmology['omega_baryon'] / part.Cosmology['omega_matter'])
# create circular velocity = sqrt (G m(< r) / r)
for spec in species:
pros[spec]['vel.circ'] = halo_property.get_circular_velocity(
pros[spec]['sum.cum'], pros[spec]['distance.cum'])
return pros
def get_statistics_profiles(
self, part, species=['all'], property_name='', weight_by_mass=True,
center_position=None, center_velocity=None, rotation=None, other_axis_distance_limits=None,
property_select={}, part_indicess=None):
'''
Get profiles of statistics (such as median, average) for given property for each
particle species.
Parameters
----------
part : dict : catalog of particles
species : str or list : name[s] of particle species to compute mass from
property_name : str : name of property to get statistics of
weight_by_mass : bool : whether to weight property by species mass
center_position : array : position of center
center_velocity : array : velocity of center
rotation : bool or array : whether to rotate particles - two options:
(a) if input array of eigen-vectors, will define rotation axes
(b) if True, will rotate to align with principal axes stored in species dictionary
other_axis_distance_limits : float :
min and max distances along other axis[s] to keep particles [kpc physical]
property_select : dict : (other) properties to select on: names as keys and limits as values
part_indicess : array or list : indices of particles from which to select
Returns
-------
pros : dict : dictionary of profiles for each particle species
'''
pros = {}
species = parse_species(part, species)
center_position = parse_property(part, 'center_position', center_position)
if 'velocity' in property_name:
center_velocity = parse_property(part, 'center_velocity', center_velocity)
part_indicess = parse_property(species, 'indices', part_indicess)
assert 0 < self.dimension_number <= 3
for spec_i, spec in enumerate(species):
prop_test = property_name
if 'velocity' in prop_test:
prop_test = 'velocity' # treat velocity specially because compile below
assert part[spec].prop(prop_test) is not None
part_indices = part_indicess[spec_i]
if part_indices is None or not len(part_indices):
part_indices = ut.array.get_arange(part[spec].prop(property_name))
if property_select:
part_indices = catalog.get_indices_catalog(
part[spec], property_select, part_indices)
masses = None
if weight_by_mass:
masses = part[spec].prop('mass', part_indices)
if 'velocity' in property_name:
distance_vectors = ut.coordinate.get_distances(
part[spec]['position'][part_indices], center_position,
part.info['box.length'], part.snapshot['scalefactor']) # [kpc physical]
velocity_vectors = ut.coordinate.get_velocity_differences(
part[spec]['velocity'][part_indices], center_velocity,
part[spec]['position'][part_indices], center_position, part.info['box.length'],
part.snapshot['scalefactor'], part.snapshot['time.hubble'])
# defined in DistanceBinClass
pro = self.get_velocity_profile(distance_vectors, velocity_vectors, masses)
pros[spec] = pro[property_name.replace('host.', '')]
for prop in pro:
if 'velocity' not in prop:
pros[spec][prop] = pro[prop]
else:
prop_values = part[spec].prop(property_name, part_indices)
if self.dimension_number == 3:
# simple case: profile using total distance [kpc physical]
distances = ut.coordinate.get_distances(
part[spec]['position'][part_indices], center_position,
part.info['box.length'], part.snapshot['scalefactor'], total_distance=True)
elif self.dimension_number in [1, 2]:
# other cases: profile along R (2 major axes) or Z (minor axis)
if rotation is not None and not isinstance(rotation, bool) and len(rotation):
rotation_tensor = rotation
elif (len(part[spec].host_rotation_tensors) and
len(part[spec].host_rotation_tensors[0])):
rotation_tensor = part[spec].host_rotation_tensors[0]
else:
raise ValueError('want 2-D or 1-D profile but no means to define rotation')
distancess = get_distances_wrt_center(
part, spec, part_indices, center_position, rotation_tensor, 'cylindrical')
distancess = np.abs(distancess)
if self.dimension_number == 1:
# compute profile alongminor axis (Z)
distances = distancess[:, 1]
other_distances = distancess[:, 0]
elif self.dimension_number == 2:
# compute profile along 2 major axes (R)
distances = distancess[:, 0]
other_distances = distancess[:, 1]
if (other_axis_distance_limits is not None and
(min(other_axis_distance_limits) >= 0 or
max(other_axis_distance_limits) < Inf)):
masks = ((other_distances >= min(other_axis_distance_limits)) *
(other_distances < max(other_axis_distance_limits)))
distances = distances[masks]
masses = masses[masks]
prop_values = prop_values[masks]
# defined in DistanceBinClass
pros[spec] = self.get_statistics_profile(distances, prop_values, masses)
return pros
| StarcoderdataPython |
74480 | <reponame>mahajrod/MAVR<gh_stars>1-10
#!/usr/bin/env python
__author__ = '<NAME>'
import argparse
from RouToolPa.Tools.Annotation import AUGUSTUS
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input_gff", action="store", dest="input_gff", required=True,
help="Input AUGUSTUS GFF file")
parser.add_argument("-o", "--output_gff", action="store", dest="output_gff", required=True,
help="Output GFF with exon entries")
parser.add_argument("-e", "--exon_id_prefix", action="store", dest="exon_id_prefix", default="EXON",
help="Prefix of exon id. Default: EXON")
parser.add_argument("-n", "--id_digit_num", action="store", dest="id_digit_num", default=8, type=int,
help="Number of digits in exon id. Default: 8")
args = parser.parse_args()
AUGUSTUS.add_exon_lines_to_augustus_gff(args.input_gff, args.output_gff, number_of_digits_in_id=args.id_digit_num,
exon_id_prefix=args.exon_id_prefix,
new_exon_numering=False)
| StarcoderdataPython |
70915 | <filename>adafruit_circuitpython_libs/adafruit-circuitpython-bundle-py-20210214/examples/gizmo_eink_simpletest.py<gh_stars>10-100
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import displayio
from adafruit_gizmo import eink_gizmo
display = eink_gizmo.EInk_Gizmo()
# Create a display group for our screen objects
display_group = displayio.Group()
# Display a ruler graphic from the root directory of the CIRCUITPY drive
file = open("/display-ruler.bmp", "rb")
picture = displayio.OnDiskBitmap(file)
# Create a Tilegrid with the bitmap and put in the displayio group
sprite = displayio.TileGrid(picture, pixel_shader=displayio.ColorConverter())
display_group.append(sprite)
# Place the display group on the screen
display.show(display_group)
# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
print("refreshed")
time.sleep(180)
| StarcoderdataPython |
3366575 | from setuptools import setup, find_packages
setup(
name='ynab_bank_import',
version='0.1dev0',
author='<NAME>',
author_email='<EMAIL>',
description='YNAB bank import conversion scripts',
long_description=(
open('README.md').read() + '\n' +
open('HISTORY.txt').read()),
license='BSD 2-clause',
entry_points="""
[console_scripts]
ynab_bank_import = ynab_bank_import.main:main
[ynab_accounts]
ing_checking = ynab_bank_import.ing_checking:do_import
ing_aut_checking = ynab_bank_import.ing_aut_checking:do_import
dkb_creditcard = ynab_bank_import.dkb_cc:do_import
dkb_checking = ynab_bank_import.dkb_checking:do_import
comdirect_checking = ynab_bank_import.comdirect:import_account
comdirect_cc = ynab_bank_import.comdirect:import_cc
mt940_csv = ynab_bank_import.mt940:import_account
fiducia_csv = ynab_bank_import.fiducia:import_account
sparkasse_cc = ynab_bank_import.sparkasse:import_cc
transferwise = ynab_bank_import.transferwise:do_import
""",
keywords='import bank accounting personal finance',
zip_safe=False,
packages=find_packages('src'),
include_package_data=True,
package_dir={'': 'src'})
| StarcoderdataPython |
3208657 | n1 = int(input('digite um numero: '))
s1 = n1 - 1
s2 = n1 + 1
#dessa forma
print('antecessor do numero é {} \n sucessor do numero é {}'.format(s1,s2))
#ou
print('analisando o numero {}, seu antecessor é {}, e seu sucessor é {}'.format(n, (n-1), (n+1)))
#eliminando o:
#s1 = n1 - 1
#s2 = n1 + 1 | StarcoderdataPython |
1698151 | #!flask/bin/python
## Main to run our web application
from app import app
app.run(debug=True)
| StarcoderdataPython |
100943 | <filename>Dataset/Leetcode/train/78/546.py
class Solution:
def XXX(self, nums: List[int]) -> List[List[int]]:
if not nums:
return [[]]
rec = []
res = self.XXX(nums[1:])
for r in res:
rec.append(r)
rec.append([nums[0]]+r)
return rec
| StarcoderdataPython |
1644727 | <reponame>Springerle/debianized-pypi-mold
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=
# mkvenv: no-deps
""" Debian packaging for the {{ cookiecutter.pypi_package }} package.
| Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}
| See LICENSE for details.
This puts the ``{{ cookiecutter.pypi_package }}`` Python package and its dependencies as released
on PyPI into a DEB package, using ``dh-virtualenv``.
The resulting *omnibus package* is thus easily installed to and removed
from a machine, but is not a ‘normal’ Debian ``python-*`` package.
Services are controlled by ``systemd`` units.
See the `GitHub README`_ for more.
.. _`GitHub README`: {{ cookiecutter.url }}
"""
import io
import os
import re
import sys
import json
import textwrap
import subprocess
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
try:
from rfc822 import Message as rfc822_headers
except ImportError:
from email import message_from_file as rfc822_headers
try:
from setuptools import setup
except ImportError as exc:
raise RuntimeError("setuptools is missing ({1})".format(exc))
# get external project data (and map Debian version semantics to PEP440)
pkg_version = subprocess.check_output("parsechangelog | grep ^Version:", shell=True)
try:
pkg_version = pkg_version.decode('ascii')
except (UnicodeDecodeError, AttributeError):
pass
pkg_version = pkg_version.strip()
upstream_version, maintainer_version = pkg_version.split()[1].rsplit('~', 1)[0].split('-', 1)
maintainer_version = maintainer_version.replace('~~rc', 'rc').replace('~~dev', '.dev')
pypi_version = upstream_version + '.' + maintainer_version
with io.open('debian/control', encoding='utf-8') as control_file:
data = [x for x in control_file.readlines() if not x.startswith('#')]
control_cleaned = StringIO(''.join(data))
deb_source = rfc822_headers(control_cleaned)
deb_binary = rfc822_headers(control_cleaned)
if not deb_binary:
deb_binary = rfc822_headers(StringIO(deb_source.get_payload()))
try:
doc_string = __doc__.decode('utf-8')
except (UnicodeDecodeError, AttributeError):
doc_string = __doc__
maintainer, email = re.match(r'(.+) <([^>]+)>', deb_source['Maintainer']).groups()
desc, long_desc = deb_binary['Description'].split('.', 1)
desc, pypi_desc = doc_string.split('\n', 1)
long_desc = textwrap.dedent(pypi_desc) + textwrap.dedent(long_desc).replace('\n.\n', '\n\n')
dev_status = 'Development Status :: 5 - Production/Stable'
# Check for pre-release versions like "1.2-3~~rc1~distro"
if '~~rc' in pkg_version or '~~dev' in pkg_version:
rc_tag = re.match('.*~~([a-z0-9]+).*', pkg_version).group(1)
if rc_tag.startswith('dev'):
rc_tag = '.' + rc_tag
if rc_tag not in upstream_version:
upstream_version += rc_tag
if rc_tag not in pypi_version:
pypi_version += rc_tag
dev_status = 'Development Status :: 4 - Beta'
# build setuptools metadata
project = dict(
name='debianized-' + deb_source['Source'],
version=pypi_version,
author=maintainer,
author_email=email,
license='BSD 3-clause',
description=desc.strip(),
long_description=textwrap.dedent(long_desc).strip(),
url=deb_source['Homepage'],
classifiers=[
# Details at http://pypi.python.org/pypi?:action=list_classifiers
'Development Status :: 3 - Alpha',
#dev_status,
'Intended Audience :: Information Technology',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.7',
],
keywords='{{ cookiecutter.pypi_package }} deployment debian-packages dh-virtualenv devops omnibus-packages'.split(),
install_requires=[
# core
'{{ cookiecutter.pypi_package }}==' + upstream_version,
# extensions
#'…==1.2.3',
],
packages=[],
)
# 'main'
__all__ = ['project']
if __name__ == '__main__':
if '--metadata' in sys.argv[:2]:
json.dump(project, sys.stdout, default=repr, indent=4, sort_keys=True)
sys.stdout.write('\n')
elif '--tag' in sys.argv[:2]:
subprocess.call("git tag -a 'v{version}' -m 'Release v{version}'"
.format(version=pypi_version), shell=True)
else:
setup(**project)
| StarcoderdataPython |
4810629 | <filename>cccom.py<gh_stars>1-10
"""
SCons tool to generate a JSON Compilation Database file, specified in:
https://clang.llvm.org/docs/JSONCompilationDatabase.html
The file is a listing with a compilation command line for each translation unit for a target
Syntax:
CompileCommands('compile_commands.json', [ target... ])
CompileCommands([ target... ])
CompilationDatabase('compile_commands.json', [ target... ])
CompilationDatabase([ target... ])
The [ target... ] list, which is a list of sources for this builder, contains other executables and
libraries built in the same project. Source files for this binaries will be included in the
generated compile commands. Only C and C++ sources are listed by default.
CompilationDatabase() is an alias for CompileCommands()
"""
import os
import re
import SCons.Node
import SCons.Environment
import SCons.Script
from SCons.Builder import DictEmitter, CompositeBuilder
from SCons.Builder import ListEmitter
import source_browse_base as base
def is_cc_source(node, cc_suffixes):
""" check if not is a source node with name matching the convention for C and C++ source files """
if not node.is_derived():
return node.get_suffix() in cc_suffixes
def build_suffix_map(target, source, env):
"""
fills two maps with names of variables to be expanded by file name extension (suffix), using
the list in the construction environment.
"""
getList = base.BindCallArguments(base.getList, target, source, env, False)
obj_suffix_map = { k: v for suffix in getList('CCCOM_COMMANDVAR') for (k, v) in suffix.items() }
shobj_suffix_map = { k: v for suffix in getList('CCCOM_SHCOMMANDVAR') for (k, v) in suffix.items() }
return [ obj_suffix_map, shobj_suffix_map ]
def get_build_command(obj_ixes, suffix_map, target, source, env):
"""
retrieve approperiate variable to expand, based on source and target file name conventions
(source file language, target object file type)
"""
basename = os.path.split(target.get_path())[1]
if basename.startswith(obj_ixes[2]) and target.get_suffix() == obj_ixes[3]:
suffix_map = suffix_map[1]
else:
suffix_map = suffix_map[0]
if source.get_suffix() in suffix_map:
return suffix_map[source.get_suffix()]
print("No command found for building " + str(target) + " from " + str(source))
return None
def json_escape_string(string):
""" escape a string for inclusion in the generated .json file """
return '"' + string.replace('\\', '\\\\').replace('"', '\\"') + '"'
def clone_build_env(env, overrides = { }):
if isinstance(env, SCons.Environment.OverrideEnvironment) and '__subject' in env.__dict__:
nested_overrides = { }
nested_overrides.update(env.__dict__['overrides'])
nested_overrides.update(overrides)
return clone_build_env(env.__dict__['__subject'], nested_overrides)
new_env = env.Clone()
new_env.Replace(**overrides)
return new_env.Clone()
def write_compile_commands(target, source, env):
"""
generator function to write the compilation database file (default 'compile_commands.json') for
the given list of source binaries (executables, libraries)
"""
getString = base.BindCallArguments(base.getString, target, source, env, None)
getList = base.BindCallArguments(base.getList, target, source, env, False)
getBool = base.BindCallArguments(base.getBool, target, source, env, lambda x: x)
obj_ixes = \
map(getString, [ 'CCCOM_OBJPREFIX', 'CCCOM_OBJSUFFIX', 'CCCOM_SHOBJPREFIX', 'CCCOM_SHOBJSUFFIX' ])
cc_suffixes = \
getList('CCCOM_SUFFIXES')
source = env.Flatten(source)
suffix_map = build_suffix_map(target, source, env)
has_previous_unit = False
keep_variant_dir = getBool('CCCOM_KEEP_VARIANT_DIR')
db_file = [ '[' ]
for src in source:
nodeWalker = SCons.Node.Walker(src)
child = nodeWalker.get_next()
while child:
if base.is_object_file(child, obj_ixes):
for child_src in child.sources:
if is_cc_source(child_src, cc_suffixes):
build_env = clone_build_env(child.get_build_env())
build_targets = [ child ] + child.alter_targets()[0]
if keep_variant_dir:
build_sources = child.sources
else:
build_sources = [ obj_src.srcnode() for obj_src in child.sources ]
append_flags = getList('CCCOM_APPEND_FLAGS')
filter_flags = getList('CCCOM_REMOVE_FLAGS')
abs_file_path = getBool('CCCOM_ABSOLUTE_FILE')
if not keep_variant_dir or append_flags or filter_flags or 'CCCOM_FILTER_FUNC' in env:
for filter_set in filter_flags:
for var_name in filter_set:
if var_name in build_env:
for val in env.Split(filter_set[var_name]):
if val in build_env[var_name]:
if val in build_env[var_name]:
if isinstance(build_env[var_name], str):
build_env[var_name] = re.sub(r'(^|\s+)' + re.escape(val) + r'(\s+|$)', ' ', build_env[var_name])
else:
while val in build_env[var_name]:
build_env[var_name].remove(val)
for flag_set in append_flags:
build_env.Append(**flag_set)
if 'CCCOM_FILTER_FUNC' in env:
build_env['CCCOM_FILTER_FUNC'] = env['CCCOM_FILTER_FUNC']
build_env['CCCOM_ENV'] = env
val = base.getBool(build_targets, build_sources, build_env, lambda x: x, 'CCCOM_FILTER_FUNC')
if not val:
continue
if has_previous_unit:
db_file.append(' },')
has_previous_unit = True
db_file.extend\
([
' {',
' "directory": ' + json_escape_string(build_env.fs.getcwd().get_abspath()) + ','
])
if keep_variant_dir:
src_file = child_src
else:
src_file = child_src.srcnode()
if abs_file_path:
src_file = src_file.get_abspath()
else:
src_file = src_file.get_path()
db_file.extend\
([
' "file": ' + json_escape_string(src_file) + ',',
' "command": '
+
json_escape_string\
(
build_env.subst\
(
get_build_command(obj_ixes, suffix_map, child, child_src, build_env),
False,
build_targets,
build_sources,
None
)
) + ',',
' "output": '
+
json_escape_string(env.subst('$TARGET', False, build_targets, build_sources))
])
child = nodeWalker.get_next()
if has_previous_unit:
db_file.append(' }')
db_file.append(']')
with open(str(target[0]), 'w') as output_file:
for line in db_file:
output_file.write(line + '\n')
CompileCommandsBuilder = SCons.Script.Builder\
(
action = SCons.Script.Action(write_compile_commands, "$CCCOM_STR"),
multi = True,
suffix = '.json'
)
def JSONCompilationDatabase(env, *args, **kw):
"""
pseudo-builder (environement method) to translate source and target arguments as needed for the
CompileCommandsBuilder(), and call that with the right arguments.
"""
getString = base.BindCallArguments(base.getString, None, None, env, None)
if len(args) == 0:
target, source = [ getString('CCCOM_DATABASE_FILE') ], [ '.' ]
else:
if len(args) == 1:
target, source = [ getString('CCCOM_DATABASE_FILE') ], env.Flatten(args)
else:
target, source = env.Flatten(args[0]), env.Flatten(args[1:])
return CompileCommandsBuilder(env, target, source, **kw)
def exists(env):
""" Check if needed commands for generating comilation database file are present """
return True
def generate(env, **kw):
""" Populate construction variables in `env` environment needed for CompileCommands() builder:
$CCCOM_OBJPREFIX, $CCCOM_OBJSUFFIX, $CCCOM_SHOBJPREFIX, $CCCOM_SHOBJSUFFIX,
$CCCOM_SUFFIXES, $CCCOM_DATABASE_FILE
Attaches CompileCommands() and CompilationDatabase() builders to the environment.
"""
env.SetDefault\
(
CCCOM_OBJPREFIX = '$OBJPREFIX',
CCCOM_OBJSUFFIX = '$OBJSUFFIX',
CCCOM_SHOBJPREFIX = '$SHOBJPREFIX',
CCCOM_SHOBJSUFFIX = '$SHOBJSUFFIX',
CCCOM_SUFFIXES = [ '.c', '.m', '.C', '.cc', '.cpp', '.cxx', '.c++', '.C++', '.mm' ],
CCCOM_COMMANDVAR = \
[
{ '.c': '$CCCOM' }, { '.m': '$CCCOM' },
{ '.C': '$CXXCOM' }, { '.cc': '$CXXCOM' }, { '.cpp': '$CXXCOM' },
{ '.cxx': '$CXXCOM' }, { '.c++': '$CXXCOM' }, { '.C++': '$CXXCOM' },
{ '.mm': '$CXXCOM' }
],
CCCOM_SHCOMMANDVAR = \
[
{ '.c': '$SHCCCOM' }, { '.m': '$SHCCCOM' },
{ '.C': '$SHCXXCOM' }, { '.cc': '$SHCXXCOM' }, { '.cpp': '$SHCXXCOM' },
{ '.cxx': '$SHCXXCOM' }, { '.c++': '$SHCXXCOM' }, { '.C++': '$SHCXXCOM' },
{ '.mm': '$SHCXXCOM' }
],
CCCOM_DATABASE_FILE = 'compile_commands.json',
CCCOM_KEEP_VARIANT_DIR = False,
CCCOM_APPEND_FLAGS = [ ],
CCCOM_REMOVE_FLAGS = [ ],
# CCCOM_FILTER_FUNC = lambda target, source, env, for_signature: True
CCCOM_ABSOLUTE_FILE = False,
CCCOM_STR = "Writing $TARGET"
)
env.AddMethod(JSONCompilationDatabase, 'CompileCommands')
env.AddMethod(JSONCompilationDatabase, 'CompilationDatabase')
| StarcoderdataPython |
3268011 | <reponame>The-Academic-Observatory/observatory-reports
# Copyright 2020 Curtin University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Author: <NAME>
import itertools
import matplotlib.pyplot as plt
import pandas as pd
from observatory.reports.abstract_chart import AbstractObservatoryChart
from observatory.reports.chart_utils import _collect_kwargs_for
class TimePlot(AbstractObservatoryChart):
"""Line charts for showing points of change in time
"""
def __init__(self,
df: pd.DataFrame,
year_range: tuple,
unis: list,
plot_column: str,
hue_column: str = 'name',
size_column: str = None,
**kwargs):
"""Initialisation function
param: year_range: tuple with two elements for range of years to plot
param: unis: list of grid_ids to include
param: plot_column: name of column of input df to use as values
return: None
"""
self.year_range = range(*year_range)
self.unis = unis
self.plot_column = plot_column
self.hue_column = hue_column
self.size_column = size_column
self.kwargs = kwargs
super().__init__(df)
def process_data(self, *kwargs):
"""Data selection and processing function
"""
figdata = self.df
columnorder = [figdata[figdata.id == grid].iloc[0]['name']
for grid in self.unis]
figdata = figdata[(figdata.published_year.isin(
self.year_range)) & (figdata.id.isin(self.unis))]
figdata = figdata.pivot(index='published_year',
columns="name", values=self.plot_column)
figdata = figdata.reindex(columnorder, axis=1)
self.df = figdata
return self.df
def plot(self, ax=None, xticks=None, marker_line=None,
ylim=None, **kwargs):
"""Plotting function
"""
plot_kwargs = _collect_kwargs_for(plt.subplots, kwargs)
if not ax:
self.fig, axes = plt.subplots(len(self.unis), 1, sharex=True,
frameon=False, **plot_kwargs)
self.df.plot(subplots=True, ax=axes, legend=False,
color='black', title=[n for n in self.df.columns])
else:
axes = self.df.plot(subplots=True, ax=ax, legend=False,
color='black',
title=[n for n in self.df.columns])
[ax.spines[loc].set_visible(False) for ax, loc in itertools.product(
axes, ['top', 'right', 'bottom'])]
[ax.tick_params(axis='x', which='both', bottom=False, top=False,
labelbottom=False) for ax in axes[0:len(self.unis) - 1]]
if ylim:
if len(ylim) == 2:
b, t = ylim
[ax.set_ylim(bottom=b, top=t) for ax in axes[0:len(self.unis)]]
else:
[ax.set_ylim(bottom=ylim) for ax in axes[0:len(self.unis)]]
[ax.title.set_ha('left') for ax in axes[0:len(self.unis)]]
[ax.title.set_position([0.03, 0.5]) for ax in axes[0:len(self.unis)]]
axes[-1].spines['bottom'].set_visible(True)
if xticks:
axes[-1].set_xticks(xticks)
axes[-1].tick_params(axis='x', which='minor', bottom=False)
if marker_line:
[ax.axvline(marker_line, 0, 1.2, color='grey',
linestyle='dashed', clip_on=False) for ax in axes]
return self.fig
| StarcoderdataPython |
3357761 | <reponame>grantperry/majortom_gateway_package<filename>setup.py
import setuptools
VERSION = "0.0.7"
with open("README.md", "r") as readme:
readme_content = readme.read()
setuptools.setup(
name="majortom_gateway",
version=VERSION,
author="Kubos",
author_email="<EMAIL>",
description="A package for interacting with Major Tom's Gateway API.",
long_description=readme_content,
long_description_content_type="text/markdown",
url="https://github.com/kubos/majortom_gateway_package",
packages=setuptools.find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent"
],
python_requires='>=3.6',
keywords='majortom major_tom gateway kubos major tom satellite',
install_requires=[
"websockets",
"requests"
]
)
| StarcoderdataPython |
23662 | from selenium import webdriver
import time
chromedriver = "C:/Users/deniz/chromedriver/chromedriver"
driver = webdriver.Chrome(chromedriver)
driver.get('http://127.0.0.1:8000/')
dashboard = '//*[@id="accordionSidebar"]/li[1]/a'
sectors_1 = '//*[@id="sectors"]'
sectors_1_element = '//*[@id="sectors"]/option[4]'
add_sector = '//*[@id="select_filter_form"]/div[1]/input[1]'
remove_sector = '//*[@id="select_filter_form"]/div[1]/input[2]'
sectors_2 = '//*[@id="sectors2"]'
sectors_2_element = '//*[@id="sectors2"]/option[4]'
time.sleep(2)
driver.find_element_by_xpath(dashboard).click()
time.sleep(5)
driver.find_element_by_xpath(sectors_1).click()
time.sleep(2)
driver.find_element_by_xpath(sectors_1_element).click()
time.sleep(5)
driver.find_element_by_xpath(add_sector).click()
time.sleep(5)
driver.find_element_by_xpath(sectors_2).click()
time.sleep(2)
driver.find_element_by_xpath(sectors_2_element).click()
time.sleep(5)
driver.find_element_by_xpath(remove_sector).click()
| StarcoderdataPython |
3369247 | import numpy
import matplotlib.pyplot as plt
from slowfast.visualization.gradcam_utils import *
import imageio
import cv2
from pathlib import Path
path = Path('/mnt/data/ni/ahenkan/SlowFast')
path.mkdir(parents=True, exist_ok=True)
###Loading the localization maps
#load_localization_map = numpy.load(path/f'localization_map_ClassB_0_140349810510912.npy')
#print(load_localization_map)
#load_localization_map = load_localization_map.squeeze()
#plt.show(load_localization_map)
#print(load_localization_map.shape)
# plt.plot(load_localization_map)
# cv2.imread('load_localization_map')
# cv2.imshow
# cap = cv2.VideoCapture('load_localization_map')
# while(cap.isOpened()):
# ret, frame = cap.read()
# gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# cv2.imshow('frame',gray)
# if cv2.waitKey(1) & 0xFF == ord('q'):
# break
# cap.release()
# cv2.destroyAllWindows()
### Loading the data
with open("/mnt/data/ni/ahenkan/SlowFast/complete_locmap_input.pkl","rb") as fb:
output =pickle.load(fb)
print(len(output))
####PLOTTING THE LOCALIZATION MAPS ON TOP OF THE INPUT CLIPS
#for dict1 in output:
D = output[0]
for i in range(len(output)):
print(output[i]["ClassA"].keys)
# #### Reading the Videos
# vid = imageio.get_reader(f'/mnt/data/ni/ahenkan/SlowFast/configs/MyData/ClassA/play.mp4','ffmpeg')
# vidlist = []
# for image in vid.iter_data():
# vidlist.append(numpy.array(image))
# #print(numpy.array(image).shape)
# #print(len(vidlist))
| StarcoderdataPython |
1603501 | <reponame>pixelpassion/django-saas-boilerplate
from django.conf import settings
from django.contrib.auth.forms import PasswordChangeForm
from django.contrib.auth.password_validation import validate_password
from django.contrib.auth.tokens import default_token_generator
from django.utils.encoding import force_text
from django.utils.http import urlsafe_base64_decode as uid_decoder
from rest_auth.serializers import PasswordResetSerializer
from rest_framework import serializers
from rest_framework_simplejwt.serializers import (
TokenObtainPairSerializer,
TokenRefreshSerializer,
TokenVerifySerializer,
)
from rest_framework_simplejwt.tokens import RefreshToken, UntypedToken
from .constants.messages import (
EXPIRED_LINK_MESSAGE,
INVALID_TOKEN_MESSAGE,
NO_REQUEST_IN_CONTEXT_MESSAGE,
NO_USER_IN_REQUEST_MESSAGE,
REQUIRED_FLAG_MESSAGE,
UNIQUE_EMAIL_MESSAGE,
)
from .forms import CustomPasswordResetForm, CustomSetPasswordForm
from .models import User
class CustomTokenObtainPairSerializer(TokenObtainPairSerializer):
""" CustomTokenObtainPairSerializer is designed to add the user security_hash
to token attributes and return additional data with token data
"""
@classmethod
def get_token(cls, user):
token = super().get_token(user)
token["security_hash"] = str(user.security_hash)
return token
def validate_token_by_security_hash(token: object):
""" Сhecks if the user security_hash is equal to the security_hash from the token
"""
user = User.objects.get(id=token["user_id"])
if str(user.security_hash) != token["security_hash"]:
raise serializers.ValidationError(INVALID_TOKEN_MESSAGE)
return
class CustomTokenVerifySerializer(TokenVerifySerializer):
""" CustomTokenVerifySerializer is designed to configure the validate
method and verify the token by user security_hash
"""
def validate(self, attrs):
token = UntypedToken(attrs["token"])
validate_token_by_security_hash(token)
return {}
class CustomTokenRefreshSerializer(TokenRefreshSerializer):
""" CustomTokenRefreshSerializer is designed to configure the validate
method and verify the token by user security_hash
"""
def validate(self, attrs):
data = super().validate(attrs)
refresh = RefreshToken(attrs["refresh"])
validate_token_by_security_hash(refresh)
return data
class CustomPasswordResetSerializer(PasswordResetSerializer):
"""
Default serializer was customized to change form class
"""
password_reset_form_class = CustomPasswordResetForm
class CustomPasswordResetConfirmSerializer(serializers.Serializer):
"""
Serializer for requesting a password reset e-mail.
"""
new_password = serializers.CharField(max_length=128)
uid = serializers.CharField()
token = serializers.CharField()
set_password_form_class = CustomSetPasswordForm
def validate(self, attrs):
self._errors = {}
# Decode the uidb64 to uid to get User object
try:
uid = force_text(uid_decoder(attrs["uid"]))
self.user = User._default_manager.get(pk=uid)
except (TypeError, ValueError, OverflowError, User.DoesNotExist):
raise serializers.ValidationError(EXPIRED_LINK_MESSAGE)
# Construct SetPasswordForm instance
self.set_password_form = self.set_password_form_class(
user=self.user,
data={
"new_password1": attrs["<PASSWORD>"],
"new_password2": attrs["<PASSWORD>"],
},
)
if not self.set_password_form.is_valid():
raise serializers.ValidationError(self.set_password_form.errors)
if not default_token_generator.check_token(self.user, attrs["token"]):
raise serializers.ValidationError(EXPIRED_LINK_MESSAGE)
return attrs
def save(self):
return self.set_password_form.save()
class BaseUserSerializer(serializers.ModelSerializer):
email = serializers.EmailField(max_length=100)
class Meta:
model = User
fields = ["email"]
def validate_email(self, data: str) -> str:
data = data.lower()
if User.objects.filter(email=data).exists():
raise serializers.ValidationError(UNIQUE_EMAIL_MESSAGE)
return data
class UserDetailSerializer(BaseUserSerializer):
first_name = serializers.CharField(max_length=256, required=False)
last_name = serializers.CharField(max_length=256, required=False)
email = serializers.EmailField(read_only=True)
admin_url = serializers.SerializerMethodField()
class Meta(BaseUserSerializer.Meta):
fields = BaseUserSerializer.Meta.fields + [
"first_name",
"last_name",
"admin_url",
"last_password_change_date",
]
def get_admin_url(self, instance):
if instance.is_staff or instance.is_superuser:
return settings.ADMIN_URL
return None
class UserRegistrationSerializer(BaseUserSerializer):
""" User registration serializer
"""
access = serializers.SerializerMethodField(
read_only=True, method_name="get_access_token"
)
refresh = serializers.SerializerMethodField(
read_only=True, method_name="get_refresh_token"
)
first_name = serializers.CharField(max_length=256, required=True)
last_name = serializers.CharField(max_length=256, required=True)
password = <PASSWORD>(write_only=True)
privacy_policy = serializers.BooleanField(required=True, write_only=True)
class Meta(BaseUserSerializer.Meta):
fields = BaseUserSerializer.Meta.fields + [
"access",
"refresh",
"first_name",
"last_name",
"password",
"privacy_policy",
]
def get_access_token(self, user: User) -> str:
refresh_token = RefreshToken.for_user(user)
return str(refresh_token.access_token)
def get_refresh_token(self, user: User) -> str:
refresh_token = RefreshToken.for_user(user)
return str(refresh_token)
def validate_privacy_policy(self, data: bool) -> bool:
if not data:
raise serializers.ValidationError(REQUIRED_FLAG_MESSAGE)
return data
def validate_password(self, data: str) -> str:
validate_password(data)
return data
def create(self, validated_data):
email = validated_data.get("email")
user = User.objects.create(
privacy_policy=validated_data.get("privacy_policy"),
first_name=validated_data.get("first_name"),
last_name=validated_data.get("last_name"),
email=email,
username=email,
is_active=False,
)
user.set_password(validated_data.get("password"))
user.save()
return user
class CustomPasswordChangeSerializer(serializers.Serializer):
""" Customized serializer for changing user password
"""
old_password = serializers.CharField(max_length=128)
new_password = serializers.CharField(max_length=128)
set_password_form_class = PasswordChangeForm
def __init__(self, *args, **kwargs):
super(CustomPasswordChangeSerializer, self).__init__(*args, **kwargs)
self.request = self.context.get("request")
if self.request:
self.user = getattr(self.request, "user", None)
if not self.user:
raise serializers.ValidationError(NO_USER_IN_REQUEST_MESSAGE)
else:
raise serializers.ValidationError(NO_REQUEST_IN_CONTEXT_MESSAGE)
def validate(self, attrs):
self.set_password_form = self.set_password_form_class(
user=self.user,
data={
"old_password": attrs["old_password"],
"new_password1": attrs["new_password"],
"new_password2": attrs["new_password"],
},
)
if not self.set_password_form.is_valid():
raise serializers.ValidationError(self.set_password_form.errors)
return attrs
def save(self):
self.set_password_form.save()
| StarcoderdataPython |
141290 | import socket
import network
import wifi_secrets
import machine
import uos
import usys
import gc
import utime
import ure
import hashlib
from sparkle import Sparkle
import ubinascii
import uio
from irq_counter import IRQCounter
from bme280_sensor import BME280Sensor
from dht22_sensor import DHT22Sensor
from mhz19_sensor import MHZ19Sensor
from sds011_sensor import SDS011Sensor
from config import sensor_configs, hostname
class GrayLogger:
def __init__(self, ingest_location=("10.23.40.2", 5555)):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.socket.connect(ingest_location)
def send(self, data):
print("sending data to graylog")
if type(data) == "str":
data = data.encode("ascii")
self.socket.send(data)
def make_response_section(name, label, description, sensor_type, value):
if type(value) == float:
fmt = ".3f"
elif type(value) == int:
fmt = "d"
return """
{0}{{label="{1}", description="{2}", type="{3}"}} {4:{fmt}}""".format(name, label, description, sensor_type, value, fmt=fmt)
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.config(dhcp_hostname=hostname)
if not wlan.isconnected():
print('connecting to network...')
wlan.connect(wifi_secrets.wifi_ssid, wifi_secrets.wifi_passphrase)
while not wlan.isconnected():
pass
print('network config:', wlan.ifconfig())
print('signal strength:', wlan.status("rssi"))
logger = GrayLogger()
logger.send("hi!")
listener = None
try:
with open("glitter", "r") as f:
hex_glitter = f.read()
glitter = ubinascii.unhexlify(hex_glitter)
# extra 3.3v pin (for connecting two sensors at once)
machine.Pin(13, machine.Pin.OUT).on()
print("before sleep")
# wait for dht sensor to stabilize
utime.sleep(2)
# initialize sensor objects
sensors = {}
provided_vars = set()
for sensor_label, config in sensor_configs.items():
if config["type"] == "dht":
sensors[sensor_label] = DHT22Sensor(config["port"], **config.get("settings", {}))
elif config["type"] == "bme":
sensors[sensor_label] = BME280Sensor(config["port"], **config.get("settings", {}))
elif config["type"] == "mhz":
sensors[sensor_label] = MHZ19Sensor(config["port"], **config.get("settings", {}))
elif config["type"] == "sds":
sensors[sensor_label] = SDS011Sensor(config["port"], **config.get("settings", {}))
elif config["type"] == "counter":
sensors[sensor_label] = IRQCounter(config["port"], **config.get("settings", {}))
provided_vars.update(set(sensors[sensor_label].provides))
provided_vars = list(provided_vars)
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
listener.bind(("0.0.0.0", 5000))
listener.listen(1)
last_connection_duration = 0
while True:
connection = None
try:
connection, peer = listener.accept()
connection_start = utime.ticks_ms()
request = connection.recv(400)
print(request)
method, url, protocol = request.split(b"\r\n", 1)[0].split(b" ")
path = url.split(b"/", 1)[1]
print("incoming request: method {}, url {}, path {}, protocol {}".format(method, url, path, protocol))
respond_404 = False
if path == b"metrics":
response_body = "".join("# TYPE {} gauge\n".format(var)
for var in provided_vars)
for sensor_label in sensors.keys():
sensor = sensors[sensor_label]
sensor_config = sensor_configs[sensor_label]
data = sensor.readout()
for name, value in data.items():
response_body += make_response_section(
name,
sensor_label,
sensor_config["description"],
sensor_config["type"],
value)
response_body += """
# TYPE wifi_rssi gauge
# TYPE memory_used gauge
# TYPE memory_free gauge
# TYPE last_connection_duration_ms gauge
wifi_rssi {}
memory_used {}
memory_free {}
last_connection_duration_ms {}
""".format(wlan.status("rssi"), gc.mem_alloc(), gc.mem_free(), last_connection_duration)
connection.send("HTTP/1.1 200 OK\r\nContent-Length: {}\r\nContent-Type: text/plain; version=0.0.4\r\n\r\n".format(len(response_body)) + response_body)
elif path == b"config":
with open("config.py", "rb") as f:
data = f.read()
connection.send("HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n".format(len(data)).encode("ascii") + data)
elif path == b"ota-listing":
files = []
for entry_info in uos.ilistdir("/"):
name = entry_info[0]
entry_type = entry_info[1]
if name == "glitter":
continue
if entry_type & 0x8000:
# compute a git-compatible hash
hasher = hashlib.sha1(b"blob ")
with open(name, "rb") as f:
length = f.seek(0, 2)
f.seek(0)
hasher.update(str(length).encode("ascii") + bytes([0]))
while True:
chunk = f.read(10000)
if len(chunk) == 0:
break
hasher.update(chunk)
del chunk
gc.collect()
checksum = ubinascii.hexlify(hasher.digest())
files.append(name.encode("ascii") + b" " + checksum)
response = b"\n".join(files)
connection.send("HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n".format(len(response)).encode("ascii") + response)
elif path.startswith(b"ota/"):
path = path.decode("ascii")
path = path.split("?")[0]
path_parts = path.split("/")[1:]
if len(path_parts) > 1:
body = b"ota is currently not supported for files in directories other than /"
connection.send("HTTP/1.1 404 not found\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
continue
filename = path_parts[0]
if not ure.match(r"[0-9a-zA-Z_.]+$", filename):
body = b"invalid filename: may only contain digits, letters, or underscore"
connection.send("HTTP/1.1 400 bad request\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
continue
if filename == "wifi_secrets.py" or filename == "glitter":
body = b"the glitter is secret!"
connection.send("HTTP/1.1 403 forbidden\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
continue
if method == b"GET":
try:
is_file = uos.stat(filename)[0] & 0x8000
except:
is_file = False
if is_file:
with open(filename, "rb") as f:
data = f.read()
connection.send("HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n".format(len(data)).encode("ascii") + data)
else:
response_body = "sorry, but we couldn't find that location :/"
connection.send("HTTP/1.1 404 not found\r\nContent-Length: {}\r\n\r\n".format(len(response_body)) + response_body)
elif method == b"DELETE":
query_match = ure.match(r"[^?]*\?sparkle=([0-9a-f]+)(&noop=((yes)|no))?$", url)
if not query_match:
body = b"no sparkle found, please add sparkle"
connection.send("HTTP/1.1 400 bad request\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
continue
given_sparkle = query_match.group(1)
do_noop = query_match.group(4) is not None
noop_prefix = b"--noop " if do_noop else b""
new_sparkle = Sparkle(glitter, noop_prefix + filename.encode("ascii")).make_sparkle()
new_sparkle = ubinascii.hexlify(new_sparkle)
if new_sparkle != given_sparkle:
body = b"your sparkle wasn't the right one for this file, try again!"
connection.send("HTTP/1.1 400 bad request\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
continue
try:
is_file = uos.stat(filename)[0] & 0x8000
except:
is_file = False
if is_file:
if do_noop is False:
uos.remove(filename)
response_body = "file deleted."
connection.send("HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n".format(len(response_body)) + response_body)
else:
response_body = "file not found"
connection.send("HTTP/1.1 404 not found\r\nContent-Length: {}\r\n\r\n".format(len(response_body)) + response_body)
elif method == b"PUT":
query_match = ure.match(r"[^?]*\?sparkle=([0-9a-f]+)(&noop=((yes)|no))?$", url)
if not query_match:
body = b"no sparkle found, please add sparkle"
connection.send("HTTP/1.1 400 bad request\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
continue
given_sparkle = query_match.group(1)
do_noop = query_match.group(4) is not None
# try to find the content-length header
request_head, content = request.split(b"\r\n\r\n")
request_head += "\r\n"
content_length_match = ure.search(b"[cC][oO][nN][tT][eE][nN][tT]-[lL][eE][nN][gG][tT][hH]:[ \t]+([0-9]+)\r\n", request_head)
if not content_length_match:
body = b"length header is required for putting files"
connection.send("HTTP/1.1 411 length required\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
continue
content_length = int(content_length_match.group(1))
missing_content_length = content_length - len(content)
while missing_content_length > 0:
content += connection.recv(missing_content_length)
missing_content_length = content_length - len(content)
noop_prefix = b"--noop " if do_noop else b""
new_sparkle = Sparkle(glitter, noop_prefix + filename.encode("ascii") + b" " + content).make_sparkle()
new_sparkle = ubinascii.hexlify(new_sparkle)
print(new_sparkle)
print(len(content))
print(missing_content_length)
print(content_length)
if new_sparkle != given_sparkle:
body = b"your sparkle wasn't the right one for this file, try again!"
connection.send("HTTP/1.1 400 bad request\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
continue
if do_noop is False:
with open(filename + ".part", "wb") as f:
f.write(content)
uos.rename(filename + ".part", filename)
body = b"update successful"
connection.send("HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n".format(len(body)).encode("ascii") + body)
elif path.startswith(b"reboot"):
logger.send("received reboot request, rebooting...")
response_body = "rebooting... see you later (hopefully)"
connection.send("HTTP/1.1 202 accepted\r\nContent-Length: {}\r\n\r\n".format(len(response_body)) + response_body)
# this is a hard reboot due to eaddrinuse errors
# (soft reboots keep the part of the network stack apparently, see here:
# https://github.com/micropython/micropython/issues/3739#issuecomment-384037222 )
machine.reset()
else:
file_found = False
if path == b"":
path = b"index.html"
for entry_info in uos.ilistdir("webroot"):
name = entry_info[0]
print("iterating over files in the webroot: {}".format(name))
if name.encode("ascii") == path:
with open("webroot/" + name, "rb") as f:
length = f.seek(0, 2)
f.seek(0)
connection.send("HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n".format(length).encode("ascii"))
# read the response in chunks, we don't have that much ram
while True:
chunk = f.read(10000)
if len(chunk) == 0:
break
connection.send(chunk)
del chunk
gc.collect()
file_found = True
if not file_found:
response_body = "sorry, but we couldn't find that location :/"
connection.send("HTTP/1.1 404 not found\r\nContent-Length: {}\r\n\r\n".format(len(response_body)) + response_body)
last_connection_duration = utime.ticks_ms() - connection_start
except KeyboardInterrupt as e:
raise e
except Exception as e:
buf = uio.StringIO()
usys.print_exception(e, buf)
logger.send(buf.getvalue())
finally:
if connection:
connection.close()
gc.collect() # try to smoothe out memory spikes
except Exception as e:
buf = uio.StringIO()
usys.print_exception(e, buf)
logger.send(buf.getvalue())
raise e
finally:
if listener:
listener.close()
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.