달력

52024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

'카테고리'에 해당되는 글 19건

  1. 2016.05.03 Never Never Give Up
  2. 2016.05.02 Codenames, Tags, and Build Numbers
  3. 2016.04.27 Codelines, Branches, and Releases
  4. 2016.04.20 네번째
  5. 2016.04.20 Overview
  6. 2016.04.04 최소 거리 알고르짐 공부
  7. 2016.02.08
  8. 2016.01.28 두번째
  9. 2016.01.25 처음

Never Never Give Up

일상/뭐 2016. 5. 3. 21:16


 유명한 호주의 닉 부이치치.

네버네버 깁업.

'일상 > ' 카테고리의 다른 글

가을  (0) 2016.11.27
네번째  (0) 2016.04.20
  (0) 2016.02.08
두번째  (0) 2016.01.28
처음  (0) 2016.01.25
Posted by
|

Codenames, Tags, and Build Numbers

코드네임, 태그, 그리고 빌드 번호.


At a high level, Android development happens around families of releases, which use code names ordered alphabetically after tasty treats.

높은 레벨의 안드로이드 개발은 알파벳 오름차순으로 정렬된 음식이름의 코드네임으로 된 배포단위가 일어 났다.


Platform Codenames, Versions, API Levels, and NDK Releases

플랫폼 코드네임, 버전, API 레벨 그리고 NDK 배포


The code names match the following version numbers, along with API levels and NDK releases provided for convenience:

코드 네임은 버전 넘버와 함께 편의를 위해 제공되는 API 레벨, NDK배포와 매칭이 된다.

Code nameVersionAPI level
Marshmallow6.0API level 23
Lollipop5.1API level 22
Lollipop5.0API level 21
KitKat4.4 - 4.4.4API level 19
Jelly Bean4.3.xAPI level 18
Jelly Bean4.2.xAPI level 17
Jelly Bean4.1.xAPI level 16
Ice Cream Sandwich4.0.3 - 4.0.4API level 15, NDK 8
Ice Cream Sandwich4.0.1 - 4.0.2API level 14, NDK 7
Honeycomb3.2.xAPI level 13
Honeycomb3.1API level 12, NDK 6
Honeycomb3.0API level 11
Gingerbread2.3.3 - 2.3.7API level 10
Gingerbread2.3 - 2.3.2API level 9, NDK 5
Froyo2.2.xAPI level 8, NDK 4
Eclair2.1API level 7, NDK 3
Eclair2.0.1API level 6
Eclair2.0API level 5
Donut1.6API level 4, NDK 2
Cupcake1.5API level 3, NDK 1
(no code name)1.1API level 2
(no code name)1.0API level 1

Starting with Cupcake, individual builds are identified with a short build code, e.g. FRF85B.

Cipcake부터 개별적인 빌드는 FRF85B와 같은 짧은 빌드 코드를 가지게 되었다.


The first letter is the code name of the release family, e.g. F is Froyo.

첫 글자는 배포 단위의 코드네임이다. 예를 들어 F는 Froyo이다.


The second letter is a branch code that allows Google to identify the exact code branch that the build was made from, and R is by convention the primary release branch.

두 번째 글자는 구글이 확실히 어느 부분에서 시작된 코드인지 확인 할 수 있는 브랜치 코드이다. R은 규칙에 의한 주요 릴리즈 지점이다.


The next letter and two digits are a date code. The letter counts quarters, with A being Q1 2009. Therefore, F is Q2 2010. The two digits count days within the quarter, so F85 is June 24 2010.

다음 글자와 두 숫자는 날짜 코드이다. 글자는 1분기당 1씩 증가하며 A는 2009년 1분기이다. 그러므로 F는 2010년 2분기이다. 두 숫자는 분기내 하루를 나타낸다. 그러니까, F85는 2010년 6월 24일 이다.


Finally, the last letter identifies individual versions related to the same date code, sequentially starting with A; A is actually implicit and usually omitted for brevity.

마지막으로, 마지막 글자는 같은 날에 개별적인 구분자이다. A부터 연속적으로 지정되며 보통 A는 생략된다.


The date code is not guaranteed to be the exact date at which a build was made, and it is common that minor variations added to an existing build re-use the same date code as that existing build.

날짜 코드는 정확히 빌드된 날짜에 맞춰 붙는 것이 아니다. 보통 이미 빌드된 코드의 같은 날짜 코드를 마이너한 변화를 추가하여 재 빌드한다.


SourceCode Tags and Builds

소스코드 태그와 빌드


Starting with Donut, the exact list of tags and builds is in the following table. Factory images and binaries for Nexus devices can be downloaded from:

Donut부터 태그와 빌드 리스트는 아래 테이블에 있다. 공장이미지와 넥서스 바이너리는 아래 링크에서 다운 받을 수 있다.

https://developers.google.com/android/nexus/images

https://developers.google.com/android/nexus/drivers

(테이블은 여기를 참조해주세요. 너무 태이블이 커서.....)

The branches froyo, gingerbread, ics-mr0, ics-mr1, jb-dev, jb-mr1-dev, jb-mr1.1-dev, jb-mr2-dev, kitkat-dev represent development branches that do not exactly match configurations that were tested by Google. They might contain a variety of changes in addition to the official tagged releases, and those haven't been as thoroughly tested.

froyo, gingerbread, ics-mr0, ics-mr1, jb-dev, jb-mr1-dev, jb-mr1.1-dev, jb-mr2-dev, kitkat-dev는 구글이 테스트한 것과 정확히 일치하지 않는 개발 지점의 대표한다. 그들은 아마 공식으로 이름이 붙은 배포판에 다양한 변화를 추가한 것이고, 정밀한 테스트가 되지 않았을 것이다.


To differentiate between releases, you may obtain a list of changes associated with each project by issuing the following command and passing it the two branch tags:

배포된 것들 사이의 프로젝트 별 이슈 사항 및 두 지점의 다른 점은 아래의 명령어를 통해서 확인 할 수 있다.

$ repo forall -pc 'git log --no-merges --oneline branch-1..branch-2'

For example:
예를 들어 :

$ repo forall -pc 'git log --no-merges --oneline android-4.4.2_r2..android-4.4.2_r1'

And to output to a text file:
그리고 text 파일로 출력 할 수 있다.

repo forall -pc 'git log --no-merges --oneline android-4.4.2_r2..android-4.4.2_r1' > /tmp/android-4.4.2_r2-an


Honeycomb GPL Modules

Honeycomb GPL 모듈


For Honeycomb, the entire platform source code isn't available. However, the parts of Honeycomb licensed under the GPL and LGPL are available under the following tags:

Honeycomb의 전체 플렛폼 소스코드는 사용 할 수 없다. 그러나, GPL과 LGPL의 라이센스 Honeycomb중 아래에 나타난 것들은 사용 할 수 있다.


BuildTagNotes
HRI39android-3.0_r1earliest Honeycomb version
HRI66android-3.0_r1.1
HWI69android-3.0_r1.2
HRI83android-3.0_r1.3
HMJ37android-3.1_r1
HTJ85Bandroid-3.2_r1
HTK55Dandroid-3.2.1_r1
HTK75Dandroid-3.2.1_r2
HLK75Candroid-3.2.2_r1
HLK75Dandroid-3.2.2_r2
HLK75Fandroid-3.2.4_r1
HLK75Handroid-3.2.6_r1

latest Honeycomb version


There is no manifest that contains exactly those. However, there are manifests that allow building those components. The following commands work for 3.0_r1.1, and using other versions can be done by switching the git checkout paramater, and if necessary the -m parameter in repo init. The git checkout command outputs an error for the non-GPL projects, where it can't find the tag in question.

그것들은 정확히 그것들을 나타내는 것이 아니다. 그러나 그것들의 컴포넌트를 빌딩 한 것이다. 아래의 명령어는 3.0_r1.1(git 체크아웃 파라미터를 변경 하면 다른 버전도 동작한다.) 버전을 위한 것이고, repo init(repo 초기화)가 필요하다면 -m를 같이 써도 된다. 위의 표에 Tag로 나타나지 않은 GPL 프로젝트가 아닌 git 체크아웃 명령어는 에러가 난다.


$ repo init -b master -m base-for-3.0-gpl.xml
$ repo sync
$ repo forall
-c git checkout android-3.0_r1.1


Posted by
|

원문 : https://source.android.com/source/code-lines.html


Codelines, Branches, and Releases

코드라인, 브랜치, 그리고 릴리즈

The Android Open Source Project (AOSP) maintains a complete software stack to be ported by OEMs and other device implementors and run on their own hardware. To maintain the quality of Android, Google has contributed full-time engineers, product managers, user interface designers, quality assurance testers, and all the other roles required to bring modern devices to market.


안드로이드 오픈소스 프로젝트는 모든 안드로이드기기와 하드웨어를 위해 완벽한 소프트웨어로 유지 된다. 안드로이드의 품질유지를 위해, 구글은 항시 엔지니어와 제품 매니저와 UI 디자이너, 품질테스터를 제공해 왔고, 현대 기기들을 시장에 내놓기 위한 모든 역활을 해왔다.


Accordingly, we maintain a number of "code lines" to clearly separate the current stable version of Android from unstable experimental work. We roll the open source administration and maintenance of the Android code lines into the larger product development cycle.


그에 따라, 우리는 실험적 불안정한 많은 "코드라인"에서 완벽하게 안정적인 버전의 안드로이드를 구분지었다.  우리는 더 큰 안드로이드 코드라인 개발 사이클을 유지하고 관리하는 역활을 했다.


The chart below depicts at a conceptual level how AOSP manages code and releases. We're referring to these as "code lines" instead of "branches" simply because at any given moment there may be more than one branch for a given "code line". For instance, when a release is cut, it may or may not become a new branch based on the needs of the moment.


아래의 차트는 AOSP(Android Open Source Project)를 어떻게 코드관리와 배포를 하는지에 대한 컨셉을 나타난 것이다.  우리가 "branche" 대신 "코드라인" 이라고 하는 이유는 간단하게 주어진 "코드라인"에 하나이상의 브랜치(branch)가 있기 때문이다. 예로, 배포가 끝나면, 필요에 따라 새로운 브랜치(branche)가 되거나 아닐수 있다.


  1. At any given moment, there is a current latest release of the Android platform. This typically takes the form of a branch in the tree.
  2. Device builders and contributors work with the current latest release, fixing bugs, launching new devices, experimenting with new features, and so on.
  3. In parallel, Google works internally on the next version of the Android platform and framework according to the product's needs and goals. We develop the next version of Android by working with a device partner on a flagship device whose specifications are chosen to push Android in the direction we believe it should go.
  4. When the "n+1"th version is ready, it will be published to the public source tree and become the new latest release.
  1. 안드로이드 플랫폼의 최신 배포가 있는 모든순간에, 그건 일반적으로 트리에 가지(브랜치 branch)형태로 있다.
  2. 기기 제조사와 컨트리뷰터(기여자, 오픈소스프로젝트에 참여하는 방식중 하나)는 최신 배포버전으로 버그 수정, 새기기에 실행시키기, 새로운 기능 실험하기 등을 한다.
  3. 동시에, 구글은 내부적으로 안드로이드 플랫폼과 프레임워크를 제품의 요구와 목표에 맞춰 다음 버전을 준비한다. 우리는 우리의 의도와 같은 협력사의 주력 기기를 선택하여 안드로이드의 다음 버전을 개발한다.
  4. 다음 차기버전이 준비가 되면, 공개 소스 트리에 게재가 되고, 최신버전으로 배포가 된다.

code-line diagram


Terms and Caveats

약관 및 주의사항


  • release corresponds to a formal version of the Android platform, such as 1.5, 2.1, and so on. Generally speaking, a release of the platform corresponds to the version in the SdkVersion field of AndroidManifest.xml files and defined within frameworks/base/api in the source tree.
  • An upstream project is an open source project from which the Android stack is pulling code. These include obvious projects such as the Linux kernel and WebKit. Over time we are migrating some of the semi-autonomous Android projects (such as ART, the Android SDK tools, Bionic, and so on) to work as "upstream" projects. Generally, these projects are developed entirely in the public tree. For some upstream projects, development is done by contributing directly to the upstream project itself. See Upstream Projects for details. In both cases, snapshots will be periodically pulled into releases.
  • At all times, a release code-line (which may actually consist of more than one actual branch in git) is considered the sole canonical source code for a given Android platform version. OEMs and other groups building devices should pull only from a release branch.
  • "Experimental" code-lines are established to capture changes from the community so they can be iterated on with an eye toward stability.
  • Changes that prove stable will eventually be pulled into a release branch. Note this applies only to bug fixes, application improvements, and other changes that do not affect the APIs of the platform.
  • Changes will be pulled into release branches from upstream projects (including the Android "upstream" projects) as necessary.
  • The "n+1"th version (that is, next major version of the framework and platform APIs) will be developed by Google internally. See About Private Codelines for details.
  • Changes will be pulled from upstream, release, and experimental branches into Google's private branch as necessary.
  • When the platform APIs for the next version have stabilized and been fully tested, Google will cut a release of the next platform version. (This specifically refers to a new SdkVersion.) This will also correspond to the internal code-line being made a public release branch, and the new current platform code-line.
  • When a new platform version is cut, a corresponding experimental code-line will be created at the same time.


  • 각 배포는 1.5버전, 2.1버전, 기타 버전 과 같이 안드로이드 플랫폼의 정식 버전에 해당한다. 일반적으로, 플랫폼 배포는 AndroidManifest.xml 파일의 SdkVersion 필드의 버전에 해당하고, 소스트리의 frameworks/base/api 에 정의된다.
  • 업스트림 프로젝트는 안드로이드 저장소에서 당겨온 코드의 오픈소스 프로젝트입니다(ㅠㅠ이이상 매끄럽게 못바꾸겠네요). 그것들은 리눅스커널 과 웹킷과 같은 프로젝트를 포함합니다. 현재까지 우리는 반독립적인 안드로이드 프로젝트인 ART와 안드로이드 SDK툴, Bionic 기타등등을 "업스트림" 프로젝트로 이동시켰다. 보통 그 프로젝트들은 전적으로 공개트리에서 개발되어 왔다. 기여로 완성된 몇 프로젝트는 곧장 업스트림 프로젝트로 간다. 자세한 사항은 업스트림 프로젝트에서 확인 할 수 있다. 두 가지 경우에 스냅샷은 정기적으로 배포된다.
  • 항상 깃에 올라온 실제 하나 이상의 소스코드들은 안드로이드 플랫폼 버전의 소스코드로 고려된다. 제조사들이 만든 기기들은 브랜치에서 가져온 소스코드를 사용한다.
  • "실험적인" 코드라인들의 변경사항들을 인지한 커뮤니티들이 안정성에 눈을 돌리게 한다.
  • 안정성이 검증된 변화들은 결국 release 브랜치에 올라가게 된다. 그 적용사항들은 버그 수정, 어플리케이션 향상 그리고 플랫폼의 API에 영향을 끼치지 않는 것들 이다.
  • 변경사항은 안드로이드 "업스트림" 프로젝트를 포함한 업스트림 프로젝트의 필요에 release 브랜치에 반영 될 것이다.
  • 프레임워크 와 플랫폼 API의 중요(메이저) 차기버전은 구글 내부적으로 개발이 된다. 자세항 사항은 About Private Codelines에서 확인 할 수 있다.
  • 업스트림, 배포 그리고 실험적인 브랜치의 변경사항들은 필요에 따라 구글 내부 브랜치에 반영된다.
  • 차기 버전을 위해 플랫폼 API들이 안정화가 되고, 충분히 테스트가 되었을 때, 구글은 다음 버전의 배포를 끊을 것이다.(그것은 분명하게 SdkVersion를 나타낸다.) 그것은 또한, 내부 코드가 되고, 공개 release 브랜치를 만들고, 새로운 현재 플랫폼 코드라인에 해당한다.
  • 새로운 플랫폼 버전이 끊어지면, 실험적인 코드라인에 해당하는 브랜치가 만들어 질것이다.


About Private Codeline

비공개 코드라인에 대해서.

The source management strategy above includes a code-line that Google will keep private. The reason for this is to focus attention on the current public version of Android.

코드라인을 포함한 소스 관리 기법은 구글내에 비공개로 있다. 그이유는 현재 공개된 버전의 안드로이드에 집중을 하게 하기 위함이다.


OEMs and other device builders naturally want to ship devices with the latest version of Android. Similarly, application developers don't want to deal with more platform versions than strictly necessary. Meanwhile, Google retains responsibility for the strategic direction of Android as a platform and a product. Our approach focuses on a small number of flagship devices to drive features while securing protections of Android-related intellectual property.

제조사들은 자연적으로 안드로이드의 최신버전와 구매할 수 있는 기기를 원한다. 비슷하게, 앱 개발자들은 많은 플랫폼에서 보단 엄격한 필요(적은 수의 플랫폼)를 원한다. 그동안 구글은 안드로이드의 플랫폼과 제품의 전략적인 방향을 책임졌다. 우리는 안드로이드에 대한 지적 재산권의 보호를 하며, 특색을 가진 적은 수의 주요 기기들에 집중을 한다.


As a result, Google frequently has possession of confidential information from third parties. And we must refrain from revealing sensitive features until we've secured the appropriate protections. In addition, there are real risks to the platform arising from having too many platform versions extant at once. For these reasons, we have structured the open source project -- including third-party contributions -- to focus on the currently-public stable version of Android. "Deep development" on the next version of the platform will happen in private until it's ready to become an official release.

그 결과, 구글은 자주 써드파트(Third-Part)에서 기밀의 정보를 갖는다. 그리고 반드시 은밀하고 민감한 특징을 적절한 보호와 보안이 될때까지 숨긴다. 게다가, 한 번에 많은 과거 플랫폼 버전은 정말 위험한 일이 일어난다. 그러한 이유로, 우리는 써드파트 컨트리뷰트를 포함한 오픈소스프로젝트를 현재 공개된 안정적인 버전의 안드로이드에 집중하게 설계했다. 다음 버전으로 "깊은 개발(집중적인 개발)"은 공개적인 배포가 준비가 될때 까지 비밀리에 일어 날 것이다.


We recognize many contributors will disagree with this approach. We respect others may have a different point of view; however, this is the approach we feel is best, and the one we've chosen to implement.

우리는 많은 컨트리뷰터들이 이것에 동의하지 않는 다는 것을 인정한다. 우리는 다른 많은 관점을 존중한다. 하지만 이것이 최선이고, 우리가 선택해야할 일이다.

Posted by
|

네번째

일상/뭐 2016. 4. 20. 22:21

조금씩 천천히 황소걸음으로 가다보면 언젠간 꿈에 근접해 있겠지. 쉬지 않고, 조금더 넓은 보폭으로, 지치지 않게, 꾸준히. 꼭 이루어 질 꺼라는 믿음으로 그렇게 하면 될 것이다. 너무 서두르지 말고, 조급해 하지만 않음 된다. 지치지 않게 스스로 잘 관리를 해야만 한다. 지치면 안된다. 여기서 멈추지만 안으면 된다. 조급해 하지말자.

하루에 정한 양을 꼭 채울 필요도 없다. 중간에 그만 두지만 않으면 된다.

꼭 해낼 것이다. 나는. 꼭 해낼 것이다.


'일상 > ' 카테고리의 다른 글

가을  (0) 2016.11.27
Never Never Give Up  (0) 2016.05.03
  (0) 2016.02.08
두번째  (0) 2016.01.28
처음  (0) 2016.01.25
Posted by
|

원문 : https://source.android.com/source/index.html

오타, 오역 지적 감사하게 받겠습니다. 일단 저도 공부차 하는 짓이라......... 매끄럽지 않는 번역 이해 바랍니다.


The Android Source Code

안도로이드 소스 코드


Android is an open source software stack created for a wide array of devices with different form factors. The primary purposes of Android are to create an open software platform available for carriers, OEMs, and developers to make their innovative ideas a reality and to introduce a successful, real-world product that improves the mobile experience for users.

안드로이드 오픈소스 소프트웨어는 다양한 장치들로 이루어진 많은 기기를 위해 만들어 졌다. 안드로이드의 주 목적은 항공사(운송사)와 제조사, 개발자들이 사용자들의 모바일 경험을 향상 시킬 그들의 혁신적인 아이디어를 현실로 만들고, 성공적인 실제품 위해 실용 가능한 오픈 소프트웨어 플랫폼을 만드는 것이다.


We also wanted to make sure there was no central point of failure, where one industry player could restrict or control the innovations of any other. The result is a full, production-quality consumer product with source code open for customization and porting.

또한 한 곳의 제조사가 독점하거나, 혁신들을 지배하는 일은 없게 확실하게 할 것이다. 그 결과 커스터마이징 및 포팅이 가능한 사용자 제품이 높은 생산 품질이 가능하다.

Android framework details

Governance Philosophy

관리 철학

Android was originated by a group of companies known as the Open Handset Alliance, led by Google. Today, many companies -- both original members of the OHA and others -- have invested heavily in Android. These companies have allocated significant engineering resources to improve Android and bring Android devices to market.

안드로이드는 구글의 Open Handset Alliance라는 구룹에서 비롯 되었다. 현재는 많은 기업들이 안드로이드에 집중적으로 투자하고 있다. 기업들은 안드로이드 향상에 많은 자원을 할당하고, 시장에 내놓는다.


The companies that have invested in Android have done so on its merits because we believe an open platform is necessary. Android is intentionally and explicitly an open source -- as opposed to a free software -- effort; a group of organizations with shared needs has pooled resources to collaborate on a single implementation of a shared product. The Android philosophy is pragmatic, first and foremost. The objective is a shared product that each contributor can tailor and customize.

기업들은 오픈 플랫폼이 꼭 필요하다고 믿기 때문에 곧 안드로이드에 대한 집중 투자는 기업들의 장점이 된다. 자유소프트웨어(free software)와 다른 안드로이드는 전적으로 각각의 기업들의 결과물의 합작으로 만들어진 오픈소스 프로젝트의 결과물이다. 안드로이드의 무엇보다도 최우선시 되는 철학은 실용성이다. 그 목적은 참여자들이 자유롭게 만든 결과물을 공유하는 것이다.


Uncontrolled customization can, of course, lead to incompatible implementations. To prevent this, the Android Open Source Project also maintains the Android Compatibility Program, which spells out what it means to be "Android compatible" and what is required of device builders to achieve that status. Anyone can (and will!) use the Android source code for any purpose, and we welcome all legitimate uses. However, in order to take part in the shared ecosystem of applications we are building around Android, device builders must participate in the Android Compatibility Program.

물론, 통제되지 않은 커스터마이징은 각각의 다른 길로 가게 된다. 그것을 막기위해서는 안드로이드 오픈소스 프로젝트는 "Android Compatibility Program"로도 남겨져야 한다. 그의미는 'Android compatibility(안드로이드 호환성)' 과 제조사들이 그 상황을 이행하는 것이다. 어느 누구든 안드로이드 소스코드를 무슨 목적으로 든 사용 할 수있고 그렇게 할 의무가 있다. 그리고 우리는 합당한 사용을 환영 할 것이다. 우리가 만들어 놓은 모든 안드로이드에 대한 어플리케이션 생태계와 기기 제조사는 안드로이드 프로젝트에 참여하여야 한다.


The Android Open Source Project is led by Google, who maintains and further develops Android. Although Android consists of multiple subprojects, this is strictly a project management technique. We view and manage Android as a single, holistic software product, not a "distribution", specification, or collection of replaceable parts. Our intent is that device builders port Android to a device; they don't implement a specification or curate a distribution.

안드로이드 오픈소스 프로젝트는 관리 및 개발을 하는 구글에 의해 진행 된다. 비록 안드로이드는 엄격한 관리기법으로 관리되는 수 많은 하위 프로젝트로 이루어 져있지만, 안드로이드는 나뉘어지고, 교체가 가능한 것들로 만들어진 것이 아닌, 단 하나의 소프트웨어 제품이다. 우리는 제조사들이 규격을 맞추지 않고, 책임을 다하지 않더라도 안드로이드를 기기에 포팅하기를 바란다.

Posted by
|

#-*- coding: utf-8 -*- 

import math



class PointInfo :

    startPoint =0;

    includeY = []

    def __init__(self, x, dis):

        self.x = x

        self.dis = dis

        self.min = -1

        self.minIndex = -1

        self.NotY = []

        self.initMin()

        self.include = False

        

    def initMin(self):

        self.min = -1

        self.minIndex = -1

        for y in range(len(self.dis)) :

            if self.dis[y] == 0 :

                continue

            

            if self.checkY(y) :

                continue

            

            if self.min == -1 :

                self.min = self.dis[y]

                self.minIndex = y

                

            elif self.min > self.dis[y] :

                self.min = self.dis[y]

                self.minIndex = y

    

    def getMinTo(self):

        return self.minIndex

    

    def getMinDistance(self):

        self.initMin()

        return self.min

    

    def getFinalDistance(self):

        return self.min

    

    def setInclude(self, include = True):

        self.include = include

    

    def getInclude(self):

        return self.include

    

    def checkY(self, y):

        return y in PointInfo.includeY or y in self.NotY

    

    def addNotYList(self, y_list):

        for y in y_list :

            if not y in self.NotY :

                self.addNotY(y)

            

        self.NotY.sort()

    

    def addNotY(self, y):

        self.NotY.append(y)

    

    def delNotY(self, y):

        self.NotY.remove(y)

    

    def getNotYList(self):

        return self.NotY

   


point = [(50 ,50),(26 ,23),(50 ,95),(85 ,66),(67 ,40),(46 ,12),(6 ,2),(51 ,12),(44 ,30),(4 ,56),(61 ,14),(73 ,6),(74 ,72),(51 ,52),

         (7 ,40),(31 ,66),(8 ,16),(62 ,70),(87 ,19),(32 ,77),(56 ,67),(86 ,50),(0 ,74),(65 ,42),(19 ,97),(49 ,14),(4 ,11),(0 ,19),(17 ,37),(46 ,33),(12 ,90)]


PointInfo.startPoint = 0

dis_list = [] 

min_order = [] #[from, to]



def distance(x, y):

    dis = (x[0]-y[0])**2 + (x[1]-y[1])**2

    return math.sqrt(dis)


def checkCircle(x, y):

    count = 0

    temp_y = y

    const = False

    while True :

        const = False

        for p in min_order :

            if temp_y == p[0]:

                temp_y = p[1]

                count += 1

                const = True

                break

        

        if x == temp_y and const == True:

            break

        if const == False :

            break

        

    if count <= len(min_order) :

        if count == len(point) -1 :

            return True

        elif  x == temp_y and const == True:

            return False

        else :

            return True


    if const == False :

        return True

    

    return True


def getMinOrder(dis):

    temp_min = -1

    temp_x = -1

    

    for i in range(len(dis)) :

        if dis[i].getInclude() :

            continue

        

        if temp_min == -1 :

            temp_min = dis[i].getMinDistance()

            temp_x = i

        elif temp_min > dis[i].getMinDistance() : 

            temp_min = dis[i].getMinDistance()

            temp_x = i

    

    if checkCircle(temp_x, dis[temp_x].getMinTo()) :

        dis[temp_x].setInclude()

        dis[dis[temp_x].getMinTo()].addNotYList(dis[temp_x].getNotYList())

        dis[dis[temp_x].getMinTo()].addNotY(temp_x)

        #print("true",temp_x, " , " , dis[temp_x].getMinTo())

        return [temp_x, dis[temp_x].getMinTo()]

    else:

        dis[temp_x].addNotY(dis[temp_x].getMinTo())

        #print("false",temp_x, " , " , dis[temp_x].getMinTo())

        return [-1,-1]

    

    

    #return dis[temp_x].getMinTo()

    


for i in range(len(point)):

    temp_dis = []

    for j in range(len(point)):

        temp_dis.append(distance(point[i], point[j]))

    

    dis_list.append(PointInfo(i, temp_dis))



while True :

    temp = getMinOrder(dis_list)

    if temp[0] == -1 and temp[1] == -1 :

        continue

    min_order.append(temp)

    PointInfo.includeY.append(temp[1])

    

    if len(min_order) > len(point)-1:

        break

    


from_p = PointInfo.startPoint

sorted_p = []

while True :

    for i in range(len(min_order)) :

        if min_order[i][0] == from_p :

            sorted_p.append(min_order[i])

            from_p = min_order[i][1]

        

    if len(sorted_p) == len(point) :

        break

dis_sum = 0

for dis in dis_list :

    dis_sum += dis.getFinalDistance()

print(sorted_p)

print(dis_sum)

Posted by
|

일상/뭐 2016. 2. 8. 00:58

연휴 두번째 아침 오랜만에 느끼는 늘어짐을 즐기며 잠에서 깬후 설날 음식 장만을 돕는다. 대충 도와주고 씻고 집을 나와서 아빠에게 다녀왔다.
오고가는건 한시간 반이나 걸리는데 아빠를 본건 십오분 정도. 다른 가족들은 이미 다녀왔고 제도 지냈으니 일때문에 같이 못단 나만 따로 아빠를 보러 다녀왔다.
가만히 아빠 앞에 앉아 마음 속으로 이런저런 얘기를 하고있는데 어린 여자애 두명과 아버지로보이는 남자가 같이 들어와 내 옆에 섰다. 그러고는 아버지로보이는 남자가 "엄마한테 인사부터 하자"고 했다.
사정이 무엇이든 어떻든 너무 비정한 세상이라. 아직 나도 엄마한테 어리광쟁이인데.. 저런 어린 애들을 두고 어찌 그리됐었는지.. 마음이 아팠다. 이제 큰애는 초등학교에 들어간다고 말하고. 마지막으로 엄마에게 인사를 하고 다시 나가는 부녀들의 뒷모습은 무거운 종잇장 같은 구김으로 얼룩져 보였다.
나도 무거운 마음으로 부녀들의 행복을 바라며 아빠에게 저 애들 엄마도 잘 부탁한다고 전하고 다시 집으로 돌아왔다.

이 세상이 행복으로 모두가 느낄수 있는 행복으로 가득차길 바란다.
나에게 그런 시련이 닥친다면 나는 받아들일수가있을련지...

'일상 > ' 카테고리의 다른 글

가을  (0) 2016.11.27
Never Never Give Up  (0) 2016.05.03
네번째  (0) 2016.04.20
두번째  (0) 2016.01.28
처음  (0) 2016.01.25
Posted by
|

두번째

일상/뭐 2016. 1. 28. 00:05

하고 싶은 말을 다하고 살순 없지.
싸움은 되도록 피하는게 좋고.
서로 아끼는 마음은 숨기지 않고.
아쉬움에 서운하더라도 상대가 미안해 하는 마음이 있다면 그걸로 충분한거라고.
그래도 너무너무 기분이 안좋다고 짜증을 내어 기분이 풀리면 다행인거지, 그럴리는 없다.

볼이 금세 차가워지는 밤, 늦은 시간 퇴근하며 거리의 조명에 밤길을 의지하는 밤. 하하호호 웃음이 나는 거리에 홀로 버스정류장으러 발길을 제촉하며, 언제 끝날지 모르는 일이 너무하다 생각이들어 우울해지는 기분에 니 목소리가 있어 다행이다. 나 빼고 다 행복한거 같아 이게 뭐하는 짓인가 싶을 때도, 니 목소리가 있어 다행이다.

'일상 > ' 카테고리의 다른 글

가을  (0) 2016.11.27
Never Never Give Up  (0) 2016.05.03
네번째  (0) 2016.04.20
  (0) 2016.02.08
처음  (0) 2016.01.25
Posted by
|

처음

일상/뭐 2016. 1. 25. 23:38

​​글을 쓴다.
야근을 하면 몸이 지치기보다 마음이 먼저 지친다.
무엇을 위해서 일을 하는지 기억이 안난다.
일을 한 만큼 돈이 모여야 할 것인데... 일을 해도 돈은 없다.
시간은 앞으로만 흐르지만 나의 흐름은 없는 듯한 느낌.
할 일이있다면 마땅히 남아서 하겠다. 아무리 나의 시간을 나의 능력을 무상으로 지급하기 된다하더라도. 내 책임까지는 다 하겠다.
근데 아무 의미없는 시간은 도저히 안되겠다. 어떠한 이윤이 남는다고 네시간의 시간을 그냥 허비하게 되는건가? 오늘도 남아서 한 거라곤 없다. 오늘 하루 종일 한 일이 없다. 근데 야근을 한다.
날은 춥다. 추운 만큼 마음은 더 빨리 지친다. 날 위해 쓰는 시간도 아니고. 널 위해 쓰는 시간도 아니다. 무엇을 위해 쓰는 시간인지 모르겠다. 나는 모르겠다.

'일상 > ' 카테고리의 다른 글

가을  (0) 2016.11.27
Never Never Give Up  (0) 2016.05.03
네번째  (0) 2016.04.20
  (0) 2016.02.08
두번째  (0) 2016.01.28
Posted by
|